Class SPINConstraints


  • public class SPINConstraints
    extends Object
    Author:
    Martynas Jusevičius <martynas@atomgraph.com>
    • Constructor Detail

      • SPINConstraints

        public SPINConstraints()
    • 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 on
        predicate - 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)
      • 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 objects
        result - the Model to add the results to
        createSource - 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)