public class SPARQLBooleanXMLWriter extends AbstractQueryResultWriter implements BooleanQueryResultWriter
BooleanQueryResultWriter
that writes boolean query results in the
SPARQL Query Results XML Format.Modifier and Type | Field and Description |
---|---|
protected boolean |
documentOpen |
protected boolean |
headerComplete |
protected boolean |
headerOpen |
protected boolean |
tupleVariablesFound |
protected XMLWriter |
xmlWriter
XMLWriter to write XML to.
|
Constructor and Description |
---|
SPARQLBooleanXMLWriter(OutputStream out) |
SPARQLBooleanXMLWriter(XMLWriter xmlWriter) |
Modifier and Type | Method and Description |
---|---|
protected void |
endDocument() |
void |
endHeader()
Indicates the end of the header.
|
void |
endQueryResult()
Indicates the end of a sequence of solutions.
|
BooleanQueryResultFormat |
getBooleanQueryResultFormat()
Gets the query result format that this writer uses.
|
BooleanQueryResultFormat |
getQueryResultFormat()
Gets the query result format that this writer uses.
|
Collection<RioSetting<?>> |
getSupportedSettings() |
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 |
handleNamespace(String prefix,
String uri)
Handles a namespace prefix declaration.
|
protected void |
handleSolutionImpl(BindingSet bindingSet)
Extending classes must implement this method instead of overriding
AbstractQueryResultWriter.handleSolution(BindingSet) in order
to benefit from automatic handling of RDF* encoding. |
void |
handleStylesheet(String url)
Handles a stylesheet URL.
|
void |
setPrettyPrint(boolean prettyPrint)
Deprecated.
Use
AbstractQueryResultWriter.getWriterConfig() .set(BasicWriterSettings.PRETTY_PRINT, prettyPrint) instead. |
void |
startDocument()
Indicates the start of the document.
|
void |
startHeader()
Indicates the start of the header.
|
void |
startQueryResult(List<String> bindingNames)
Indicates the start of a sequence of Solutions.
|
void |
write(boolean value)
Writes the specified boolean value.
|
getOutputStream, getWriterConfig, handleSolution, setWriterConfig, xsdStringToPlainLiteral
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
endHeader, getOutputStream, getSupportedSettings, getWriterConfig, handleNamespace, handleStylesheet, setWriterConfig, startDocument, startHeader
endQueryResult, handleBoolean, handleLinks, handleSolution, startQueryResult
protected XMLWriter xmlWriter
protected boolean documentOpen
protected boolean headerOpen
protected boolean headerComplete
protected boolean tupleVariablesFound
public SPARQLBooleanXMLWriter(OutputStream out)
public SPARQLBooleanXMLWriter(XMLWriter xmlWriter)
public final BooleanQueryResultFormat getBooleanQueryResultFormat()
BooleanQueryResultWriter
getBooleanQueryResultFormat
in interface BooleanQueryResultWriter
public final BooleanQueryResultFormat getQueryResultFormat()
QueryResultWriter
getQueryResultFormat
in interface QueryResultWriter
public void write(boolean value) throws IOException
BooleanQueryResultWriter
write
in interface BooleanQueryResultWriter
IOException
@Deprecated public void setPrettyPrint(boolean prettyPrint)
AbstractQueryResultWriter.getWriterConfig()
.set(BasicWriterSettings.PRETTY_PRINT, prettyPrint) instead.startDocument()
is called).protected void endDocument() throws IOException
IOException
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 startDocument() throws QueryResultHandlerException
QueryResultWriter
startDocument
in interface QueryResultWriter
QueryResultHandlerException
- If there was an error starting the writing of the results.public void handleStylesheet(String url) throws QueryResultHandlerException
QueryResultWriter
QueryResultWriter.startDocument()
and before
QueryResultWriter.startHeader()
.
NOTE: If the format does not support stylesheets, it must silently ignore calls to this method.
handleStylesheet
in interface QueryResultWriter
url
- The URL of the stylesheet to be used to style the results.QueryResultHandlerException
- If there was an error handling the stylesheet. This error is not thrown in
cases where stylesheets are not supported.public void startHeader() throws QueryResultHandlerException
QueryResultWriter
startHeader
in interface QueryResultWriter
QueryResultHandlerException
- If there was an error writing the start of the header.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 void endHeader() throws QueryResultHandlerException
QueryResultWriter
QueryResultWriter.startHeader()
and before any calls to
QueryResultHandler.handleSolution(org.eclipse.rdf4j.query.BindingSet)
.endHeader
in interface QueryResultWriter
QueryResultHandlerException
- If there was an error writing the end of the header.public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException
QueryResultHandler
startQueryResult
in interface QueryResultHandler
startQueryResult
in class AbstractQueryResultWriter
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 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.protected void handleSolutionImpl(BindingSet bindingSet) throws TupleQueryResultHandlerException
AbstractQueryResultWriter
AbstractQueryResultWriter.handleSolution(BindingSet)
in order
to benefit from automatic handling of RDF* encoding.handleSolutionImpl
in class AbstractQueryResultWriter
bindingSet
- the solution to handleTupleQueryResultHandlerException
public final Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings
in interface QueryResultWriter
getSupportedSettings
in class AbstractQueryResultWriter
RioSetting
s that are supported by this QueryResultWriter
.public void handleNamespace(String prefix, String uri) throws QueryResultHandlerException
QueryResultWriter
QueryResultWriter.startDocument()
to
ensure that it has a document wide effect.
NOTE: If the format does not support namespaces, it must silently ignore calls to this method.
handleNamespace
in interface QueryResultWriter
prefix
- The prefix to use for the namespaceuri
- The full URI that is to be represented by the prefix.QueryResultHandlerException
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.