java.lang.Object
org.apache.jena.sparql.expr.ExprLib
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NodeValueevalOrNull(Expr expr, Binding binding, FunctionEnv functionEnv) Evaluate or return null.static org.apache.jena.graph.NodeexprToNode(Expr e) Go from an expression to a node.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 booleanSome "functions" are non-deterministic (unstable) - calling them with the same arguments does not yields the same answer each time.static ExprnodeToExpr(org.apache.jena.graph.Node n) Go from a node to an expression.static Exprtransform an expression that may involve aggregates into one that just uses the variable for the aggregatestatic ExprrewriteTriple(org.apache.jena.graph.Triple t)
-
Constructor Details
-
ExprLib
public ExprLib()
-
-
Method Details
-
evalOrNull
Evaluate or return null.This is better (faster) than the simple implementation which captures
ExprEvalExceptionand returns null. -
foldConstants
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
transform an expression that may involve aggregates into one that just uses the variable for the aggregate -
isAssignmentSafeEquality
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
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
Go from a node to an expression. -
exprToNode
Go from an expression to a node. If the argument cannot be converted to a node then anIllegalArgumentExceptionis raised. -
rewriteTriple
-