Class ReusableTupleQueryResult
- java.lang.Object
-
- org.eclipse.rdf4j.spring.resultcache.ReusableTupleQueryResult
-
- All Implemented Interfaces:
AutoCloseable,Iterable<org.eclipse.rdf4j.query.BindingSet>,Iterator<org.eclipse.rdf4j.query.BindingSet>,org.eclipse.rdf4j.common.iteration.CloseableIteration<org.eclipse.rdf4j.query.BindingSet>,org.eclipse.rdf4j.query.QueryResult<org.eclipse.rdf4j.query.BindingSet>,org.eclipse.rdf4j.query.TupleQueryResult,ThrowableRecorder
public class ReusableTupleQueryResult extends Object implements org.eclipse.rdf4j.query.TupleQueryResult, ThrowableRecorder
Wrapper for a TupleQueryResult, allowing the result to be replayed. The wrapper copies the result data, consuming the original result fully onclose().Example:
TupleQueryResult result = tupleQuery.execute(); ReuseableTupleQueryResult reusable = new ReuseableTupleQueryResult(result); while (reusable.hasNext()) { reuseable.next(); } reuseable.close(); TupleQueryResult cached = reuseable.recreateTupleQueryResult(); while (cached.hasNext()) { cached.next(); } cached.close();- Since:
- 4.0.0
- Author:
- Florian Kleedorfer
-
-
Constructor Summary
Constructors Constructor Description ReusableTupleQueryResult(org.eclipse.rdf4j.query.TupleQueryResult result, org.eclipse.rdf4j.query.BindingSet queryBindings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanReuse()voidclose()voidforEach(Consumer<? super org.eclipse.rdf4j.query.BindingSet> action)List<String>getBindingNames()booleanhasNext()Iterator<org.eclipse.rdf4j.query.BindingSet>iterator()org.eclipse.rdf4j.query.BindingSetnext()booleanqueryBindingsAreIdentical(org.eclipse.rdf4j.query.BindingSet candidate)voidrecordThrowable(Throwable t)CachedTupleQueryResultrecreateTupleQueryResult()voidremove()Spliterator<org.eclipse.rdf4j.query.BindingSet>spliterator()Stream<org.eclipse.rdf4j.query.BindingSet>stream()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Method Detail
-
queryBindingsAreIdentical
public boolean queryBindingsAreIdentical(org.eclipse.rdf4j.query.BindingSet candidate)
-
canReuse
public boolean canReuse()
-
recreateTupleQueryResult
public CachedTupleQueryResult recreateTupleQueryResult()
-
recordThrowable
public void recordThrowable(Throwable t)
- Specified by:
recordThrowablein interfaceThrowableRecorder
-
getBindingNames
public List<String> getBindingNames() throws org.eclipse.rdf4j.query.QueryEvaluationException
- Specified by:
getBindingNamesin interfaceorg.eclipse.rdf4j.query.TupleQueryResult- Throws:
org.eclipse.rdf4j.query.QueryEvaluationException
-
iterator
public Iterator<org.eclipse.rdf4j.query.BindingSet> iterator()
-
close
public void close() throws org.eclipse.rdf4j.query.QueryEvaluationException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.eclipse.rdf4j.common.iteration.CloseableIteration<org.eclipse.rdf4j.query.BindingSet>- Throws:
org.eclipse.rdf4j.query.QueryEvaluationException
-
hasNext
public boolean hasNext() throws org.eclipse.rdf4j.query.QueryEvaluationException
-
next
public org.eclipse.rdf4j.query.BindingSet next() throws org.eclipse.rdf4j.query.QueryEvaluationException
-
remove
public void remove() throws org.eclipse.rdf4j.query.QueryEvaluationException
-
stream
public Stream<org.eclipse.rdf4j.query.BindingSet> stream()
- Specified by:
streamin interfaceorg.eclipse.rdf4j.common.iteration.CloseableIteration<org.eclipse.rdf4j.query.BindingSet>- Specified by:
streamin interfaceorg.eclipse.rdf4j.query.QueryResult<org.eclipse.rdf4j.query.BindingSet>
-
forEach
public void forEach(Consumer<? super org.eclipse.rdf4j.query.BindingSet> action)
-
spliterator
public Spliterator<org.eclipse.rdf4j.query.BindingSet> spliterator()
- Specified by:
spliteratorin interfaceIterable<org.eclipse.rdf4j.query.BindingSet>
-
-