Class SPINConstraints
java.lang.Object
com.atomgraph.spinrdf.constraints.SPINConstraints
- Author:
- Martynas Jusevičius <martynas@atomgraph.com>
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.rdf.model.Model 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.rdf.model.Model model, org.apache.jena.rdf.model.Model constraintModel) static List<ConstraintViolation>check(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Property predicate) Checks all instances in a given Model and returns a List of constraint violations.static List<ConstraintViolation>check(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Property predicate, org.apache.jena.rdf.model.Model constraintModel) protected static Map<org.apache.jena.rdf.model.Resource,List<SPINConstraints.QueryWrapper>> class2Query(org.apache.jena.rdf.model.Model 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)
-
Constructor Details
-
SPINConstraints
public SPINConstraints()
-
-
Method Details
-
check
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.rdf.model.Model model, org.apache.jena.rdf.model.Model constraintModel) -
check
public static List<ConstraintViolation> check(org.apache.jena.rdf.model.Model 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
-
check
public static List<ConstraintViolation> check(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Property predicate, org.apache.jena.rdf.model.Model constraintModel) -
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.rdf.model.Model 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
Gets the label for a given Resource.- Parameters:
resource- the Resource to get the label of- Returns:
- the label (never null)
-