Class PathEvaluator


  • public class PathEvaluator
    extends Object
    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 Detail

      • 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 path
        shapesModel - the shapes Model
    • Method Detail

      • 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

        public boolean isMaybeInferred​(ShapesGraph shapesGraph)
        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

        public boolean isReversible​(ShapesGraph shapesGraph)