|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.aduna.iteration.CloseableIterationBase<T,RepositoryException>
org.openrdf.repository.RepositoryResult<T>
public class RepositoryResult<T>
A RepositoryResult is a result collection of objects (for example
Statement, Namespace, or
Resource objects) that can be iterated over. It
keeps an open connection to the backend for lazy retrieval of individual
results. Additionally it has some utility methods to fetch all results and
add them to a collection.
By default, a RepositoryResult is not necessarily a (mathematical) set: it
may contain duplicate objects. Duplicate filtering can be {
switched on, but this should not be used
lightly as the filtering mechanism is potentially memory-intensive.
A RepositoryResult needs to be closed after use to free up
any resources (open connections, read locks, etc.) it has on the underlying
repository.
RepositoryConnection.getStatements(org.openrdf.model.Resource,
org.openrdf.model.URI, org.openrdf.model.Value, boolean,
org.openrdf.model.Resource[]),
RepositoryConnection.getNamespaces(),
RepositoryConnection.getContextIDs()| Constructor Summary | |
|---|---|
RepositoryResult(CloseableIteration<? extends T,RepositoryException> iter)
|
|
| Method Summary | ||
|---|---|---|
|
addTo(C collection)
Adds all objects of this RepositoryResult to the supplied collection. |
|
List<T> |
asList()
Returns a List containing all objects of this RepositoryResult in
order of iteration. |
|
void |
enableDuplicateFilter()
Switches on duplicate filtering while iterating over objects. |
|
protected void |
handleClose()
Called by CloseableIterationBase.close() when it is called for the first time. |
|
boolean |
hasNext()
Returns true if the iteration has more elements. |
|
T |
next()
Returns the next element in the iteration. |
|
void |
remove()
Removes from the underlying collection the last element returned by the iteration (optional operation). |
|
| Methods inherited from class info.aduna.iteration.CloseableIterationBase |
|---|
close, isClosed |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RepositoryResult(CloseableIteration<? extends T,RepositoryException> iter)
| Method Detail |
|---|
public boolean hasNext()
throws RepositoryException
IterationIteration.next() would return an element
rather than throwing a NoSuchElementException.)
RepositoryException
public T next()
throws RepositoryException
Iteration
RepositoryException
public void remove()
throws RepositoryException
Iteration
RepositoryException
protected void handleClose()
throws RepositoryException
CloseableIterationBaseCloseableIterationBase.close() when it is called for the first time. This method
is only called once on each iteration. By default, this method does
nothing.
handleClose in class CloseableIterationBase<T,RepositoryException>RepositoryException
public void enableDuplicateFilter()
throws RepositoryException
Set and on calling next() or hasNext() will ignore any
objects that already occur in this Set.
Caution: use of this filtering mechanism is potentially memory-intensive.
RepositoryException - if a problem occurred during initialization of the filter.
public List<T> asList()
throws RepositoryException
List containing all objects of this RepositoryResult in
order of iteration. The RepositoryResult is fully consumed and
automatically closed by this operation.
Note: use this method with caution! It pulls the entire RepositoryResult in memory and as such is potentially very memory-intensive.
RepositoryException - if a problem occurred during retrieval of the results.addTo(Collection)
public <C extends Collection<T>> C addTo(C collection)
throws RepositoryException
RepositoryException - if a problem occurred during retrieval of the results.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||