public class QueryResultCollector extends Object implements QueryResultHandler, TupleQueryResultHandler, BooleanQueryResultHandler
QueryResultHandler
interface that is able to collect a single result from either
Boolean or Tuple results simultaneously.
The List
s that are returned by this interface are immutable.
Constructor and Description |
---|
QueryResultCollector() |
Modifier and Type | Method and Description |
---|---|
void |
endQueryResult()
Indicates the end of a sequence of solutions.
|
List<String> |
getBindingNames()
Returns a collection of binding names collected.
|
List<BindingSet> |
getBindingSets() |
boolean |
getBoolean()
If
getHandledBoolean() returns true this method returns the boolean that was last found using
handleBoolean(boolean) |
boolean |
getHandledBoolean()
Determines whether
handleBoolean(boolean) was called for this collector. |
boolean |
getHandledTuple()
Determines whether
endQueryResult() was called after the last calls to startQueryResult(List)
and optionally calls to handleSolution(BindingSet) . |
List<String> |
getLinks() |
void |
handleBoolean(boolean value)
Handles the specified boolean value.
|
void |
handleLinks(List<String> linkUrls)
Handles the links elements which are present in SPARQL Results JSON and SPARQL Results XML documents in the
header.
|
void |
handleSolution(BindingSet bindingSet)
Handles a solution.
|
void |
startQueryResult(List<String> bindingNames)
Indicates the start of a sequence of Solutions.
|
public void handleBoolean(boolean value) throws QueryResultHandlerException
QueryResultHandler
handleBoolean
in interface QueryResultHandler
value
- The boolean value to handle.QueryResultHandlerException
- If there was an error during the handling of this value. This exception may
be thrown if the QueryResultHandler.startQueryResult(List)
,
QueryResultHandler.handleSolution(BindingSet)
or QueryResultHandler.endQueryResult()
methods
were called before this method was called, and the handler cannot process
both boolean and tuple results simultaneously.public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException
QueryResultHandler
startQueryResult
in interface QueryResultHandler
bindingNames
- An ordered set of binding names.TupleQueryResultHandlerException
- If there was an error during the starting of the query result handler.
This exception may be thrown if the QueryResultHandler.handleBoolean(boolean)
method was called before this method and the handler cannot process both
boolean and tuple results simultaneously.public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException
QueryResultHandler
handleSolution
in interface QueryResultHandler
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 the QueryResultHandler.startQueryResult(List)
method.TupleQueryResultHandlerException
- If there was an error during the handling of the query solution. This
exception may be thrown if the QueryResultHandler.handleBoolean(boolean)
method
was called before this method and the handler cannot process both
boolean and tuple results simultaneously.public void endQueryResult() throws TupleQueryResultHandlerException
QueryResultHandler
endQueryResult
in interface QueryResultHandler
TupleQueryResultHandlerException
- If there was an error during the ending of the query result handler.
This exception may be thrown if the QueryResultHandler.handleBoolean(boolean)
method was called before this method and the handler cannot process both
boolean and tuple results simultaneously.public void handleLinks(List<String> linkUrls) throws QueryResultHandlerException
QueryResultHandler
NOTE: If the format does not support links, it must silently ignore a call to this method.
An accumulating handler should accumulate these links.
handleLinks
in interface QueryResultHandler
linkUrls
- The URLs of the links to handle.QueryResultHandlerException
- If there was an error handling the set of link URLs. This error is not thrown
in cases where links are not supported.public boolean getHandledBoolean()
handleBoolean(boolean)
was called for this collector.public boolean getBoolean() throws QueryResultHandlerException
getHandledBoolean()
returns true this method returns the boolean that was last found using
handleBoolean(boolean)
If getHandledBoolean()
returns false this method throws a QueryResultHandlerException
indicating
that a response could not be provided.
QueryResultHandlerException
- If there was no boolean value collected.public boolean getHandledTuple()
endQueryResult()
was called after the last calls to startQueryResult(List)
and optionally calls to handleSolution(BindingSet)
.endQueryResult()
after the last calls to
startQueryResult(List)
and handleSolution(BindingSet)
.public List<String> getBindingNames() throws QueryResultHandlerException
String
s that were collected as the binding names.QueryResultHandlerException
- If the tuple results set was not successfully collected, as signalled by a
call to endQueryResult()
.public List<BindingSet> getBindingSets() throws QueryResultHandlerException
BindingSet
s that were collected as the tuple results.QueryResultHandlerException
- If the tuple results set was not successfully collected, as signalled by a
call to endQueryResult()
.public List<String> getLinks()
handleLinks(List)
.Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.