Class QueryResultCollector
- java.lang.Object
-
- org.eclipse.rdf4j.query.resultio.helpers.QueryResultCollector
-
- All Implemented Interfaces:
BooleanQueryResultHandler,QueryResultHandler,TupleQueryResultHandler
public class QueryResultCollector extends Object implements QueryResultHandler, TupleQueryResultHandler, BooleanQueryResultHandler
An implementation of theQueryResultHandlerinterface that is able to collect a single result from either Boolean or Tuple results simultaneously.The
Lists that are returned by this interface are immutable.- Author:
- Peter Ansell
-
-
Constructor Summary
Constructors Constructor Description QueryResultCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendQueryResult()List<String>getBindingNames()Returns a collection of binding names collected.List<BindingSet>getBindingSets()booleangetBoolean()IfgetHandledBoolean()returns true this method returns the boolean that was last found usinghandleBoolean(boolean)booleangetHandledBoolean()Determines whetherhandleBoolean(boolean)was called for this collector.booleangetHandledTuple()Determines whetherendQueryResult()was called after the last calls tostartQueryResult(List)and optionally calls tohandleSolution(BindingSet).List<String>getLinks()voidhandleBoolean(boolean value)voidhandleLinks(List<String> linkUrls)voidhandleSolution(BindingSet bindingSet)voidstartQueryResult(List<String> bindingNames)
-
-
-
Method Detail
-
handleBoolean
public void handleBoolean(boolean value) throws QueryResultHandlerException- Specified by:
handleBooleanin interfaceQueryResultHandler- Throws:
QueryResultHandlerException
-
startQueryResult
public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException
- Specified by:
startQueryResultin interfaceQueryResultHandler- Throws:
TupleQueryResultHandlerException
-
handleSolution
public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException
- Specified by:
handleSolutionin interfaceQueryResultHandler- Throws:
TupleQueryResultHandlerException
-
endQueryResult
public void endQueryResult() throws TupleQueryResultHandlerException- Specified by:
endQueryResultin interfaceQueryResultHandler- Throws:
TupleQueryResultHandlerException
-
handleLinks
public void handleLinks(List<String> linkUrls) throws QueryResultHandlerException
- Specified by:
handleLinksin interfaceQueryResultHandler- Throws:
QueryResultHandlerException
-
getHandledBoolean
public boolean getHandledBoolean()
Determines whetherhandleBoolean(boolean)was called for this collector.- Returns:
- True if there was a boolean handled by this collector.
-
getBoolean
public boolean getBoolean() throws QueryResultHandlerExceptionIfgetHandledBoolean()returns true this method returns the boolean that was last found usinghandleBoolean(boolean)If
getHandledBoolean()returns false this method throws aQueryResultHandlerExceptionindicating that a response could not be provided.- Returns:
- The boolean value that was collected.
- Throws:
QueryResultHandlerException- If there was no boolean value collected.
-
getHandledTuple
public boolean getHandledTuple()
Determines whetherendQueryResult()was called after the last calls tostartQueryResult(List)and optionally calls tohandleSolution(BindingSet).- Returns:
- True if there was a call to
endQueryResult()after the last calls tostartQueryResult(List)andhandleSolution(BindingSet).
-
getBindingNames
public List<String> getBindingNames() throws QueryResultHandlerException
Returns a collection of binding names collected.- Returns:
- An immutable list of
Strings that were collected as the binding names. - Throws:
QueryResultHandlerException- If the tuple results set was not successfully collected, as signalled by a call toendQueryResult().
-
getBindingSets
public List<BindingSet> getBindingSets() throws QueryResultHandlerException
- Returns:
- An immutable list of
BindingSets that were collected as the tuple results. - Throws:
QueryResultHandlerException- If the tuple results set was not successfully collected, as signalled by a call toendQueryResult().
-
getLinks
public List<String> getLinks()
- Returns:
- A list of links accumulated from calls to
handleLinks(List).
-
-