|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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 int |
ASCENDING
|
static int |
DESCENDING
|
static long |
NOLIMIT
|
static int |
QueryTypeAsk
|
static int |
QueryTypeConstruct
|
static int |
QueryTypeDescribe
|
static int |
QueryTypeSelect
|
static int |
QueryTypeUnknown
|
Constructor Summary | |
---|---|
Query()
Create a blank query. |
Method Summary | |
---|---|
void |
addDescribeNode(com.hp.hpl.jena.graph.Node node)
|
void |
addGraphURI(java.lang.String s)
Location of the source for the data. |
void |
addNamedGraphURI(java.lang.String s)
Location of the source for the data. |
void |
addOrderBy(com.hp.hpl.jena.query.expr.Expr expr,
int direction)
|
void |
addOrderBy(com.hp.hpl.jena.graph.Node var,
int direction)
|
void |
addOrderBy(SortCondition condition)
|
void |
addOrderBy(java.lang.String varName,
int direction)
|
void |
addResultURIs(com.hp.hpl.jena.graph.Node node)
Add a result for a DESCRIBE query |
void |
addResultVar(com.hp.hpl.jena.graph.Node v)
|
void |
addResultVar(java.lang.String varName)
Add a projection variable to a SELECT query |
boolean |
equals(java.lang.Object other)
Are two queries equals - tests shape and details. |
java.lang.String |
expandQName(java.lang.String qname)
Expand QName |
boolean |
explicitlySetBaseURI()
|
java.lang.String |
getBaseURI()
|
com.hp.hpl.jena.query.core.Template |
getConstructTemplate()
Get the template pattern for a construct query |
java.util.List |
getGraphURIs()
Return the list of URIs (strings) for the unnamed graph |
long |
getLimit()
|
java.util.List |
getNamedGraphURIs()
Return the list of URIs (strings) for the named graphs |
long |
getOffset()
|
java.util.List |
getOrderBy()
|
java.lang.String |
getPrefix(java.lang.String prefix)
Lookup a prefix for this query, including the default prefixes |
com.hp.hpl.jena.shared.PrefixMapping |
getPrefixMap()
Deprecated. Use getPrefixMapping |
com.hp.hpl.jena.shared.PrefixMapping |
getPrefixMapping()
Return the prefix map from the parsed query |
com.hp.hpl.jena.query.core.ElementBlock |
getQueryBlock()
|
int |
getQueryType()
|
java.util.List |
getResultURIs()
Get the result list (things wanted - not the results themselves) of a DESCRIBE query. |
java.util.List |
getResultVars()
Return a list of the variables requested (SELECT) |
Syntax |
getSyntax()
|
boolean |
hasDatasetDescription()
Return true if the query has either some graph URIs or some named graph URIs in its description. |
int |
hashCode()
|
boolean |
hasLimit()
|
boolean |
hasOffset()
|
boolean |
hasOrderBy()
|
boolean |
isAskType()
|
boolean |
isConstructType()
|
boolean |
isDescribeType()
|
boolean |
isDistinct()
|
boolean |
isQueryResultStar()
Answer whether the query had SELECT/DESCRIBE/CONSTRUCT * |
boolean |
isSelectType()
|
boolean |
isStrict()
|
boolean |
isUnknownType()
|
java.lang.String |
serialize()
|
void |
serialize(com.hp.hpl.jena.query.util.IndentedLineBuffer buff)
Format the query into the buffer |
void |
serialize(com.hp.hpl.jena.query.util.IndentedLineBuffer buff,
Syntax outSyntax)
Format the query |
void |
serialize(com.hp.hpl.jena.query.util.IndentedWriter writer)
Format the query |
void |
serialize(com.hp.hpl.jena.query.util.IndentedWriter writer,
Syntax outSyntax)
Format the query |
void |
serialize(java.io.OutputStream out)
Output the query |
void |
serialize(java.io.OutputStream out,
Syntax syntax)
Output the query |
void |
setBaseURI(java.lang.String baseURI)
|
void |
setConstructTemplate(com.hp.hpl.jena.query.core.Template templ)
Add a triple patterns for a construct query |
void |
setDistinct(boolean b)
|
void |
setLimit(long limit)
|
void |
setOffset(long offset)
|
void |
setPrefix(java.lang.String prefix,
java.lang.String expansion)
Set a prefix for this query |
void |
setPrefixMapping(com.hp.hpl.jena.shared.PrefixMapping pmap)
Set the mapping |
void |
setQueryBlock(com.hp.hpl.jena.query.core.ElementBlock block)
|
void |
setQueryElement(com.hp.hpl.jena.query.core.Element elt)
|
void |
setQueryResultStar(boolean isQueryStar)
Set whether the query had SELECT/DESCRIBE/CONSTRUCT * |
void |
setQueryType(int qType)
|
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)
|
java.lang.String |
shortForm(java.lang.String uri)
Use the prefix map to turn a URI into a qname, or return the original URI |
java.lang.String |
toString()
|
void |
visit(QueryVisitor visitor)
|
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 long NOLIMIT
public static int ASCENDING
public static int DESCENDING
Constructor Detail |
---|
public Query()
Method Detail |
---|
public void setQueryType(int qType)
public int getQueryType()
public void setStrict(boolean isStrict)
public boolean isStrict()
public void setDistinct(boolean b)
public boolean isDistinct()
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 void addOrderBy(SortCondition condition)
public void addOrderBy(com.hp.hpl.jena.query.expr.Expr expr, int direction)
public void addOrderBy(com.hp.hpl.jena.graph.Node var, int direction)
public void addOrderBy(java.lang.String varName, int direction)
public java.util.List getOrderBy()
public boolean isSelectType()
public boolean isConstructType()
public boolean isDescribeType()
public boolean isAskType()
public boolean isUnknownType()
public boolean isQueryResultStar()
public void setQueryResultStar(boolean isQueryStar)
isQueryStar
- public void setQueryElement(com.hp.hpl.jena.query.core.Element elt)
public void setQueryBlock(com.hp.hpl.jena.query.core.ElementBlock block)
public com.hp.hpl.jena.query.core.ElementBlock getQueryBlock()
public void addGraphURI(java.lang.String s)
public void addNamedGraphURI(java.lang.String s)
public java.util.List getGraphURIs()
public java.util.List getNamedGraphURIs()
public boolean hasDatasetDescription()
public java.util.List getResultVars()
public void addResultVar(java.lang.String varName)
public void addResultVar(com.hp.hpl.jena.graph.Node v)
public void addDescribeNode(com.hp.hpl.jena.graph.Node node)
public com.hp.hpl.jena.query.core.Template getConstructTemplate()
public void setConstructTemplate(com.hp.hpl.jena.query.core.Template templ)
public java.util.List getResultURIs()
public void addResultURIs(com.hp.hpl.jena.graph.Node node)
public void setResultVars()
public boolean explicitlySetBaseURI()
public java.lang.String getBaseURI()
public void setBaseURI(java.lang.String baseURI)
baseURI
- The baseURI to set.public void setPrefix(java.lang.String prefix, java.lang.String expansion)
public com.hp.hpl.jena.shared.PrefixMapping getPrefixMap()
public com.hp.hpl.jena.shared.PrefixMapping getPrefixMapping()
public void setPrefixMapping(com.hp.hpl.jena.shared.PrefixMapping pmap)
public java.lang.String getPrefix(java.lang.String prefix)
public java.lang.String expandQName(java.lang.String qname)
qname
- The QName to be expanded
public java.lang.String shortForm(java.lang.String uri)
public void visit(QueryVisitor visitor)
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public java.lang.String serialize()
public void serialize(java.io.OutputStream out)
out
- OutputStreampublic void serialize(java.io.OutputStream out, Syntax syntax)
out
- OutputStreamsyntax
- Syntax URIpublic void serialize(com.hp.hpl.jena.query.util.IndentedLineBuffer buff)
buff
- IndentedLineBufferpublic void serialize(com.hp.hpl.jena.query.util.IndentedLineBuffer buff, Syntax outSyntax)
buff
- IndentedLineBuffer in which to place the unparsed queryoutSyntax
- Syntax URIpublic void serialize(com.hp.hpl.jena.query.util.IndentedWriter writer)
writer
- IndentedWriterpublic void serialize(com.hp.hpl.jena.query.util.IndentedWriter writer, Syntax outSyntax)
writer
- IndentedWriteroutSyntax
- Syntax URI
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |