Class BackgroundTupleResult
java.lang.Object
org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<BindingSet>
org.eclipse.rdf4j.common.iteration.IterationWrapper<BindingSet>
org.eclipse.rdf4j.query.impl.IteratingTupleQueryResult
org.eclipse.rdf4j.query.resultio.helpers.BackgroundTupleResult
- All Implemented Interfaces:
AutoCloseable, Iterable<BindingSet>, Runnable, Iterator<BindingSet>, CloseableIteration<BindingSet>, QueryResult<BindingSet>, QueryResultHandler, TupleQueryResult, TupleQueryResultHandler
public class BackgroundTupleResult
extends IteratingTupleQueryResult
implements Runnable, TupleQueryResultHandler
Provides concurrent access to tuple results as they are being parsed.
- Author:
- James Leigh
-
Field Summary
Fields inherited from class IterationWrapper
wrappedIterModifier and TypeFieldDescriptionprotected final CloseableIteration<? extends BindingSet> Deprecated.This will be changed to private, possibly with an accessor in future.Fields inherited from interface CloseableIteration
EMPTY_STATEMENT_ITERATION -
Constructor Summary
ConstructorsConstructorDescriptionBackgroundTupleResult(QueueCursor<BindingSet> queue, TupleQueryResultParser parser, InputStream in) BackgroundTupleResult(TupleQueryResultParser parser, InputStream in) -
Method Summary
Modifier and TypeMethodDescriptionvoidIndicates the end of a sequence of solutions.Gets the names of the bindings, in order of projection.voidhandleBoolean(boolean value) Handles the specified boolean value.protected voidCloses this Iteration and also closes the wrapped Iteration if it is aCloseableIteration.voidhandleLinks(List<String> linkUrls) Handles the links elements which are present in SPARQL Results JSON and SPARQL Results XML documents in the header.voidhandleSolution(BindingSet bindingSet) Handles a solution.voidrun()voidstartQueryResult(List<String> bindingNames) Indicates the start of a sequence of Solutions.Methods inherited from class IterationWrapper
hasNext, next, removeModifier and TypeMethodDescriptionbooleanhasNext()Deprecated.Checks whether the wrapped Iteration contains more elements, closing this Iteration when this is not the case.next()Deprecated.Returns the next element from the wrapped Iteration.voidremove()Deprecated.Removes the last element that has been returned from the wrapped Iteration.Methods inherited from class AbstractCloseableIteration
close, isClosedModifier and TypeMethodDescriptionfinal voidclose()CallsAbstractCloseableIteration.handleClose()upon first call and makes sure the resource closures are only executed once.final booleanisClosed()Checks whether this CloseableIteration has been closed.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface Iterator
forEachRemainingMethods inherited from interface QueryResult
hasNext, iterator, next, streamModifier and TypeMethodDescriptionbooleanhasNext()Returnstrueif the query result has more elements.default Iterator<BindingSet> iterator()next()Returns the next element in the query result.default Stream<BindingSet> stream()Convert the result elements to a JavaStream.
-
Constructor Details
-
BackgroundTupleResult
-
BackgroundTupleResult
public BackgroundTupleResult(QueueCursor<BindingSet> queue, TupleQueryResultParser parser, InputStream in)
-
-
Method Details
-
handleClose
Description copied from class:IterationWrapperCloses this Iteration and also closes the wrapped Iteration if it is aCloseableIteration.- Overrides:
handleClosein classIterationWrapper<BindingSet>- Throws:
QueryEvaluationException
-
getBindingNames
Description copied from interface:TupleQueryResultGets the names of the bindings, in order of projection.- Specified by:
getBindingNamesin interfaceTupleQueryResult- Overrides:
getBindingNamesin classIteratingTupleQueryResult- Returns:
- The binding names, in order of projection.
-
run
-
startQueryResult
Description copied from interface:QueryResultHandlerIndicates the start of a sequence of Solutions. The supplied bindingNames are an indication of the values that are in the Solutions. For example, a SPARQL query like select ?X ?Y where { ?X ?P ?Y } will have binding names X and Y.- Specified by:
startQueryResultin interfaceQueryResultHandler- Parameters:
bindingNames- An ordered set of binding names.- Throws:
TupleQueryResultHandlerException- If there was an error during the starting of the query result handler. This exception may be thrown if theQueryResultHandler.handleBoolean(boolean)method was called before this method and the handler cannot process both boolean and tuple results simultaneously.
-
handleSolution
Description copied from interface:QueryResultHandlerHandles a solution.- Specified by:
handleSolutionin interfaceQueryResultHandler- Parameters:
bindingSet- A single set of tuple results, with binding names bound to values. Each of the binding names in the solution must have previously been registered with theQueryResultHandler.startQueryResult(List)method.- Throws:
TupleQueryResultHandlerException- If there was an error during the handling of the query solution. This exception may be thrown if theQueryResultHandler.handleBoolean(boolean)method was called before this method and the handler cannot process both boolean and tuple results simultaneously.
-
endQueryResult
Description copied from interface:QueryResultHandlerIndicates the end of a sequence of solutions.- Specified by:
endQueryResultin interfaceQueryResultHandler- Throws:
TupleQueryResultHandlerException- If there was an error during the ending of the query result handler. This exception may be thrown if theQueryResultHandler.handleBoolean(boolean)method was called before this method and the handler cannot process both boolean and tuple results simultaneously.
-
handleBoolean
Description copied from interface:QueryResultHandlerHandles the specified boolean value.- Specified by:
handleBooleanin interfaceQueryResultHandler- Parameters:
value- The boolean value to handle.- Throws:
QueryResultHandlerException- If there was an error during the handling of this value. This exception may be thrown if theQueryResultHandler.startQueryResult(List),QueryResultHandler.handleSolution(BindingSet)orQueryResultHandler.endQueryResult()methods were called before this method was called, and the handler cannot process both boolean and tuple results simultaneously.
-
handleLinks
Description copied from interface:QueryResultHandlerHandles the links elements which are present in SPARQL Results JSON and SPARQL Results XML documents in the header.NOTE: If the format does not support links, it must silently ignore a call to this method.
An accumulating handler should accumulate these links.
- Specified by:
handleLinksin interfaceQueryResultHandler- Parameters:
linkUrls- The URLs of the links to handle.- Throws:
QueryResultHandlerException- If there was an error handling the set of link URLs. This error is not thrown in cases where links are not supported.- See Also:
-