Class ExprLib


  • public class ExprLib
    extends java.lang.Object
    • Constructor Detail

      • ExprLib

        public ExprLib()
    • Method Detail

      • 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​(Node n)
        Go from a node to an expression.
      • rewriteTriple

        public static Expr rewriteTriple​(Triple t)