Class ExprNode

java.lang.Object
org.apache.jena.sparql.expr.ExprNode
All Implemented Interfaces:
Expr
Direct Known Subclasses:
ExprAggregator, ExprFunction, ExprNone, ExprTripleTerm, ExprVar, NodeValue

public abstract class ExprNode extends Object implements Expr
A node that is a constraint expression that can be evaluated An Expr is already a Constraint - ExprNode is the base implementation of all Expr classes that provides the Constraint machinery.
  • Constructor Details

    • ExprNode

      public ExprNode()
  • Method Details

    • isSatisfied

      public boolean isSatisfied(Binding binding, FunctionEnv funcEnv)
      Description copied from interface: Expr
      Test whether a Constraint is satisfied, given a set of bindings Includes error propagation and Effective Boolean Value rules.
      Specified by:
      isSatisfied in interface Expr
      Parameters:
      binding - The bindings
      funcEnv - FunctionEnv
      Returns:
      true or false
    • isExpr

      public boolean isExpr()
    • getExpr

      public final Expr getExpr()
    • eval

      public abstract NodeValue eval(Binding binding, FunctionEnv env)
      Description copied from interface: Expr
      Evaluate this expression against the binding
      Specified by:
      eval in interface Expr
    • getVarsMentioned

      public final Set<Var> getVarsMentioned()
      Description copied from interface: Expr
      Variables used by this expression.
      Specified by:
      getVarsMentioned in interface Expr
      See Also:
    • hashCode

      public abstract int hashCode()
      Description copied from interface: Expr
      Expr are used in both syntax and algebra. There is no syntax to algebra translation step because the parser uses operator precedence to build the right evaluation structure directly.

      The exceptions to this are the NOT EXISTS and EXISTS expressions which involve a query pattern. As a result there are different ways in syntax to produce the same algebra form.

      Two Expr are considered equal if they are equal as algebra expressions. hashCode and equals must implement that.

      There is also equalsBySyntax. Because two different syntax forms can yield the same algebra, but two different algebra forms must be different syntax, equalsBySyntax implies equals (by algebra).

      Hence, different hashCode => not equalsBySyntax.

      Specified by:
      hashCode in interface Expr
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object other)
      Specified by:
      equals in interface Expr
      Overrides:
      equals in class Object
    • equalsBySyntax

      public final boolean equalsBySyntax(Expr other)
      Specified by:
      equalsBySyntax in interface Expr
    • equals

      public abstract boolean equals(Expr other, boolean bySyntax)
      Description copied from interface: Expr
      General equality operation - consider this to be 'protected'
      Specified by:
      equals in interface Expr
    • deepCopy

      public final Expr deepCopy()
      Description copied from interface: Expr
      Deep copy
      Specified by:
      deepCopy in interface Expr
    • copySubstitute

      public abstract Expr copySubstitute(Binding binding)
      Description copied from interface: Expr
      Deep copy with substitution
      Specified by:
      copySubstitute in interface Expr
    • applyNodeTransform

      public abstract Expr applyNodeTransform(NodeTransform transform)
      Description copied from interface: Expr
      Rewrite, applying a node->node transformation
      Specified by:
      applyNodeTransform in interface Expr
    • isVariable

      public boolean isVariable()
      Description copied from interface: Expr
      Answer whether this is a variable.
      Specified by:
      isVariable in interface Expr
    • getVarName

      public String getVarName()
      Description copied from interface: Expr
      Variable name (returns null if not a variable)
      Specified by:
      getVarName in interface Expr
    • getExprVar

      public ExprVar getExprVar()
      Description copied from interface: Expr
      Variable (or null)
      Specified by:
      getExprVar in interface Expr
    • asVar

      public Var asVar()
      Description copied from interface: Expr
      Convert to a Var variable.
      Specified by:
      asVar in interface Expr
    • isConstant

      public boolean isConstant()
      Description copied from interface: Expr
      Answer whether this is a constant expression - false includes "don't know" No constant folding so "false" from an expression that evaluates to a constant
      Specified by:
      isConstant in interface Expr
    • getConstant

      public NodeValue getConstant()
      Description copied from interface: Expr
      NodeValue constant (returns null if not a constant)
      Specified by:
      getConstant in interface Expr
    • isFunction

      public boolean isFunction()
      Description copied from interface: Expr
      Answer whether this is a function.
      Specified by:
      isFunction in interface Expr
    • getFunction

      public ExprFunction getFunction()
      Description copied from interface: Expr
      Get the function (returns null if not a function)
      Specified by:
      getFunction in interface Expr
    • isGraphPattern

      public boolean isGraphPattern()
    • getGraphPattern

      public Op getGraphPattern()
    • toString

      public String toString()
      Overrides:
      toString in class Object