Package org.topbraid.shacl.engine
Class ShapesGraph
java.lang.Object
org.topbraid.shacl.engine.ShapesGraph
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 Summary
ConstructorsConstructorDescriptionShapesGraph(org.apache.jena.rdf.model.Model shapesModel) Constructs a new ShapesGraph. -
Method Summary
Modifier and TypeMethodDescriptionclone()createConstraint(Shape shape, SHConstraintComponent component, List<SHParameter> params, org.apache.jena.rdf.model.RDFNode parameterValue) getComponentWithParameter(org.apache.jena.rdf.model.Property parameter) 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.org.apache.jena.shared.PrefixMappinggetPathString(org.apache.jena.rdf.model.Resource path) Gets all non-deactivated shapes that declare a target and pass the provided filter.getShape(org.apache.jena.graph.Node node) org.apache.jena.rdf.model.ModelMap<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.booleanisIgnored(org.apache.jena.graph.Node shapeNode) booleanisIgnoredConstraint(Constraint constraint) voidsetConstraintFilter(Predicate<Constraint> value) Sets a filter Predicate that can be used to ignore certain constraints.voidsetShapeFilter(Predicate<SHShape> value) Sets a filter Predicate that can be used to ignore certain shapes.
-
Constructor Details
-
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 Details
-
clone
-
createConstraint
public Constraint createConstraint(Shape shape, SHConstraintComponent component, List<SHParameter> params, org.apache.jena.rdf.model.RDFNode parameterValue) -
getComponentWithParameter
public SHConstraintComponent getComponentWithParameter(org.apache.jena.rdf.model.Property parameter) -
getFastPrefixMapping
public org.apache.jena.shared.PrefixMapping getFastPrefixMapping() -
getPathString
-
getRootShapes
Gets all non-deactivated shapes that declare a target and pass the provided filter.- Returns:
- the root shapes
-
getShape
-
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
-
setConstraintFilter
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
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
-