com.hp.hpl.jena.sparql.expr
Class NodeValue

java.lang.Object
  extended by com.hp.hpl.jena.sparql.expr.ExprNode
      extended by com.hp.hpl.jena.sparql.expr.NodeValue
All Implemented Interfaces:
Expr
Direct Known Subclasses:
NodeValueBoolean, NodeValueDate, NodeValueDateTime, NodeValueDecimal, NodeValueDouble, NodeValueDuration, NodeValueFloat, NodeValueGDay, NodeValueGMonth, NodeValueGMonthDay, NodeValueGYear, NodeValueGYearMonth, NodeValueInteger, NodeValueNode, NodeValueString, NodeValueTime

public abstract class NodeValue
extends ExprNode


Field Summary
static BigDecimal DecimalZERO
           
static NodeValue FALSE
           
static BigInteger IntegerZERO
           
static NodeValue nvEmptyString
           
static NodeValue nvINF
           
static NodeValue nvNaN
           
static NodeValue nvNegINF
           
static NodeValue nvNothing
           
static NodeValue nvONE
           
static NodeValue nvZERO
           
static NodeValue TRUE
           
static boolean VerboseExceptions
           
static boolean VerboseWarnings
           
 
Fields inherited from interface com.hp.hpl.jena.sparql.expr.Expr
CMP_EQUAL, CMP_GREATER, CMP_INDETERMINATE, CMP_LESS, CMP_UNEQUAL
 
Method Summary
 Expr apply(ExprTransform transform)
           
 Expr applyNodeTransform(NodeTransform transform)
          Rewrite, applying a node->node transformation
 com.hp.hpl.jena.graph.Node asNode()
           
 String asQuotedString()
           
 String asQuotedString(SerializationContext context)
           
 String asString()
           
 String asUnquotedString()
           
static NodeValue booleanReturn(boolean b)
           
static int compare(NodeValue nv1, NodeValue nv2)
          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 BY
 Expr copySubstitute(Binding binding, boolean foldConstants)
           
 boolean equals(Object other)
           
 NodeValue eval(Binding binding, FunctionEnv env)
          Evaluate this expression against the binding
 com.hp.hpl.jena.graph.Node evalNode(Binding binding, ExecutionContext execCxt)
           
 boolean getBoolean()
           
 NodeValue getConstant()
          NodeValue constant (returns null if not a constant)
 com.hp.hpl.jena.datatypes.xsd.XSDDateTime getDateTime()
           
 BigDecimal getDecimal()
           
 double getDouble()
           
 com.hp.hpl.jena.datatypes.xsd.XSDDuration getDuration()
           
 float getFloat()
           
 BigInteger getInteger()
           
 com.hp.hpl.jena.graph.Node getNode()
          getNode - return the node form - may be null (use .asNode() to force to a node)
 String getString()
           
 boolean hasDateTime()
           
 int hashCode()
           
 boolean hasNode()
           
 boolean isBlank()
           
 boolean isBoolean()
           
 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 constant
 boolean isDate()
           
 boolean isDateTime()
           
 boolean isDecimal()
           
 boolean isDouble()
           
 boolean isDuration()
           
 boolean isFloat()
           
 boolean isGDay()
           
 boolean isGMonth()
           
 boolean isGMonthDay()
           
 boolean isGYear()
           
 boolean isGYearMonth()
           
 boolean isInteger()
           
 boolean isIRI()
           
 boolean isLiteral()
           
 boolean isNumber()
           
 boolean isString()
           
 boolean isTime()
           
static NodeValue makeBoolean(boolean b)
           
static NodeValue makeDate(Calendar cal)
           
static NodeValue makeDate(String lexicalForm)
           
static NodeValue makeDateTime(Calendar cal)
           
static NodeValue makeDateTime(String lexicalForm)
           
static NodeValue makeDecimal(BigDecimal d)
           
static NodeValue makeDecimal(double d)
           
static NodeValue makeDecimal(long i)
           
static NodeValue makeDecimal(String lexicalForm)
           
static NodeValue makeDouble(double d)
           
static NodeValue makeFloat(float f)
           
static NodeValue makeInteger(BigInteger i)
           
static NodeValue makeInteger(long i)
           
static NodeValue makeInteger(String lexicalForm)
           
static NodeValue makeNode(com.hp.hpl.jena.graph.Node n)
           
static NodeValue makeNode(String lexicalForm, String langTag, com.hp.hpl.jena.graph.Node datatype)
           
static NodeValue makeNode(String lexicalForm, String langTag, String datatype)
           
static NodeValue makeNode(String lexicalForm, com.hp.hpl.jena.datatypes.xsd.XSDDatatype dtype)
           
static NodeValue makeNodeBoolean(boolean b)
           
static NodeValue makeNodeBoolean(String lexicalForm)
           
static NodeValue makeNodeDate(Calendar date)
           
static NodeValue makeNodeDate(String lexicalForm)
           
static NodeValue makeNodeDateTime(Calendar date)
           
static NodeValue makeNodeDateTime(String lexicalForm)
           
static NodeValue makeNodeDecimal(BigDecimal decimal)
           
static NodeValue makeNodeDecimal(String lexicalForm)
           
static NodeValue makeNodeDouble(double v)
           
static NodeValue makeNodeDouble(String lexicalForm)
           
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 makeString(String s)
           
static boolean notSameAs(com.hp.hpl.jena.graph.Node n1, com.hp.hpl.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
static boolean notSameAs(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 ExprEvalException
static void raise(ExprException ex)
           
static boolean sameAs(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 otherwise
static com.hp.hpl.jena.graph.Node toNode(NodeValue nv)
           
 String toString()
           
 void visit(ExprVisitor visitor)
           
abstract  void visit(NodeValueVisitor visitor)
           
 
Methods inherited from class com.hp.hpl.jena.sparql.expr.ExprNode
asVar, copySubstitute, deepCopy, getExpr, getExprVar, getFunction, getGraphPattern, getVarName, getVarNamesMentioned, getVarsMentioned, isExpr, isFunction, isGraphPattern, isSatisfied, isVariable, varNamesMentioned, varsMentioned
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VerboseWarnings

public static boolean VerboseWarnings

VerboseExceptions

public static boolean VerboseExceptions

IntegerZERO

public static final BigInteger IntegerZERO

DecimalZERO

public static final BigDecimal DecimalZERO

TRUE

public static final NodeValue TRUE

FALSE

public static final NodeValue FALSE

nvZERO

public static final NodeValue nvZERO

nvONE

public static final NodeValue nvONE

nvNaN

public static final NodeValue nvNaN

nvINF

public static final NodeValue nvINF

nvNegINF

public static final NodeValue nvNegINF

nvEmptyString

public static final NodeValue nvEmptyString

nvNothing

public static final NodeValue nvNothing
Method Detail

makeInteger

public static NodeValue makeInteger(long i)

makeInteger

public static NodeValue makeInteger(BigInteger i)

makeInteger

public static NodeValue makeInteger(String lexicalForm)

makeFloat

public static NodeValue makeFloat(float f)

makeDouble

public static NodeValue makeDouble(double d)

makeString

public static NodeValue makeString(String s)

makeDecimal

public static NodeValue makeDecimal(BigDecimal d)

makeDecimal

public static NodeValue makeDecimal(long i)

makeDecimal

public static NodeValue makeDecimal(double d)

makeDecimal

public static NodeValue makeDecimal(String lexicalForm)

makeDateTime

public static NodeValue makeDateTime(String lexicalForm)

makeDateTime

public static NodeValue makeDateTime(Calendar cal)

makeDate

public static NodeValue makeDate(String lexicalForm)

makeDate

public static NodeValue makeDate(Calendar cal)

makeBoolean

public static NodeValue makeBoolean(boolean b)

booleanReturn

public static NodeValue booleanReturn(boolean b)

makeNode

public static NodeValue makeNode(com.hp.hpl.jena.graph.Node n)

makeNode

public static NodeValue makeNode(String lexicalForm,
                                 com.hp.hpl.jena.datatypes.xsd.XSDDatatype dtype)

makeNode

public static NodeValue makeNode(String lexicalForm,
                                 String langTag,
                                 com.hp.hpl.jena.graph.Node datatype)

makeNode

public static NodeValue makeNode(String lexicalForm,
                                 String langTag,
                                 String datatype)

makeNodeBoolean

public static NodeValue makeNodeBoolean(boolean b)

makeNodeBoolean

public static NodeValue makeNodeBoolean(String lexicalForm)

makeNodeInteger

public static NodeValue makeNodeInteger(long v)

makeNodeInteger

public static NodeValue makeNodeInteger(String lexicalForm)

makeNodeFloat

public static NodeValue makeNodeFloat(float f)

makeNodeFloat

public static NodeValue makeNodeFloat(String lexicalForm)

makeNodeDouble

public static NodeValue makeNodeDouble(double v)

makeNodeDouble

public static NodeValue makeNodeDouble(String lexicalForm)

makeNodeDecimal

public static NodeValue makeNodeDecimal(BigDecimal decimal)

makeNodeDecimal

public static NodeValue makeNodeDecimal(String lexicalForm)

makeNodeString

public static NodeValue makeNodeString(String string)

makeNodeDateTime

public static NodeValue makeNodeDateTime(Calendar date)

makeNodeDateTime

public static NodeValue makeNodeDateTime(String lexicalForm)

makeNodeDate

public static NodeValue makeNodeDate(Calendar date)

makeNodeDate

public static NodeValue makeNodeDate(String lexicalForm)

eval

public NodeValue eval(Binding binding,
                      FunctionEnv env)
Description copied from interface: Expr
Evaluate this expression against the binding

Specified by:
eval in interface Expr
Specified by:
eval in class ExprNode

copySubstitute

public Expr copySubstitute(Binding binding,
                           boolean foldConstants)
Specified by:
copySubstitute in interface Expr
Specified by:
copySubstitute in class ExprNode

applyNodeTransform

public Expr applyNodeTransform(NodeTransform transform)
Description copied from interface: Expr
Rewrite, applying a node->node transformation

Specified by:
applyNodeTransform in interface Expr
Specified by:
applyNodeTransform in class ExprNode

evalNode

public com.hp.hpl.jena.graph.Node evalNode(Binding binding,
                                           ExecutionContext execCxt)

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 interface Expr
Overrides:
isConstant in class ExprNode

getConstant

public NodeValue getConstant()
Description copied from interface: Expr
NodeValue constant (returns null if not a constant)

Specified by:
getConstant in interface Expr
Overrides:
getConstant in class ExprNode

isIRI

public boolean isIRI()

isBlank

public boolean isBlank()

sameAs

public static boolean sameAs(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 otherwise


notSameAs

public static boolean notSameAs(com.hp.hpl.jena.graph.Node n1,
                                com.hp.hpl.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


notSameAs

public static boolean notSameAs(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 ExprEvalException


compareAlways

public 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 BY

Parameters:
nv1 -
nv2 -
Returns:
negative, 0, or postive for less than, equal, greater than.

compare

public static int compare(NodeValue nv1,
                          NodeValue nv2)
Compare by value (and only value) if possible. Supports <, <=, >, >= but not = nor != (which are sameValueAs and notSameValueAs)

Parameters:
nv1 -
nv2 -
Returns:
negative, 0 , or positive for not possible, less than, equal, greater than.
Throws:
ExprNotComparableException

toNode

public static com.hp.hpl.jena.graph.Node toNode(NodeValue nv)

asNode

public final com.hp.hpl.jena.graph.Node asNode()

getNode

public com.hp.hpl.jena.graph.Node getNode()
getNode - return the node form - may be null (use .asNode() to force to a node)


hasNode

public boolean hasNode()

isBoolean

public boolean isBoolean()

isString

public boolean isString()

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()

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

public String getString()

getInteger

public BigInteger getInteger()

getDecimal

public BigDecimal getDecimal()

getFloat

public float getFloat()

getDouble

public double getDouble()

getDateTime

public com.hp.hpl.jena.datatypes.xsd.XSDDateTime getDateTime()

getDuration

public com.hp.hpl.jena.datatypes.xsd.XSDDuration getDuration()

raise

public static void raise(ExprException ex)

visit

public void visit(ExprVisitor visitor)

asUnquotedString

public final String asUnquotedString()

asQuotedString

public final String asQuotedString()

asQuotedString

public final String asQuotedString(SerializationContext context)

asString

public String asString()

hashCode

public int hashCode()
Specified by:
hashCode in class ExprNode

equals

public boolean equals(Object other)
Specified by:
equals in class ExprNode

visit

public abstract void visit(NodeValueVisitor visitor)

apply

public Expr apply(ExprTransform transform)

toString

public String toString()
Overrides:
toString in class ExprNode


Licenced under the Apache License, Version 2.0