|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.franz.ag.TriplesQuery
public class TriplesQuery
This class collects the parameters and results of a query that retrieves triples by patterns of triple parts.
A triple is located by a pattern of four components, the subject, predicate, object, and graph. Each of these may be specified as a string in NTriples notation, a Value instance, a UPI instance. A null value is a wildcard that matches anything. The graph position can also be the empty string to denote the null context or default graph of the triple store.
The inital value of the subject predicate and object positions is null. The initial value of the graph position is the empty string.
Each of the triple components can also match a range of values if the corresponding end parameter is set. In order to specify a range, the start and end must be specified as an EncodedLiteral instance or a UPI instance that denotes an encoded UPI. The strings "min" and "max" can also be used to denote the minimum and maximum values of the corresponding UPI type.
The search can be managed in more detail by setting various attributes that control what triples are examined and what triples are returned.
An instance can be used many times to repeat the same query with identical or different parameters. The result fields are reset every time a parameter is modified.
| Constructor Summary | |
|---|---|
TriplesQuery()
Create a new empty query with default arguments. |
|
| Method Summary | |
|---|---|
boolean |
ask()
Determine if a triple matching a pattern exists.. |
boolean |
ask(AllegroGraph ag)
|
long |
count()
Count the number of triples located by a pattern of parts. |
long |
count(AllegroGraph ag)
Count the number of triples located by a pattern of parts. |
long |
estimate(boolean roughly)
Estimate the number of triples located by a pattern of parts using only the information in indices. |
Triple |
find()
Find one triple that matches a pattern. |
boolean |
getBooleanResult()
Query the result of a query that had a boolean result. |
java.lang.Object |
getContext()
|
java.lang.Object |
getContextEnd()
|
int |
getIncludeDeleted()
Query the includeDeleted option. |
int |
getIndexedOnly()
Query the indexedOnly option. |
java.lang.String |
getLoadFunction()
Query the name of the filter function. |
int |
getLookahead()
Query the lookahead parameter for the query. |
java.lang.Object |
getObject()
|
java.lang.Object |
getObjectEnd()
|
int |
getOmitEncoded()
Query the omitEncoded option. |
int |
getOmitNonEncoded()
Query the omitEncoded option. |
java.lang.Object |
getPredicate()
|
java.lang.Object |
getPredicateEnd()
|
long |
getResultCount()
Query the count value of a query that returns a numeric result. |
Cursor |
getResultCursor()
Query the result of a triples query that returns a collection of triples. |
java.lang.Object |
getSubject()
|
java.lang.Object |
getSubjectEnd()
|
AGInternals |
getTripleStore()
Query the triple store agaist which this query has or will run. |
boolean |
isIncludeInferred()
Query the includeInferred option. |
Cursor |
run()
Find all the triples that match the pattern. |
Cursor |
run(AllegroGraph ag)
|
void |
setContext(java.lang.Object context)
Set the context component of the query. |
void |
setContextEnd(java.lang.Object contextEnd)
|
void |
setFilterFunction(java.lang.String name)
Set the name of a filter function option. |
void |
setIncludeDeleted(boolean v)
Set the includeDeleted option. |
void |
setIncludeInferred(boolean includeInferred)
Modify the includeInferred option. |
void |
setIndexedOnly(boolean v)
Set the indexedOnly option. |
void |
setLookahead(int lh)
Set the lookahead parameter for this query. |
void |
setObject(java.lang.Object object)
|
void |
setObjectEnd(java.lang.Object objectEnd)
|
void |
setOmitEncoded(boolean v)
Set the omitEncoded option. |
void |
setOmitNonEncoded(boolean v)
Set the omitNonEncoded option. |
void |
setPredicate(java.lang.Object predicate)
|
void |
setPredicateEnd(java.lang.Object predicateEnd)
|
void |
setSubject(java.lang.Object subject)
|
void |
setSubjectEnd(java.lang.Object subjectEnd)
|
void |
setTripleStore(AllegroGraph ag)
Specify the triple store agaist which this query will run. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TriplesQuery()
| Method Detail |
|---|
public java.lang.Object getContext()
public void setContext(java.lang.Object context)
throws AllegroGraphException
context - the context to set.
A null valueis a wild card that matches anything.
The empty string denote the default context, or null graph.
AllegroGraphExceptionpublic java.lang.Object getContextEnd()
public void setContextEnd(java.lang.Object contextEnd)
throws AllegroGraphException
contextEnd - the contextEnd to set
AllegroGraphExceptionpublic java.lang.Object getObject()
public void setObject(java.lang.Object object)
object - the object to setpublic java.lang.Object getObjectEnd()
public void setObjectEnd(java.lang.Object objectEnd)
objectEnd - the objectEnd to setpublic java.lang.Object getPredicate()
public void setPredicate(java.lang.Object predicate)
predicate - the predicate to setpublic java.lang.Object getPredicateEnd()
public void setPredicateEnd(java.lang.Object predicateEnd)
predicateEnd - the predicateEnd to setpublic java.lang.Object getSubject()
public void setSubject(java.lang.Object subject)
subject - the subject to setpublic java.lang.Object getSubjectEnd()
public void setSubjectEnd(java.lang.Object subjectEnd)
subjectEnd - the subjectEnd to setpublic boolean getBooleanResult()
java.lang.IllegalStateException - if a boolean result is not available.public long getResultCount()
java.lang.IllegalStateException - if the count is not available.public boolean isIncludeInferred()
public void setIncludeInferred(boolean includeInferred)
includeInferred - the desired value.public int getIncludeDeleted()
public void setIncludeDeleted(boolean v)
true - or falsepublic void setOmitEncoded(boolean v)
true - or falsepublic int getOmitEncoded()
public void setLookahead(int lh)
A zero value specifies that all the search results remain on the server. This option creates a Cursor that can be passed to a serializer in the server.
lh - the desired lookahead value. The initial setting is 1000.public int getLookahead()
A zero value specifies that all the search results remain on the server. This option creates a Cursor that can be passed to a serializer in the server. The initial setting is 1000.
public void setOmitNonEncoded(boolean v)
true - or falsepublic int getOmitNonEncoded()
public void setIndexedOnly(boolean v)
true - or falsepublic int getIndexedOnly()
public void setFilterFunction(java.lang.String name)
name - public java.lang.String getLoadFunction()
public Cursor getResultCursor()
public void setTripleStore(AllegroGraph ag)
ag - public AGInternals getTripleStore()
public long count()
throws AllegroGraphException
AllegroGraphException
public long count(AllegroGraph ag)
throws AllegroGraphException
ag - The triple store where the query should run.
AllegroGraphException
public long estimate(boolean roughly)
throws AllegroGraphException
roughly - When true, the estimate can be off by as much as twice
the triple store's metaindex-skip-size for each index chunk involved.
When false, return a more acurate (but slower) estimate.
AllegroGraphException
public boolean ask()
throws AllegroGraphException
AllegroGraphException
public boolean ask(AllegroGraph ag)
throws AllegroGraphException
AllegroGraphException
public Triple find()
throws AllegroGraphException
AllegroGraphException
public Cursor run()
throws AllegroGraphException
AllegroGraphException - if a problem was encountered during the search.
java.lang.IllegalArgumentException - if this instance is not properly initialized.
public Cursor run(AllegroGraph ag)
throws AllegroGraphException
AllegroGraphException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||