Class SPINConstraints
- java.lang.Object
-
- com.atomgraph.spinrdf.constraints.SPINConstraints
-
public class SPINConstraints extends Object
- Author:
- Martynas Jusevičius <martynas@atomgraph.com>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSPINConstraints.QueryWrapper
-
Constructor Summary
Constructors Constructor Description SPINConstraints()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static voidaddClassContraints(org.apache.jena.rdf.model.Statement stmt, org.apache.jena.rdf.model.Property predicate, Map<org.apache.jena.rdf.model.Resource,List<SPINConstraints.QueryWrapper>> class2Query)static voidaddConstraintViolationsRDF(List<ConstraintViolation> cvs, org.apache.jena.rdf.model.Model result, boolean createSource)Creates an RDF representation (instances of spin:ConstraintViolation) from a collection of ConstraintViolation Java objects.static List<ConstraintViolation>check(org.apache.jena.ontology.OntModel model)Checks all instances in a given Model against all spin:constraints and returns a List of constraint violations.static List<ConstraintViolation>check(org.apache.jena.ontology.OntModel model, org.apache.jena.rdf.model.Property predicate)Checks all instances in a given Model and returns a List of constraint violations.protected static Map<org.apache.jena.rdf.model.Resource,List<SPINConstraints.QueryWrapper>>class2Query(org.apache.jena.ontology.OntModel model, org.apache.jena.rdf.model.Property predicate)protected static SPINConstraints.QueryWrappercreateWrapper(org.apache.jena.rdf.model.Resource constraint)static StringgetLabel(org.apache.jena.rdf.model.Resource resource)Gets the label for a given Resource.protected static Set<org.apache.jena.rdf.model.Resource>getSubClasses(org.apache.jena.rdf.model.Resource cls)protected static Set<org.apache.jena.rdf.model.Resource>getSuperClasses(org.apache.jena.rdf.model.Resource cls)protected static List<ConstraintViolation>runQueryOnClass(SPINConstraints.QueryWrapper wrapper, org.apache.jena.rdf.model.Resource cls, org.apache.jena.rdf.model.Model model)
-
-
-
Method Detail
-
check
public static List<ConstraintViolation> check(org.apache.jena.ontology.OntModel model)
Checks all instances in a given Model against all spin:constraints and returns a List of constraint violations. A ProgressMonitor can be provided to enable the user to get intermediate status reports and to cancel the operation.- Parameters:
model- the Model to operate on- Returns:
- a List of ConstraintViolations
-
check
public static List<ConstraintViolation> check(org.apache.jena.ontology.OntModel model, org.apache.jena.rdf.model.Property predicate)
Checks all instances in a given Model and returns a List of constraint violations.- Parameters:
model- the Model to operate onpredicate- the system property, e.g. a sub-property of spin:constraint- Returns:
- a List of ConstraintViolations
-
getSubClasses
protected static Set<org.apache.jena.rdf.model.Resource> getSubClasses(org.apache.jena.rdf.model.Resource cls)
-
getSuperClasses
protected static Set<org.apache.jena.rdf.model.Resource> getSuperClasses(org.apache.jena.rdf.model.Resource cls)
-
class2Query
protected static Map<org.apache.jena.rdf.model.Resource,List<SPINConstraints.QueryWrapper>> class2Query(org.apache.jena.ontology.OntModel model, org.apache.jena.rdf.model.Property predicate)
-
addClassContraints
protected static void addClassContraints(org.apache.jena.rdf.model.Statement stmt, org.apache.jena.rdf.model.Property predicate, Map<org.apache.jena.rdf.model.Resource,List<SPINConstraints.QueryWrapper>> class2Query)
-
createWrapper
protected static SPINConstraints.QueryWrapper createWrapper(org.apache.jena.rdf.model.Resource constraint)
-
runQueryOnClass
protected static List<ConstraintViolation> runQueryOnClass(SPINConstraints.QueryWrapper wrapper, org.apache.jena.rdf.model.Resource cls, org.apache.jena.rdf.model.Model model)
-
addConstraintViolationsRDF
public static void addConstraintViolationsRDF(List<ConstraintViolation> cvs, org.apache.jena.rdf.model.Model result, boolean createSource)
Creates an RDF representation (instances of spin:ConstraintViolation) from a collection of ConstraintViolation Java objects.- Parameters:
cvs- the violation objectsresult- the Model to add the results tocreateSource- true to also create the spin:violationSource
-
getLabel
public static String getLabel(org.apache.jena.rdf.model.Resource resource)
Gets the label for a given Resource.- Parameters:
resource- the Resource to get the label of- Returns:
- the label (never null)
-
-