Package org.apache.jena.sparql.expr
Class ExprLib
- java.lang.Object
-
- org.apache.jena.sparql.expr.ExprLib
-
public class ExprLib extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ExprLib()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static NodeValueevalOrNull(Expr expr, Binding binding, FunctionEnv functionEnv)Evaluate or return null.static ExprfoldConstants(Expr expr)Attempt to fold any sub-expressions of the Expr.static booleanisAssignmentSafeEquality(Expr expr)Decide whether an expression is safe for using a graph substitution.static booleanisAssignmentSafeEquality(Expr expr, boolean graphHasStringEquality, boolean graphHasNumercialValueEquality)static booleanisStable(Expr expr)Some "functions" are non-deterministic (unstable) - calling them with the same arguments does not yields the same answer each time.static ExprnodeToExpr(Node n)Go from a node to an expression.static ExprreplaceAggregateByVariable(Expr expr)transform an expression that may involve aggregates into one that just uses the variable for the aggregatestatic ExprrewriteTriple(Triple t)
-
-
-
Method Detail
-
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
ExprEvalExceptionand 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 literalgraphHasNumercialValueEquality- 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.
-
-