Class PathEvaluator

java.lang.Object
org.topbraid.shacl.expr.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 Summary

    Constructors
    Constructor
    Description
    PathEvaluator(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 Type
    Method
    Description
    org.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.Path
    Gets the executed Jena Path or null if this is just a simple forward property.
    org.apache.jena.rdf.model.Property
    Gets the predicate if this is a simple forward property path.
    boolean
    Checks if the values of this may be inferred.
    boolean
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 path
      shapesModel - 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

      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)
    • setInput

      public void setInput(NodeExpression input)