com.hp.hpl.jena.sparql.lang.rdql
Class ParsedLiteral

java.lang.Object
  extended by com.hp.hpl.jena.sparql.lang.rdql.SimpleNode
      extended by com.hp.hpl.jena.sparql.lang.rdql.ParsedLiteral
All Implemented Interfaces:
com.hp.hpl.jena.graph.query.Expression, com.hp.hpl.jena.graph.query.Valuator, Expr, ExprRDQL, PrintableRDQL, RDQL_Node, RDQL_NodeValue
Direct Known Subclasses:
Q_BooleanLiteral, Q_NumericLiteral, Q_TextLiteral, Q_TextLiteral2, Q_URI, Q_URL, WorkingVar

public class ParsedLiteral
extends SimpleNode
implements ExprRDQL, RDQL_NodeValue


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.hp.hpl.jena.graph.query.Expression
com.hp.hpl.jena.graph.query.Expression.Application, com.hp.hpl.jena.graph.query.Expression.Base, com.hp.hpl.jena.graph.query.Expression.BoolConstant, com.hp.hpl.jena.graph.query.Expression.Constant, com.hp.hpl.jena.graph.query.Expression.Fixed, com.hp.hpl.jena.graph.query.Expression.Util, com.hp.hpl.jena.graph.query.Expression.Valof, com.hp.hpl.jena.graph.query.Expression.Variable
 
Field Summary
 
Fields inherited from interface com.hp.hpl.jena.sparql.expr.Expr
CMP_EQUAL, CMP_GREATER, CMP_INDETERMINATE, CMP_LESS, CMP_UNEQUAL
 
Fields inherited from interface com.hp.hpl.jena.graph.query.Expression
FALSE, TRUE
 
Constructor Summary
ParsedLiteral()
           
 
Method Summary
 Expr applyNodeTransform(NodeTransform transform)
          Rewrite, applying a node->node transformation
 int argCount()
           
 String asInfixString()
           
 String asPrefixString()
           
 String asQuotedString()
           
 String asUnquotedString()
           
 Var asVar()
          Convert to a Var variable.
 Expr copySubstitute(Binding binding)
          Deep copy with substitution
 Expr copySubstitute(Binding binding, boolean foldConstants)
           
 Expr deepCopy()
          Deep copy
 NodeValue eval(Binding binding, FunctionEnv env)
          Evaluate this expression against the binding
 boolean evalBool(com.hp.hpl.jena.graph.query.IndexValues iv)
          Answer the result of evaluating the constraint expression as a primitive boolean value; implements Expression.evalBool(*).
 RDQL_NodeValue evalNode(Query q, com.hp.hpl.jena.graph.query.IndexValues env)
          Answer the NodeValue result of evaluating the constraints relative to the query and with the specified environment.
 Object evalObject(com.hp.hpl.jena.graph.query.IndexValues iv)
          Answer the result of evaluating the constraint expression; implements Expression.evalObject(*).
 RDQL_NodeValue evalRDQL(Query q, com.hp.hpl.jena.graph.query.IndexValues env)
           
 void format(org.openjena.atlas.io.IndentedWriter writer)
           
 void format(Query query, org.openjena.atlas.io.IndentedWriter writer)
           
 com.hp.hpl.jena.graph.query.Expression getArg(int i)
           
 boolean getBoolean()
           
 NodeValue getConstant()
          NodeValue constant (returns null if not a constant)
 double getDouble()
           
 ExprVar getExprVar()
          Variable (or null)
 String getFun()
           
 ExprFunction getFunction()
          Get the function (returns null if not a function)
 long getInt()
           
 String getName()
           
 com.hp.hpl.jena.graph.Node getNode()
           
 String getString()
           
 String getURI()
           
 Object getValue()
           
 String getVarName()
          Variable name (returns null if not a variable)
 Set<String> getVarNamesMentioned()
           
 Set<Var> getVarsMentioned()
           
 boolean isApply()
           
 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 isDouble()
           
 boolean isFunction()
          Answer wether this is a function.
 boolean isInt()
           
 boolean isNode()
           
 boolean isNumber()
           
 boolean isSatisfied(Binding binding, FunctionEnv execCxt)
          Test whether a Constraint is satisfied, given a set of bindings Includes error propagtion and Effective Boolean Value rules.
 boolean isSatisfied(com.hp.hpl.jena.graph.query.IndexValues env)
           
 boolean isSet()
           
 boolean isString()
           
 boolean isURI()
           
 boolean isVariable()
          Answer whether this is a variable (in which case getVarName and getNodeVar can be called)
 void postParse2(Query q)
           
 com.hp.hpl.jena.graph.query.Valuator prepare(com.hp.hpl.jena.graph.query.VariableIndexes vi)
           
 String toString()
           
 String valueString()
           
 void varNamesMentioned(Collection<String> acc)
           
 void varsMentioned(Collection<Var> acc)
           
 void visit(ExprVisitor visitor)
           
 
Methods inherited from class com.hp.hpl.jena.sparql.lang.rdql.SimpleNode
dump, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, postParse1, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hp.hpl.jena.sparql.expr.Expr
applyNodeTransform, asVar, copySubstitute, copySubstitute, deepCopy, eval, getConstant, getExprVar, getFunction, getVarName, getVarsMentioned, isFunction, isSatisfied, isVariable, varsMentioned, visit
 

Constructor Detail

ParsedLiteral

public ParsedLiteral()
Method Detail

evalRDQL

public RDQL_NodeValue evalRDQL(Query q,
                               com.hp.hpl.jena.graph.query.IndexValues env)
Specified by:
evalRDQL in interface ExprRDQL

isSet

public boolean isSet()

isNumber

public boolean isNumber()
Specified by:
isNumber in interface RDQL_NodeValue

isInt

public boolean isInt()
Specified by:
isInt in interface RDQL_NodeValue

isDouble

public boolean isDouble()
Specified by:
isDouble in interface RDQL_NodeValue

isBoolean

public boolean isBoolean()
Specified by:
isBoolean in interface RDQL_NodeValue

isString

public boolean isString()
Specified by:
isString in interface RDQL_NodeValue

isURI

public boolean isURI()
Specified by:
isURI in interface RDQL_NodeValue

isNode

public boolean isNode()
Specified by:
isNode in interface RDQL_NodeValue

getInt

public long getInt()
Specified by:
getInt in interface RDQL_NodeValue

getDouble

public double getDouble()
Specified by:
getDouble in interface RDQL_NodeValue

getBoolean

public boolean getBoolean()
Specified by:
getBoolean in interface RDQL_NodeValue

getString

public String getString()
Specified by:
getString in interface RDQL_NodeValue

getURI

public String getURI()
Specified by:
getURI in interface RDQL_NodeValue

getNode

public com.hp.hpl.jena.graph.Node getNode()
Specified by:
getNode in interface RDQL_NodeValue

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 com.hp.hpl.jena.graph.query.Expression
Specified by:
isConstant in interface Expr

getValue

public Object getValue()
Specified by:
getValue in interface com.hp.hpl.jena.graph.query.Expression

asQuotedString

public String asQuotedString()

asUnquotedString

public String asUnquotedString()

asInfixString

public String asInfixString()
Specified by:
asInfixString in interface PrintableRDQL

asPrefixString

public String asPrefixString()
Specified by:
asPrefixString in interface PrintableRDQL

format

public void format(org.openjena.atlas.io.IndentedWriter writer)
Specified by:
format in interface PrintableRDQL

valueString

public String valueString()
Specified by:
valueString in interface RDQL_NodeValue

toString

public String toString()

copySubstitute

public Expr copySubstitute(Binding binding)
Description copied from interface: Expr
Deep copy with substitution

Specified by:
copySubstitute in interface Expr

copySubstitute

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

applyNodeTransform

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

Specified by:
applyNodeTransform in interface Expr

deepCopy

public Expr deepCopy()
Description copied from interface: Expr
Deep copy

Specified by:
deepCopy in interface Expr

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

getConstant

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

Specified by:
getConstant in interface Expr

getExprVar

public ExprVar getExprVar()
Description copied from interface: Expr
Variable (or null)

Specified by:
getExprVar in interface Expr

getVarName

public String getVarName()
Description copied from interface: Expr
Variable name (returns null if not a variable)

Specified by:
getVarName in interface Expr

asVar

public Var asVar()
Description copied from interface: Expr
Convert to a Var variable.

Specified by:
asVar in interface Expr

visit

public void visit(ExprVisitor visitor)
Specified by:
visit in interface Expr

isSatisfied

public boolean isSatisfied(Binding binding,
                           FunctionEnv execCxt)
Description copied from interface: Expr
Test whether a Constraint is satisfied, given a set of bindings Includes error propagtion and Effective Boolean Value rules.

Specified by:
isSatisfied in interface Expr
Parameters:
binding - The bindings
execCxt - FunctionEnv
Returns:
true or false

isSatisfied

public boolean isSatisfied(com.hp.hpl.jena.graph.query.IndexValues env)

postParse2

public void postParse2(Query q)
Overrides:
postParse2 in class SimpleNode

getVarsMentioned

public Set<Var> getVarsMentioned()
Specified by:
getVarsMentioned in interface Expr

getVarNamesMentioned

public Set<String> getVarNamesMentioned()

varNamesMentioned

public void varNamesMentioned(Collection<String> acc)

varsMentioned

public void varsMentioned(Collection<Var> acc)
Specified by:
varsMentioned in interface Expr

prepare

public com.hp.hpl.jena.graph.query.Valuator prepare(com.hp.hpl.jena.graph.query.VariableIndexes vi)
Specified by:
prepare in interface com.hp.hpl.jena.graph.query.Expression

evalObject

public Object evalObject(com.hp.hpl.jena.graph.query.IndexValues iv)
Answer the result of evaluating the constraint expression; implements Expression.evalObject(*).

Specified by:
evalObject in interface com.hp.hpl.jena.graph.query.Valuator

evalBool

public boolean evalBool(com.hp.hpl.jena.graph.query.IndexValues iv)
Answer the result of evaluating the constraint expression as a primitive boolean value; implements Expression.evalBool(*).

Specified by:
evalBool in interface com.hp.hpl.jena.graph.query.Valuator

evalNode

public RDQL_NodeValue evalNode(Query q,
                               com.hp.hpl.jena.graph.query.IndexValues env)
Answer the NodeValue result of evaluating the constraints relative to the query and with the specified environment. Traps and handles exceptions. This code used to be in isSatisfied() until Expressions gained evalObject(), then it was factored out so that it could be shared by both evalXXX() methods.


isVariable

public boolean isVariable()
Description copied from interface: Expr
Answer whether this is a variable (in which case getVarName and getNodeVar can be called)

Specified by:
isVariable in interface com.hp.hpl.jena.graph.query.Expression
Specified by:
isVariable in interface Expr

getName

public String getName()
Specified by:
getName in interface com.hp.hpl.jena.graph.query.Expression

isFunction

public boolean isFunction()
Description copied from interface: Expr
Answer wether this is a function.

Specified by:
isFunction in interface Expr

getFunction

public ExprFunction getFunction()
Description copied from interface: Expr
Get the function (returns null if not a function)

Specified by:
getFunction in interface Expr

isApply

public boolean isApply()
Specified by:
isApply in interface com.hp.hpl.jena.graph.query.Expression

getFun

public String getFun()
Specified by:
getFun in interface com.hp.hpl.jena.graph.query.Expression

argCount

public int argCount()
Specified by:
argCount in interface com.hp.hpl.jena.graph.query.Expression

getArg

public com.hp.hpl.jena.graph.query.Expression getArg(int i)
Specified by:
getArg in interface com.hp.hpl.jena.graph.query.Expression

format

public void format(Query query,
                   org.openjena.atlas.io.IndentedWriter writer)


Copyright ? 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP Copyright ? 2010 Talis Systems Ltd. Copyright ? 2010 Epimorphics Ltd.