Package org.topbraid.shacl.expr
Class PathEvaluator
java.lang.Object
org.topbraid.shacl.expr.PathEvaluator
An object that computes the values of a sh:path node expression.
This implements consistent handling of inferred values.
Inferences are limited to simple forward paths consisting of a single predicate.
- Author:
- Holger Knublauch
-
Constructor Summary
ConstructorsConstructorDescriptionPathEvaluator(org.apache.jena.rdf.model.Property predicate) Constructs a PathEvaluator for a single "forward" property look-up.PathEvaluator(org.apache.jena.sparql.path.Path path, org.apache.jena.rdf.model.Model shapesModel) Constructs a PathEvaluator for an arbitrary SPARQL path (except single forward properties). -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode>eval(org.apache.jena.rdf.model.RDFNode focusNode, NodeExpressionContext context) org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode>evalReverse(org.apache.jena.rdf.model.RDFNode valueNode, NodeExpressionContext context) org.apache.jena.sparql.path.PathGets the executed Jena Path or null if this is just a simple forward property.org.apache.jena.rdf.model.PropertyGets the predicate if this is a simple forward property path.booleanisMaybeInferred(ShapesGraph shapesGraph) Checks if the values of this may be inferred.booleanisReversible(ShapesGraph shapesGraph) voidsetInput(NodeExpression input)
-
Constructor Details
-
PathEvaluator
public PathEvaluator(org.apache.jena.rdf.model.Property predicate) Constructs a PathEvaluator for a single "forward" property look-up.- Parameters:
predicate- the predicate
-
PathEvaluator
public PathEvaluator(org.apache.jena.sparql.path.Path path, org.apache.jena.rdf.model.Model shapesModel) Constructs a PathEvaluator for an arbitrary SPARQL path (except single forward properties).- Parameters:
path- the pathshapesModel- the shapes Model
-
-
Method Details
-
eval
public org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode> eval(org.apache.jena.rdf.model.RDFNode focusNode, NodeExpressionContext context) -
evalReverse
public org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode> evalReverse(org.apache.jena.rdf.model.RDFNode valueNode, NodeExpressionContext context) -
getJenaPath
public org.apache.jena.sparql.path.Path getJenaPath()Gets the executed Jena Path or null if this is just a simple forward property.- Returns:
-
getPredicate
public org.apache.jena.rdf.model.Property getPredicate()Gets the predicate if this is a simple forward property path. Returns null for inverse paths.- Returns:
- the predicate or null
-
isMaybeInferred
Checks if the values of this may be inferred. This is the case if this uses a single forward property path and there are any sh:values or sh:defaultValue statements on that predicate in the provided shapes graph. The actual computation on whether the values are inferred depends on the actual focus node, which is why this is only a "maybe". This function may be used to exclude optimizations that are possible if we know that no inferences can exist.- Parameters:
shapesGraph- the ShapesGraph (which caches previous results)- Returns:
- true if there may be sh:values statements
-
isReversible
-
setInput
-