Class ExprLib

java.lang.Object
org.apache.jena.sparql.expr.ExprLib

public class ExprLib extends Object
  • Constructor Details

    • ExprLib

      public ExprLib()
  • Method Details

    • evalOrNull

      public static NodeValue evalOrNull(Expr expr, Binding binding, FunctionEnv functionEnv)
      Evaluate or return null.

      This is better (faster) than the simple implementation which captures ExprEvalException and returns null.

    • foldConstants

      public static Expr foldConstants(Expr expr)
      Attempt to fold any sub-expressions of the Expr. Return an expression that is equivalent to the argument but maybe simpler.
      Parameters:
      expr -
      Returns:
      Expression
    • replaceAggregateByVariable

      public static Expr replaceAggregateByVariable(Expr expr)
      transform an expression that may involve aggregates into one that just uses the variable for the aggregate
    • isAssignmentSafeEquality

      public static boolean isAssignmentSafeEquality(Expr expr)
      Decide whether an expression is safe for using a graph substitution. Need to be careful about value-like tests when the graph is not matched in a value fashion.
    • isAssignmentSafeEquality

      public static boolean isAssignmentSafeEquality(Expr expr, boolean graphHasStringEquality, boolean graphHasNumercialValueEquality)
      Parameters:
      graphHasStringEquality - True if the graph triple matching equates xsd:string and plain literal
      graphHasNumercialValueEquality - True if the graph triple matching equates numeric values
    • isStable

      public static boolean isStable(Expr expr)
      Some "functions" are non-deterministic (unstable) - calling them with the same arguments does not yields the same answer each time. Therefore how and when they are called matters. Functions: RAND, UUID, StrUUID, BNode NOW() is safe.
    • nodeToExpr

      public static Expr nodeToExpr(org.apache.jena.graph.Node n)
      Go from a node to an expression.
    • rewriteTriple

      public static Expr rewriteTriple(org.apache.jena.graph.Triple t)