Package org.apache.jena.sparql.expr
Class ExprNode
- java.lang.Object
-
- org.apache.jena.sparql.expr.ExprNode
-
- All Implemented Interfaces:
Expr
- Direct Known Subclasses:
ExprAggregator
,ExprFunction
,ExprNone
,ExprTripleTerm
,ExprVar
,NodeValue
public abstract class ExprNode extends java.lang.Object implements Expr
-
-
Field Summary
-
Fields inherited from interface org.apache.jena.sparql.expr.Expr
CMP_EQUAL, CMP_GREATER, CMP_INDETERMINATE, CMP_LESS, CMP_UNEQUAL, NONE
-
-
Constructor Summary
Constructors Constructor Description ExprNode()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Expr
applyNodeTransform(NodeTransform transform)
Rewrite, applying a node->node transformationVar
asVar()
Convert to a Var variable.abstract Expr
copySubstitute(Binding binding)
Deep copy with substitutionExpr
deepCopy()
Deep copyboolean
equals(java.lang.Object other)
abstract boolean
equals(Expr other, boolean bySyntax)
General equality operation - consider this to be 'protected'boolean
equalsBySyntax(Expr other)
abstract NodeValue
eval(Binding binding, FunctionEnv env)
Evaluate this expression against the bindingNodeValue
getConstant()
NodeValue constant (returns null if not a constant)Expr
getExpr()
ExprVar
getExprVar()
Variable (or null)ExprFunction
getFunction()
Get the function (returns null if not a function)Op
getGraphPattern()
java.lang.String
getVarName()
Variable name (returns null if not a variable)java.util.Set<Var>
getVarsMentioned()
Variables used by this expression.abstract int
hashCode()
Expr
are used in both syntax and algebra.boolean
isConstant()
Answer whether this is a constant expression - false includes "don't know" No constant folding so "false" from an expression that evaluates to a constantboolean
isExpr()
boolean
isFunction()
Answer whether this is a function.boolean
isGraphPattern()
boolean
isSatisfied(Binding binding, FunctionEnv funcEnv)
Test whether a Constraint is satisfied, given a set of bindings Includes error propagation and Effective Boolean Value rules.boolean
isVariable()
Answer whether this is a variable.java.lang.String
toString()
-
-
-
Method Detail
-
isSatisfied
public boolean isSatisfied(Binding binding, FunctionEnv funcEnv)
Description copied from interface:Expr
Test whether a Constraint is satisfied, given a set of bindings Includes error propagation and Effective Boolean Value rules.- Specified by:
isSatisfied
in interfaceExpr
- Parameters:
binding
- The bindingsfuncEnv
- FunctionEnv- Returns:
- true or false
-
isExpr
public boolean isExpr()
-
getExpr
public final Expr getExpr()
-
eval
public abstract NodeValue eval(Binding binding, FunctionEnv env)
Description copied from interface:Expr
Evaluate this expression against the binding
-
getVarsMentioned
public final java.util.Set<Var> getVarsMentioned()
Description copied from interface:Expr
Variables used by this expression.- Specified by:
getVarsMentioned
in interfaceExpr
- See Also:
ExprVars.getVarNamesMentioned(org.apache.jena.sparql.expr.Expr)
,ExprVars.getNonOpVarNamesMentioned(org.apache.jena.sparql.expr.Expr)
-
hashCode
public abstract 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
andEXISTS
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
andequals
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
impliesequals
(by alegbra).Hence, different
hashCode
=> notequalsBySyntax
.
-
equals
public final boolean equals(java.lang.Object other)
-
equalsBySyntax
public final boolean equalsBySyntax(Expr other)
- Specified by:
equalsBySyntax
in interfaceExpr
-
equals
public abstract boolean equals(Expr other, boolean bySyntax)
Description copied from interface:Expr
General equality operation - consider this to be 'protected'
-
copySubstitute
public abstract Expr copySubstitute(Binding binding)
Description copied from interface:Expr
Deep copy with substitution- Specified by:
copySubstitute
in interfaceExpr
-
applyNodeTransform
public abstract Expr applyNodeTransform(NodeTransform transform)
Description copied from interface:Expr
Rewrite, applying a node->node transformation- Specified by:
applyNodeTransform
in interfaceExpr
-
isVariable
public boolean isVariable()
Description copied from interface:Expr
Answer whether this is a variable.- Specified by:
isVariable
in interfaceExpr
-
getVarName
public java.lang.String getVarName()
Description copied from interface:Expr
Variable name (returns null if not a variable)- Specified by:
getVarName
in interfaceExpr
-
getExprVar
public ExprVar getExprVar()
Description copied from interface:Expr
Variable (or null)- Specified by:
getExprVar
in interfaceExpr
-
isConstant
public boolean isConstant()
Description copied from interface:Expr
Answer whether this is a constant expression - false includes "don't know" No constant folding so "false" from an expression that evaluates to a constant- Specified by:
isConstant
in interfaceExpr
-
getConstant
public NodeValue getConstant()
Description copied from interface:Expr
NodeValue constant (returns null if not a constant)- Specified by:
getConstant
in interfaceExpr
-
isFunction
public boolean isFunction()
Description copied from interface:Expr
Answer whether this is a function.- Specified by:
isFunction
in interfaceExpr
-
getFunction
public ExprFunction getFunction()
Description copied from interface:Expr
Get the function (returns null if not a function)- Specified by:
getFunction
in interfaceExpr
-
isGraphPattern
public boolean isGraphPattern()
-
getGraphPattern
public Op getGraphPattern()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-