Package org.topbraid.shacl.engine
Class ShapesGraph
- java.lang.Object
-
- org.topbraid.shacl.engine.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 Summary
Constructors Constructor Description ShapesGraph(org.apache.jena.rdf.model.Model shapesModel)Constructs a new ShapesGraph.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ShapesGraphclone()ConstraintcreateConstraint(Shape shape, SHConstraintComponent component, List<SHParameter> params, org.apache.jena.rdf.model.RDFNode parameterValue)SHConstraintComponentgetComponentWithParameter(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.PrefixMappinggetFastPrefixMapping()StringgetPathString(org.apache.jena.rdf.model.Resource path)List<Shape>getRootShapes()Gets all non-deactivated shapes that declare a target and pass the provided filter.ShapegetShape(org.apache.jena.graph.Node node)org.apache.jena.rdf.model.ModelgetShapesModel()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.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.
-
-
-
Method Detail
-
clone
public ShapesGraph 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
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
-
-