public interface OntologyTupleQuery extends ClosableIterator<Vector<LiteralOrONodeID>>
Ontology.createTupleQuery(String, gate.creole.ontology.OConstants.QueryLanguage)
.
NOTE: querying the ontology triple store directly should be avoided and only done in exceptional cases. Using the methods to query and access ontology entities should be preferred whenever possible!
The query object implements a closable iterator that auto-closes when all its elements are exhausted. However, you must close it if you stop retrieving elements before all elements have been exhausted (i.e. before the hasNext() method has returned false). Closing the query object is necessary to free the considerable resources allocated by it.
To use a query object properly, be sure to follow the following steps:
Modifier and Type | Method and Description |
---|---|
void |
close()
Explicitly close the query and free its resources.
|
void |
evaluate()
Evaluate the tuple query (again).
|
boolean |
hasNext()
Test if more results are available.
|
Vector<LiteralOrONodeID> |
next()
Retrieve the next tuple from the query object.
|
Vector<String> |
nextAsString()
Retrieve the next tuple from the query object as a vector of strings.
|
LiteralOrONodeID |
nextFirst()
Return just the first variable of a tuple.
|
String |
nextFirstAsString()
Return just the first variable of a tuple as a String.
|
void |
setBinding(String varName,
Literal value)
Set the binding of a query variable to a new value.
|
void |
setBinding(String varName,
ONodeID value)
Set the binding of a query variable to a new value.
|
forEachRemaining, remove
boolean hasNext()
hasNext
in interface Iterator<Vector<LiteralOrONodeID>>
Vector<LiteralOrONodeID> next()
next
in interface Iterator<Vector<LiteralOrONodeID>>
Vector<String> nextAsString()
void setBinding(String varName, Literal value)
varName
- the name of the variablevalue
- the value to assign to the variablevoid setBinding(String varName, ONodeID value)
varName
- the name of the variablevalue
- the value to assign to the variablevoid evaluate()
LiteralOrONodeID nextFirst()
String nextFirstAsString()
void close()
close
in interface ClosableIterator<Vector<LiteralOrONodeID>>
Copyright © 2024 GATE. All rights reserved.