Class ShapesGraph


  • public class ShapesGraph
    extends Object
    Represents a shapes graph as input to an engine (e.g. validation or inferencing). This is basically a collection of Shapes with some data structures that avoid repetitive computation.
    Author:
    Holger Knublauch
    • Constructor Detail

      • ShapesGraph

        public ShapesGraph​(org.apache.jena.rdf.model.Model shapesModel)
        Constructs a new ShapesGraph. This should not be called directly, only from ShapesGraphFactory.
        Parameters:
        shapesModel - the Model containing the shape definitions
    • Method Detail

      • getComponentWithParameter

        public SHConstraintComponent getComponentWithParameter​(org.apache.jena.rdf.model.Property parameter)
      • getFastPrefixMapping

        public org.apache.jena.shared.PrefixMapping getFastPrefixMapping()
      • getPathString

        public String getPathString​(org.apache.jena.rdf.model.Resource path)
      • getRootShapes

        public List<Shape> getRootShapes()
        Gets all non-deactivated shapes that declare a target and pass the provided filter.
        Returns:
        the root shapes
      • getShape

        public Shape getShape​(org.apache.jena.graph.Node node)
      • getDefaultValueNodeExpressionsMap

        public Map<org.apache.jena.graph.Node,​NodeExpression> getDefaultValueNodeExpressionsMap​(org.apache.jena.rdf.model.Resource predicate)
        Gets a Map from (node) shapes to NodeExpressions derived from sh:defaultValue statements.
        Parameters:
        predicate - the predicate to infer
        Returns:
        a Map which is empty if the predicate is not mentioned in any inferences
      • getValuesNodeExpressionsMap

        public Map<org.apache.jena.graph.Node,​NodeExpression> getValuesNodeExpressionsMap​(org.apache.jena.rdf.model.Resource predicate)
        Gets a Map from (node) shapes to NodeExpressions derived from sh:values statements. Can be used to efficiently figure out how to infer the values of a given instance, based on the rdf:types of the instance.
        Parameters:
        predicate - the predicate to infer
        Returns:
        a Map which is empty if the predicate is not mentioned in any inferences
      • getShapesModel

        public org.apache.jena.rdf.model.Model getShapesModel()
      • isIgnored

        public boolean isIgnored​(org.apache.jena.graph.Node shapeNode)
      • isIgnoredConstraint

        public boolean isIgnoredConstraint​(Constraint constraint)
      • setConstraintFilter

        public void setConstraintFilter​(Predicate<Constraint> value)
        Sets a filter Predicate that can be used to ignore certain constraints. See for example CoreConstraintFilter. Such filters must return true if the Constraint should be used, false to ignore. This method should be called immediately after the constructor only.
        Parameters:
        value - the new constraint filter
      • setShapeFilter

        public void setShapeFilter​(Predicate<SHShape> value)
        Sets a filter Predicate that can be used to ignore certain shapes. Such filters must return true if the shape should be used, false to ignore. This method should be called immediately after the constructor only.
        Parameters:
        value - the new shape filter