- All Implemented Interfaces:
Resourceobjects) 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.
Method SummaryModifier and TypeMethodDescription
voidSwitches on duplicate filtering while iterating over objects.
protected voidCalled by
AbstractCloseableIteration.close()when it is called for the first time.
hasNext()Returns true if the iteration has more elements.
next()Returns the next element in the iteration.
remove()Removes from the underlying collection the last element returned by the iteration (optional operation).
Methods inherited from class org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasNextpublic boolean hasNext() throws RepositoryExceptionReturns true if the iteration has more elements. (In other words, returns true if
Iteration.next()would return an element rather than throwing a NoSuchElementException.)
nextReturns the next element in the iteration.
removepublic void remove() throws RepositoryExceptionRemoves from the underlying collection the last element returned by the iteration (optional operation). This method can be called only once per call to next.
handleCloseprotected void handleClose() throws RepositoryExceptionDescription copied from class:
AbstractCloseableIteration.close()when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.
enableDuplicateFilterpublic void enableDuplicateFilter() throws RepositoryExceptionSwitches on duplicate filtering while iterating over objects. The RepositoryResult will keep track of the previously returned objects in a
Setand 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.
Listcontaining 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.
addToAdds all objects of this RepositoryResult to the supplied collection. The RepositoryResult is fully consumed and automatically closed by this operation.
- A reference to the collection that was supplied.
RepositoryException- if a problem occurred during retrieval of the results.