|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hp.hpl.jena.sparql.core.Prologue
com.hp.hpl.jena.query.Query
public class Query
The data structure for a query as presented externally. There are two ways of creating a query - use the parser to turn a string description of the query into the executable form, and the programmatic way (the parser is calling the programmatic operations driven by the quyery string). The declarative approach of passing in a string is preferred. Once a query is built, it can be passed to the QueryFactory to produce a query execution engine.
QueryExecutionFactory
,
ResultSet
Field Summary | |
---|---|
static long |
NOLIMIT
|
static int |
ORDER_ASCENDING
|
static int |
ORDER_DEFAULT
|
static int |
ORDER_DESCENDING
|
static int |
ORDER_UNKNOW
|
static int |
QueryTypeAsk
|
static int |
QueryTypeConstruct
|
static int |
QueryTypeDescribe
|
static int |
QueryTypeSelect
|
static int |
QueryTypeUnknown
|
Constructor Summary | |
---|---|
Query()
|
|
Query(Prologue prologue)
|
Method Summary | |
---|---|
void |
addDescribeNode(com.hp.hpl.jena.graph.Node node)
|
void |
addGraphURI(String s)
Location of the source for the data. |
void |
addGroupBy(Expr expr)
|
void |
addGroupBy(com.hp.hpl.jena.graph.Node v)
|
void |
addGroupBy(String varName)
|
void |
addGroupBy(Var v,
Expr expr)
|
void |
addHavingCondition(Expr expr)
|
void |
addNamedGraphURI(String uri)
Location of the source for the data. |
void |
addOrderBy(Expr expr,
int direction)
|
void |
addOrderBy(com.hp.hpl.jena.graph.Node var,
int direction)
|
void |
addOrderBy(SortCondition condition)
|
void |
addOrderBy(String varName,
int direction)
|
void |
addProjectVars(Collection<?> vars)
Add a collection of projection variables to a SELECT query |
void |
addResultVar(Expr expr)
Add an to a SELECT query (a name will be created for it) |
void |
addResultVar(com.hp.hpl.jena.graph.Node v)
|
void |
addResultVar(com.hp.hpl.jena.graph.Node v,
Expr expr)
|
void |
addResultVar(String varName)
Add a projection variable to a SELECT query |
void |
addResultVar(String varName,
Expr expr)
Add a named expression to a SELECT query |
Expr |
allocAggregate(Aggregator agg)
|
Object |
clone()
|
Query |
cloneQuery()
|
boolean |
equals(Object other)
Are two queries equals - tests shape and details. |
List<ExprAggregator> |
getAggregators()
|
List<Binding> |
getBindingValues()
Binding values - null for a Node means undef |
List<Var> |
getBindingVariables()
Binding variables |
Template |
getConstructTemplate()
Get the template pattern for a construct query |
DatasetDescription |
getDatasetDescription()
Return a dataset description (FROM/FROM NAMED clauses) for the query. |
List<String> |
getGraphURIs()
Return the list of URIs (strings) for the unnamed graph |
VarExprList |
getGroupBy()
|
List<Expr> |
getHavingExprs()
|
long |
getLimit()
|
List<String> |
getNamedGraphURIs()
Return the list of URIs (strings) for the named graphs (FROM NAMED clause) |
long |
getOffset()
|
List<SortCondition> |
getOrderBy()
|
VarExprList |
getProject()
|
List<Var> |
getProjectVars()
Return a list of the variables requested (SELECT) |
Element |
getQueryPattern()
|
int |
getQueryType()
|
List<com.hp.hpl.jena.graph.Node> |
getResultURIs()
Get the result list (things wanted - not the results themselves) of a DESCRIBE query. |
List<String> |
getResultVars()
Return a list of the variables requested (SELECT) |
Syntax |
getSyntax()
|
boolean |
hasAggregators()
|
boolean |
hasBindings()
Does the query have any BINDINGS? |
boolean |
hasDatasetDescription()
Return true if the query has either some graph URIs or some named graph URIs in its description. |
boolean |
hasGroupBy()
|
boolean |
hasHaving()
|
int |
hashCode()
|
boolean |
hasLimit()
|
boolean |
hasOffset()
|
boolean |
hasOrderBy()
|
boolean |
isAskType()
|
boolean |
isConstructType()
|
boolean |
isDescribeType()
|
boolean |
isDistinct()
|
boolean |
isOrdered()
|
boolean |
isQueryResultStar()
Answer whether the query had SELECT/DESCRIBE/CONSTRUCT * |
boolean |
isReduced()
|
boolean |
isSelectType()
|
boolean |
isStrict()
|
boolean |
isUnknownType()
|
void |
output(IndentedWriter out)
|
String |
serialize()
Convert the query to a string |
void |
serialize(IndentedLineBuffer buff)
Format the query into the buffer |
void |
serialize(IndentedLineBuffer buff,
Syntax outSyntax)
Format the query |
void |
serialize(IndentedWriter writer)
Format the query |
void |
serialize(IndentedWriter writer,
Syntax outSyntax)
Format the query |
void |
serialize(OutputStream out)
Output the query |
void |
serialize(OutputStream out,
Syntax syntax)
Output the query |
String |
serialize(Syntax syntax)
Convert the query to a string in the given syntax |
void |
setBindings(List<Var> variables,
List<Binding> values)
|
void |
setConstructTemplate(Template templ)
Set triple patterns for a construct query |
void |
setDistinct(boolean b)
|
void |
setLimit(long limit)
|
void |
setOffset(long offset)
|
void |
setQueryAskType()
|
void |
setQueryConstructType()
|
void |
setQueryDescribeType()
|
void |
setQueryPattern(Element elt)
|
void |
setQueryResultStar(boolean isQueryStar)
Set whether the query had SELECT/DESCRIBE * Strictly, this just means whether the projection is |
void |
setQuerySelectType()
|
void |
setQueryType(int qType)
Deprecated. |
void |
setReduced(boolean b)
|
void |
setResultVars()
Fix up when the query has "*" (when SELECT * or DESCRIBE *) and for a construct query. |
void |
setStrict(boolean isStrict)
|
void |
setSyntax(Syntax syntax)
|
String |
toString()
|
String |
toString(Syntax syntax)
|
boolean |
usesGraphURI(String uri)
Test whether the query mentions a URI in forming the default graph (FROM clause) |
boolean |
usesNamedGraphURI(String uri)
Test whether the query mentions a URI for a named graph. |
void |
validate()
Deprecated. This call does do anything. |
void |
visit(QueryVisitor visitor)
|
Methods inherited from class com.hp.hpl.jena.sparql.core.Prologue |
---|
copy, expandPrefixedName, explicitlySetBaseURI, getBaseURI, getPrefix, getPrefixMapping, getResolver, setBaseURI, setBaseURI, setPrefix, setPrefixMapping, setResolver, shortForm, sub, sub, sub, usePrologueFrom |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int QueryTypeUnknown
public static final int QueryTypeSelect
public static final int QueryTypeConstruct
public static final int QueryTypeDescribe
public static final int QueryTypeAsk
public static final long NOLIMIT
public static final int ORDER_ASCENDING
public static final int ORDER_DESCENDING
public static final int ORDER_DEFAULT
public static final int ORDER_UNKNOW
Constructor Detail |
---|
public Query()
public Query(Prologue prologue)
Method Detail |
---|
@Deprecated public void setQueryType(int qType)
public void setQuerySelectType()
public void setQueryConstructType()
public void setQueryDescribeType()
public void setQueryAskType()
public int getQueryType()
public boolean isSelectType()
public boolean isConstructType()
public boolean isDescribeType()
public boolean isAskType()
public boolean isUnknownType()
public void setStrict(boolean isStrict)
public boolean isStrict()
public void setDistinct(boolean b)
public boolean isDistinct()
public void setReduced(boolean b)
public boolean isReduced()
public Syntax getSyntax()
public void setSyntax(Syntax syntax)
syntax
- The syntax to set.public long getLimit()
public void setLimit(long limit)
public boolean hasLimit()
public long getOffset()
public void setOffset(long offset)
public boolean hasOffset()
public boolean hasOrderBy()
public boolean isOrdered()
public void addOrderBy(SortCondition condition)
public void addOrderBy(Expr expr, int direction)
public void addOrderBy(com.hp.hpl.jena.graph.Node var, int direction)
public void addOrderBy(String varName, int direction)
public List<SortCondition> getOrderBy()
public boolean isQueryResultStar()
public void setQueryResultStar(boolean isQueryStar)
isQueryStar
- public void setQueryPattern(Element elt)
public Element getQueryPattern()
public void addGraphURI(String s)
public void addNamedGraphURI(String uri)
public List<String> getGraphURIs()
public boolean usesGraphURI(String uri)
uri
-
public List<String> getNamedGraphURIs()
public boolean usesNamedGraphURI(String uri)
uri
-
public boolean hasDatasetDescription()
public DatasetDescription getDatasetDescription()
public List<String> getResultVars()
public List<Var> getProjectVars()
public VarExprList getProject()
public void addProjectVars(Collection<?> vars)
public void addResultVar(String varName)
public void addResultVar(com.hp.hpl.jena.graph.Node v)
public void addResultVar(com.hp.hpl.jena.graph.Node v, Expr expr)
public void addResultVar(Expr expr)
public void addResultVar(String varName, Expr expr)
public boolean hasGroupBy()
public boolean hasHaving()
public VarExprList getGroupBy()
public List<Expr> getHavingExprs()
public void addGroupBy(String varName)
public void addGroupBy(com.hp.hpl.jena.graph.Node v)
public void addGroupBy(Expr expr)
public void addGroupBy(Var v, Expr expr)
public void addHavingCondition(Expr expr)
public boolean hasAggregators()
public List<ExprAggregator> getAggregators()
public Expr allocAggregate(Aggregator agg)
public boolean hasBindings()
public List<Var> getBindingVariables()
public List<Binding> getBindingValues()
public void setBindings(List<Var> variables, List<Binding> values)
public Template getConstructTemplate()
public void setConstructTemplate(Template templ)
public void addDescribeNode(com.hp.hpl.jena.graph.Node node)
public List<com.hp.hpl.jena.graph.Node> getResultURIs()
public void setResultVars()
public void visit(QueryVisitor visitor)
public Object clone()
clone
in class Object
public Query cloneQuery()
public String toString()
toString
in class Object
public String toString(Syntax syntax)
@Deprecated public void validate()
public int hashCode()
hashCode
in class Object
public boolean equals(Object other)
equals
in class Object
public void output(IndentedWriter out)
output
in interface Printable
public String serialize()
public String serialize(Syntax syntax)
syntax
- public void serialize(OutputStream out)
out
- OutputStreampublic void serialize(OutputStream out, Syntax syntax)
out
- OutputStreamsyntax
- Syntax URIpublic void serialize(IndentedLineBuffer buff)
buff
- IndentedLineBufferpublic void serialize(IndentedLineBuffer buff, Syntax outSyntax)
buff
- IndentedLineBuffer in which to place the unparsed queryoutSyntax
- Syntax URIpublic void serialize(IndentedWriter writer)
writer
- IndentedWriterpublic void serialize(IndentedWriter writer, Syntax outSyntax)
writer
- IndentedWriteroutSyntax
- Syntax URI
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |