java.lang.Object
org.apache.jena.sparql.expr.ExprNode
org.apache.jena.sparql.expr.NodeValue
- All Implemented Interfaces:
Expr
- Direct Known Subclasses:
NodeValueBoolean
,NodeValueDateTime
,NodeValueDecimal
,NodeValueDouble
,NodeValueDuration
,NodeValueFloat
,NodeValueInteger
,NodeValueLang
,NodeValueNode
,NodeValueSortKey
,NodeValueString
-
Field Summary
Modifier and TypeFieldDescriptionstatic final NodeValue
static final NodeValue
static final NodeValue
static final NodeValue
static final NodeValue
static final NodeValue
static final NodeValue
static final NodeValue
static final NodeValue
static final NodeValue
static final NodeValue
static final NodeValue
static boolean
static boolean
static DatatypeFactory
static final String
Fields inherited from interface org.apache.jena.sparql.expr.Expr
CMP_EQUAL, CMP_GREATER, CMP_INDETERMINATE, CMP_LESS, CMP_UNEQUAL, NONE
-
Method Summary
Modifier and TypeMethodDescriptionapply
(ExprTransform transform) applyNodeTransform
(NodeTransform transform) Rewrite, applying a node->node transformationfinal org.apache.jena.graph.Node
asNode()
final String
final String
asQuotedString
(SerializationContext context) asString()
final String
static NodeValue
booleanReturn
(boolean b) static ValueSpace
classifyValueOp
(NodeValue nv1, NodeValue nv2) static int
Compare by value (and only value) if possible.static int
compareAlways
(NodeValue nv1, NodeValue nv2) Compare by value if possible else compare by kind/type/lexical form Only use when you want an ordering regardless of form of NodeValue, for example in ORDER BYcopySubstitute
(Binding binding) Deep copy with substitutionboolean
General equality operation - consider this to be 'protected'eval
(Binding binding, FunctionEnv env) Evaluate this expression against the bindingorg.apache.jena.graph.Node
evalNode
(Binding binding, ExecutionContext execCxt) boolean
NodeValue constant (returns null if not a constant)double
float
getFloat()
getLang()
org.apache.jena.graph.Node
getNode()
getNode - return the node form - may be null (use .asNode() to force to a node)boolean
int
hashCode()
Expr
are used in both syntax and algebra.boolean
hasNode()
boolean
isBlank()
boolean
boolean
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
isDate()
boolean
boolean
boolean
boolean
isDouble()
boolean
boolean
isFloat()
boolean
isGDay()
boolean
isGMonth()
boolean
boolean
isGYear()
boolean
boolean
boolean
isIRI()
boolean
boolean
boolean
isNumber()
boolean
boolean
isString()
boolean
isTime()
boolean
boolean
static NodeValue
makeBoolean
(boolean b) static NodeValue
static NodeValue
static NodeValue
static NodeValue
makeDateTime
(String lexicalForm) static NodeValue
makeDateTime
(Calendar cal) static NodeValue
static NodeValue
makeDecimal
(double d) static NodeValue
makeDecimal
(long i) static NodeValue
makeDecimal
(String lexicalForm) static NodeValue
static NodeValue
makeDouble
(double d) static NodeValue
makeDuration
(String lexicalForm) static NodeValue
makeDuration
(Duration duration) static NodeValue
makeFloat
(float f) static NodeValue
makeInteger
(long i) static NodeValue
makeInteger
(String lexicalForm) static NodeValue
static NodeValue
makeLangString
(String s, String lang) static NodeValue
static NodeValue
static NodeValue
static NodeValue
makeNode
(org.apache.jena.graph.Node n) static NodeValue
makeNodeBoolean
(boolean b) static NodeValue
makeNodeBoolean
(String lexicalForm) static NodeValue
makeNodeDate
(String lexicalForm) static NodeValue
makeNodeDate
(Calendar date) static NodeValue
makeNodeDateTime
(String lexicalForm) static NodeValue
makeNodeDateTime
(Calendar date) static NodeValue
makeNodeDecimal
(String lexicalForm) static NodeValue
makeNodeDecimal
(BigDecimal decimal) static NodeValue
makeNodeDouble
(double v) static NodeValue
makeNodeDouble
(String lexicalForm) static NodeValue
makeNodeDuration
(Duration duration, org.apache.jena.graph.Node node) static NodeValue
makeNodeFloat
(float f) static NodeValue
makeNodeFloat
(String lexicalForm) static NodeValue
makeNodeInteger
(long v) static NodeValue
makeNodeInteger
(String lexicalForm) static NodeValue
makeNodeString
(String string) static NodeValue
makeSortKey
(String s, String collation) static NodeValue
makeString
(String s) static boolean
notSameValueAs
(org.apache.jena.graph.Node n1, org.apache.jena.graph.Node n2) Return true if the two Nodes are known to be different, return false if the two Nodes are known to be the same, else throw ExprEvalExceptionstatic boolean
notSameValueAs
(NodeValue nv1, NodeValue nv2) Return true if the two NodeValues are known to be different, return false if the two NodeValues are known to be the same, else throw ExprEvalExceptionstatic NodeValue
Convenience operation - parse a string to produce a NodeValue - common namespaces like xsd: are built-instatic void
raise
(ExprException ex) static boolean
sameValueAs
(NodeValue nv1, NodeValue nv2) Return true if the two NodeValues are known to be the same value return false if known to be different values, throw ExprEvalException otherwisestatic org.apache.jena.graph.Node
toString()
void
visit
(ExprVisitor visitor) abstract void
visit
(NodeValueVisitor visitor) Methods inherited from class org.apache.jena.sparql.expr.ExprNode
asVar, deepCopy, equals, equalsBySyntax, getExpr, getExprVar, getFunction, getGraphPattern, getVarName, getVarsMentioned, isExpr, isFunction, isGraphPattern, isSatisfied, isVariable
-
Field Details
-
VerboseWarnings
public static boolean VerboseWarnings -
VerboseExceptions
public static boolean VerboseExceptions -
TRUE
-
FALSE
-
nvZERO
-
nvNegZERO
-
nvONE
-
nvTEN
-
nvDecimalZERO
-
nvDecimalONE
-
nvNaN
-
nvINF
-
nvNegINF
-
nvEmptyString
-
xsdNamespace
- See Also:
-
xmlDatatypeFactory
-
-
Method Details
-
parse
Convenience operation - parse a string to produce a NodeValue - common namespaces like xsd: are built-in -
makeInteger
-
makeInteger
-
makeInteger
-
makeFloat
-
makeDouble
-
makeString
-
makeSortKey
-
makeLangString
-
makeDecimal
-
makeDecimal
-
makeDecimal
-
makeDecimal
-
makeDateTime
-
makeDate
-
makeDateTime
-
makeDateTime
-
makeDate
-
makeDate
-
makeDuration
-
makeDuration
-
makeNodeDuration
-
makeBoolean
-
booleanReturn
-
makeNode
-
makeNode
-
makeNode
-
makeNode
-
makeNodeBoolean
-
makeNodeBoolean
-
makeNodeInteger
-
makeNodeInteger
-
makeNodeFloat
-
makeNodeFloat
-
makeNodeDouble
-
makeNodeDouble
-
makeNodeDecimal
-
makeNodeDecimal
-
makeNodeString
-
makeNodeDateTime
-
makeNodeDateTime
-
makeNodeDate
-
makeNodeDate
-
eval
Description copied from interface:Expr
Evaluate this expression against the binding -
copySubstitute
Description copied from interface:Expr
Deep copy with substitution- Specified by:
copySubstitute
in interfaceExpr
- Specified by:
copySubstitute
in classExprNode
-
applyNodeTransform
Description copied from interface:Expr
Rewrite, applying a node->node transformation- Specified by:
applyNodeTransform
in interfaceExpr
- Specified by:
applyNodeTransform
in classExprNode
-
evalNode
-
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
- Overrides:
isConstant
in classExprNode
-
getConstant
Description copied from interface:Expr
NodeValue constant (returns null if not a constant)- Specified by:
getConstant
in interfaceExpr
- Overrides:
getConstant
in classExprNode
-
isIRI
public boolean isIRI() -
isBlank
public boolean isBlank() -
isTripleTerm
public boolean isTripleTerm() -
getValueSpace
-
classifyValueOp
-
sameValueAs
Return true if the two NodeValues are known to be the same value return false if known to be different values, throw ExprEvalException otherwise -
notSameValueAs
public static boolean notSameValueAs(org.apache.jena.graph.Node n1, org.apache.jena.graph.Node n2) Return true if the two Nodes are known to be different, return false if the two Nodes are known to be the same, else throw ExprEvalException -
notSameValueAs
Return true if the two NodeValues are known to be different, return false if the two NodeValues are known to be the same, else throw ExprEvalException -
compare
Compare by value (and only value) if possible. Supports <, <=, >, >= but not = nor != (which are sameValueAs and notSameValueAs)- Parameters:
nv1
-nv2
-- Returns:
- Expr.CMP_LESS(-1), Expr.CMP_EQUAL(0) or Expr.CMP_GREATER(+1)
- Throws:
ExprNotComparableException
- for Expr.CMP_INDETERMINATE(+2)
-
compareAlways
Compare by value if possible else compare by kind/type/lexical form Only use when you want an ordering regardless of form of NodeValue, for example in ORDER BY- Parameters:
nv1
-nv2
-- Returns:
- negative, 0, or positive for less than, equal, greater than.
-
toNode
-
asNode
public final org.apache.jena.graph.Node asNode() -
getNode
public org.apache.jena.graph.Node getNode()getNode - return the node form - may be null (use .asNode() to force to a node) -
getDatatypeURI
-
hasNode
public boolean hasNode() -
isBoolean
public boolean isBoolean() -
isString
public boolean isString() -
isLangString
public boolean isLangString() -
isSortKey
public boolean isSortKey() -
isNumber
public boolean isNumber() -
isInteger
public boolean isInteger() -
isDecimal
public boolean isDecimal() -
isFloat
public boolean isFloat() -
isDouble
public boolean isDouble() -
hasDateTime
public boolean hasDateTime() -
isDateTime
public boolean isDateTime() -
isDate
public boolean isDate() -
isLiteral
public boolean isLiteral() -
isTime
public boolean isTime() -
isDuration
public boolean isDuration() -
isYearMonthDuration
public boolean isYearMonthDuration() -
isDayTimeDuration
public boolean isDayTimeDuration() -
isGYear
public boolean isGYear() -
isGYearMonth
public boolean isGYearMonth() -
isGMonth
public boolean isGMonth() -
isGMonthDay
public boolean isGMonthDay() -
isGDay
public boolean isGDay() -
getBoolean
public boolean getBoolean() -
getString
-
getLang
-
getSortKey
-
getInteger
-
getDecimal
-
getFloat
public float getFloat() -
getDouble
public double getDouble() -
getDateTime
-
getDuration
-
raise
-
visit
-
asUnquotedString
-
asQuotedString
-
asQuotedString
-
asString
-
hashCode
public 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 algebra).Hence, different
hashCode
=> notequalsBySyntax
. -
equals
Description copied from interface:Expr
General equality operation - consider this to be 'protected' -
visit
-
apply
-
toString
-