Package org.eclipse.rdf4j.query
Interface QueryResult<T>
-
- All Superinterfaces:
java.lang.AutoCloseable,CloseableIteration<T,QueryEvaluationException>,java.lang.Iterable<T>,Iteration<T,QueryEvaluationException>
- All Known Subinterfaces:
GraphQueryResult,TupleQueryResult
- All Known Implementing Classes:
BackgroundGraphResult,BackgroundTupleResult,CleanerGraphQueryResult,CleanerTupleQueryResult,GraphQueryResultImpl,IteratingGraphQueryResult,IteratingTupleQueryResult,MutableTupleQueryResult,QueryResults.CleanerGraphQueryResult,QueryResults.GraphQueryResultFilter,QueryResults.TupleQueryResultFilter,TupleQueryResultImpl
public interface QueryResult<T> extends java.lang.AutoCloseable, CloseableIteration<T,QueryEvaluationException>, java.lang.Iterable<T>
Super type of all query result types (TupleQueryResult, GraphQueryResult, etc.).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanhasNext()Returnstrueif the query result has more elements.default java.util.Iterator<T>iterator()Tnext()Returns the next element in the query result.default java.util.stream.Stream<T>stream()Convert the result elements to a JavaStream.-
Methods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration
close
-
-
-
-
Method Detail
-
iterator
default java.util.Iterator<T> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<T>
-
hasNext
boolean hasNext() throws QueryEvaluationExceptionReturnstrueif the query result has more elements. (In other words, returnstrueifnext()would return an element rather than throwing aNoSuchElementException.)- Specified by:
hasNextin interfaceIteration<T,QueryEvaluationException>- Returns:
trueif the iteration has more elements.- Throws:
QueryEvaluationException- if an error occurs while executing the query.
-
next
T next() throws QueryEvaluationException
Returns the next element in the query result.- Specified by:
nextin interfaceIteration<T,QueryEvaluationException>- Returns:
- the next element in the query result.
- Throws:
java.util.NoSuchElementException- if the iteration has no more elements or if it has been closed.QueryEvaluationException- if an error occurs while executing the query.
-
stream
default java.util.stream.Stream<T> stream()
Convert the result elements to a JavaStream. Note that the consumer should take care to close the stream (by calling Stream#close() or using try-with-resource) if it is not fully consumed.- Specified by:
streamin interfaceCloseableIteration<T,QueryEvaluationException>- Specified by:
streamin interfaceIteration<T,QueryEvaluationException>- Returns:
- stream a
Streamof query result elements.
-
-