public class SPARQLResultsXMLWriter extends QueryResultWriterBase implements TupleQueryResultWriter
TupleQueryResultWriter that writes tuple 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 |
|---|
SPARQLResultsXMLWriter(OutputStream out) |
SPARQLResultsXMLWriter(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.
|
TupleQueryResultFormat |
getQueryResultFormat()
Gets the query result format that this writer uses.
|
Collection<RioSetting<?>> |
getSupportedSettings() |
TupleQueryResultFormat |
getTupleQueryResultFormat()
Gets the query result format that this writer uses.
|
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.
|
void |
handleSolution(BindingSet bindingSet)
Handles a solution.
|
void |
handleStylesheet(String url)
Handles a stylesheet URL.
|
void |
setPrettyPrint(boolean prettyPrint)
Deprecated.
Use
QueryResultWriterBase.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.
|
getWriterConfig, setWriterConfig, xsdStringToPlainLiteralclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitendHeader, getSupportedSettings, getWriterConfig, handleNamespace, handleStylesheet, setWriterConfig, startDocument, startHeaderendQueryResult, handleBoolean, handleLinks, handleSolution, startQueryResultprotected XMLWriter xmlWriter
protected boolean documentOpen
protected boolean headerOpen
protected boolean headerComplete
protected boolean tupleVariablesFound
public SPARQLResultsXMLWriter(OutputStream out)
public SPARQLResultsXMLWriter(XMLWriter xmlWriter)
public final TupleQueryResultFormat getTupleQueryResultFormat()
TupleQueryResultWritergetTupleQueryResultFormat in interface TupleQueryResultWriterpublic final TupleQueryResultFormat getQueryResultFormat()
QueryResultWritergetQueryResultFormat in interface QueryResultWriter@Deprecated public void setPrettyPrint(boolean prettyPrint)
QueryResultWriterBase.getWriterConfig()
.set(BasicWriterSettings.PRETTY_PRINT, prettyPrint) instead.startDocument() is called).protected void endDocument()
throws IOException
IOExceptionpublic void handleBoolean(boolean value)
throws QueryResultHandlerException
QueryResultHandlerhandleBoolean in interface QueryResultHandlervalue - 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
QueryResultWriterstartDocument in interface QueryResultWriterQueryResultHandlerException - If there was an error starting the writing of the results.public void handleStylesheet(String url) throws QueryResultHandlerException
QueryResultWriterQueryResultWriter.startDocument() and before QueryResultWriter.startHeader().
NOTE: If the format does not support stylesheets, it must silently ignore calls to this method.
handleStylesheet in interface QueryResultWriterurl - 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
QueryResultWriterstartHeader in interface QueryResultWriterQueryResultHandlerException - If there was an error writing the start of the header.public void handleLinks(List<String> linkUrls) throws QueryResultHandlerException
QueryResultHandlerNOTE: 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 QueryResultHandlerlinkUrls - 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
QueryResultWriterQueryResultWriter.startHeader() and before any calls to QueryResultHandler.handleSolution(org.openrdf.query.BindingSet).endHeader in interface QueryResultWriterQueryResultHandlerException - If there was an error writing the end of the header.public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException
QueryResultHandlerstartQueryResult in interface QueryResultHandlerbindingNames - 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
QueryResultHandlerendQueryResult in interface QueryResultHandlerTupleQueryResultHandlerException - 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 handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException
QueryResultHandlerhandleSolution in interface QueryResultHandlerbindingSet - 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 final Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings in interface QueryResultWritergetSupportedSettings in class QueryResultWriterBaseRioSettings that are supported by this
QueryResultWriter.public void handleNamespace(String prefix, String uri) throws QueryResultHandlerException
QueryResultWriterQueryResultWriter.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 QueryResultWriterprefix - The prefix to use for the namespaceuri - The full URI that is to be represented by the prefix.QueryResultHandlerExceptionCopyright © 2001–2015 Aduna. All rights reserved.