Interface Expr

All Known Implementing Classes:
E_Add, E_BNode, E_Bound, E_Call, E_Cast, E_Coalesce, E_Conditional, E_Datatype, E_DateTimeDay, E_DateTimeHours, E_DateTimeMinutes, E_DateTimeMonth, E_DateTimeSeconds, E_DateTimeTimezone, E_DateTimeTZ, E_DateTimeYear, E_Divide, E_Equals, E_Exists, E_Function, E_FunctionDynamic, E_GreaterThan, E_GreaterThanOrEqual, E_IRI, E_IRI2, E_IsBlank, E_IsIRI, E_IsLiteral, E_IsNumeric, E_IsTriple, E_IsURI, E_Lang, E_LangMatches, E_LessThan, E_LessThanOrEqual, E_LogicalAnd, E_LogicalNot, E_LogicalOr, E_MD5, E_Multiply, E_NotEquals, E_NotExists, E_NotOneOf, E_Now, E_NumAbs, E_NumCeiling, E_NumFloor, E_NumRound, E_OneOf, E_OneOfBase, E_OpNumericIntegerDivide, E_OpNumericMod, E_Random, E_Regex, E_SameTerm, E_SHA1, E_SHA224, E_SHA256, E_SHA384, E_SHA512, E_Str, E_StrAfter, E_StrBefore, E_StrConcat, E_StrContains, E_StrDatatype, E_StrEncodeForURI, E_StrEndsWith, E_StrLang, E_StrLength, E_StrLowerCase, E_StrReplace, E_StrStartsWith, E_StrSubstring, E_StrUpperCase, E_StrUUID, E_Subtract, E_TripleFn, E_TripleObject, E_TriplePredicate, E_TripleSubject, E_UnaryMinus, E_UnaryPlus, E_URI, E_URI2, E_UUID, E_Version, ExprAggregator, ExprDigest, ExprFunction, ExprFunction0, ExprFunction1, ExprFunction2, ExprFunction3, ExprFunctionN, ExprFunctionOp, ExprNode, ExprNone, ExprSystem, ExprTripleTerm, ExprVar, NodeValue, NodeValueBoolean, NodeValueDateTime, NodeValueDecimal, NodeValueDouble, NodeValueDuration, NodeValueFloat, NodeValueInteger, NodeValueLang, NodeValueNode, NodeValueSortKey, NodeValueString

public interface Expr
  • Field Details

  • Method Details

    • isSatisfied

      boolean isSatisfied(Binding binding, FunctionEnv execCxt)
      Test whether a Constraint is satisfied, given a set of bindings Includes error propagation and Effective Boolean Value rules.
      Parameters:
      binding - The bindings
      execCxt - FunctionEnv
      Returns:
      true or false
    • getVarsMentioned

      Set<Var> getVarsMentioned()
      Variables used by this expression.
      See Also:
    • eval

      NodeValue eval(Binding binding, FunctionEnv env)
      Evaluate this expression against the binding
      Parameters:
      binding -
      env -
    • copySubstitute

      Expr copySubstitute(Binding binding)
      Deep copy with substitution
    • applyNodeTransform

      Expr applyNodeTransform(NodeTransform transform)
      Rewrite, applying a node->node transformation
    • deepCopy

      Expr deepCopy()
      Deep copy
    • isVariable

      boolean isVariable()
      Answer whether this is a variable.
    • getVarName

      String getVarName()
      Variable name (returns null if not a variable)
    • getExprVar

      ExprVar getExprVar()
      Variable (or null)
    • asVar

      Var asVar()
      Convert to a Var variable.
    • isConstant

      boolean isConstant()
      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
    • getConstant

      NodeValue getConstant()
      NodeValue constant (returns null if not a constant)
    • isFunction

      boolean isFunction()
      Answer whether this is a function.
    • getFunction

      ExprFunction getFunction()
      Get the function (returns null if not a function)
    • visit

      void visit(ExprVisitor visitor)
    • hashCode

      int hashCode()
      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.

      Overrides:
      hashCode in class Object
    • equals

      boolean equals(Object other)
      Overrides:
      equals in class Object
    • equalsBySyntax

      boolean equalsBySyntax(Expr other)
    • equals

      boolean equals(Expr other, boolean bySyntax)
      General equality operation - consider this to be 'protected'