Interface NodeExpression

All Known Subinterfaces:
AtomicNodeExpression
All Known Implementing Classes:
AbstractInputExpression, AbstractNodeExpression, AbstractSPARQLExpression, AskExpression, ComplexNodeExpression, ConstantTermExpression, CountExpression, DistinctExpression, ExistsExpression, FilterShapeExpression, FocusNodeExpression, FunctionExpression, GroupConcatExpression, IfExpression, IntersectionExpression, LimitExpression, MaxExpression, MinExpression, MinusExpression, OffsetExpression, OrderByExpression, PathExpression, SelectExpression, SumExpression, UnionExpression

public interface NodeExpression
Interface of all SHACL node expression runtime objects.
Author:
Holger Knublauch
  • 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)
    Produces an iterator of value nodes for a given focus node.
    org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode>
    evalReverse(org.apache.jena.rdf.model.RDFNode valueNode, NodeExpressionContext context)
    Produces an iterator of focus nodes for a given value node.
    Produces a "functional" syntax used to display node expressions in a compact form.
     
    org.apache.jena.rdf.model.Resource
    getOutputShape(org.apache.jena.rdf.model.Resource contextShape)
    Gets the shape of the output data (if known), based on a context shape.
    org.apache.jena.rdf.model.RDFNode
    Gets the RDF node that was used to construct the expression, in the SHACL node expressions syntax.
     
    boolean
    Checks if this expression could be evaluated in the reverse direction, with a value given and then finding all focus nodes.
    void
     
  • Method Details

    • eval

      org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode> eval(org.apache.jena.rdf.model.RDFNode focusNode, NodeExpressionContext context)
      Produces an iterator of value nodes for a given focus node.
      Parameters:
      focusNode - the focus node
      context - the context
      Returns:
      an iterator (never null)
    • evalReverse

      org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.rdf.model.RDFNode> evalReverse(org.apache.jena.rdf.model.RDFNode valueNode, NodeExpressionContext context)
      Produces an iterator of focus nodes for a given value node. This operation can only be called for node expressions where isReversible returns true and may throw an IllegalStateException otherwise.
      Parameters:
      valueNode - the value node
      context - the context
      Returns:
      an iterator (never null)
    • getFunctionalSyntax

      String getFunctionalSyntax()
      Produces a "functional" syntax used to display node expressions in a compact form.
      Returns:
      the functional syntax for this expression
    • getInputExpressions

      List<NodeExpression> getInputExpressions()
    • getOutputShape

      org.apache.jena.rdf.model.Resource getOutputShape(org.apache.jena.rdf.model.Resource contextShape)
      Gets the shape of the output data (if known), based on a context shape. For example, for a path expression it would try to infer the output shape from the sh:class or sh:node of the property (path).
      Parameters:
      contextShape - the shape where the evaluation would start, e.g. the node shape of the sh:values statement
      Returns:
      an output shape or null if unknown
    • getRDFNode

      org.apache.jena.rdf.model.RDFNode getRDFNode()
      Gets the RDF node that was used to construct the expression, in the SHACL node expressions syntax.
      Returns:
      the RDF node
    • getTypeId

      String getTypeId()
    • isReversible

      boolean isReversible(NodeExpressionContext context)
      Checks if this expression could be evaluated in the reverse direction, with a value given and then finding all focus nodes. The function evalReverse can then be called. NOTE THAT THIS IS CURRENTLY BARELY IMPLEMENTED.
      Parameters:
      context - the context
      Returns:
      true if reversible
    • visit

      void visit(NodeExpressionVisitor visitor)