Class SPINConstraints

java.lang.Object
com.atomgraph.spinrdf.constraints.SPINConstraints

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

    • SPINConstraints

      public SPINConstraints()
  • Method Details

    • check

      public 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. 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 on
      predicate - 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 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)