Class ExprFunction

All Implemented Interfaces:
Direct Known Subclasses:
ExprFunction0, ExprFunction1, ExprFunction2, ExprFunction3, ExprFunctionN, ExprFunctionOp

public abstract class ExprFunction extends ExprNode
A function in the expression hierarchy. Everything that can be evaluated (i.e. not NodeValue, NodeVar) is a function. This includes functional forms (e.g. BOUND) and also custom functions (called by URI). The exists operations (which take a op, not arguments) are functions of zero arguments.
  • Method Details

    • getArg

      public abstract Expr getArg(int i)
    • numArgs

      public abstract int numArgs()
    • getArgs

      public List<Expr> getArgs()
    • isFunction

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

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

      public 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
      Specified by:
      hashCode in class ExprNode
    • equals

      public 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
      Specified by:
      equals in class ExprNode
    • getFunctionPrintName

      public String getFunctionPrintName(SerializationContext cxt)
      Name used for output in SPARQL format needing functional form (no specific keyword). e.g. regexp(), custom functions, ...
    • getFunctionName

      public String getFunctionName(SerializationContext cxt)
      Name used in a functional form (i.e. SPARQL algebra). getOpName() is used in preference as a short, symbol name.
    • getFunctionSymbol

      public FunctionLabel getFunctionSymbol()
      Used to get a unique name for the function, which is intern'ed. Used in hashCode()
    • getFunctionIRI

      public String getFunctionIRI()
      URI for this function, whether custom or specification defined URI (these are keywords in the language)
    • getOpName

      public String getOpName()
      Get the symbol name (+, ! etc) for this function -- maybe null for none