Class SPARQLResultsTSVWriter
java.lang.Object
org.eclipse.rdf4j.query.resultio.AbstractQueryResultWriter
org.eclipse.rdf4j.query.resultio.text.tsv.SPARQLResultsTSVWriter
- All Implemented Interfaces:
CharSink,Sink,QueryResultHandler,QueryResultWriter,TupleQueryResultWriter,TupleQueryResultHandler
- Direct Known Subclasses:
SPARQLStarResultsTSVWriter
public class SPARQLResultsTSVWriter
extends AbstractQueryResultWriter
implements TupleQueryResultWriter, CharSink
TupleQueryResultWriter for the SPARQL TSV (Tab-Separated Values) format.
- Author:
- Jeen Broekstra
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidIndicates the end of the header.voidIndicates the end of a sequence of solutions.final TupleQueryResultFormatGets the query result format that this writer uses.Gets the query result format that this writer uses.voidhandleBoolean(boolean value) Handles the specified boolean value.voidhandleLinks(List<String> linkUrls) Handles the links elements which are present in SPARQL Results JSON and SPARQL Results XML documents in the header.voidhandleNamespace(String prefix, String uri) Handles a namespace prefix declaration.protected voidhandleSolutionImpl(BindingSet bindingSet) Extending classes must implement this method instead of overridingAbstractQueryResultWriter.handleSolution(BindingSet)in order to benefit from automatic handling of RDF-star encoding.voidhandleStylesheet(String stylesheetUrl) Handles a stylesheet URL.voidIndicates the start of the document.voidIndicates the start of the header.voidstartQueryResult(List<String> bindingNames) Indicates the start of a sequence of Solutions.protected voidwriteBNode(BNode bNode) protected voidwriteResource(Resource res) protected voidprotected voidwriteValue(Value val) Methods inherited from class org.eclipse.rdf4j.query.resultio.AbstractQueryResultWriter
getFileFormat, getSupportedSettings, getWriterConfig, handleSolution, setWriterConfig, xsdStringToPlainLiteralMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.rdf4j.query.QueryResultHandler
handleSolutionMethods inherited from interface org.eclipse.rdf4j.query.resultio.QueryResultWriter
getSupportedSettings, getWriterConfig, setWriterConfigMethods inherited from interface org.eclipse.rdf4j.common.io.Sink
acceptsFileFormat, getFileFormat
-
Field Details
-
writer
-
tupleVariablesFound
protected boolean tupleVariablesFound
-
-
Constructor Details
-
SPARQLResultsTSVWriter
- Parameters:
out-
-
SPARQLResultsTSVWriter
-
-
Method Details
-
getWriter
Description copied from interface:CharSink -
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- Overrides:
startQueryResultin classAbstractQueryResultWriter- 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.
-
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.
-
handleSolutionImpl
Description copied from class:AbstractQueryResultWriterExtending classes must implement this method instead of overridingAbstractQueryResultWriter.handleSolution(BindingSet)in order to benefit from automatic handling of RDF-star encoding.- Overrides:
handleSolutionImplin classAbstractQueryResultWriter- Parameters:
bindingSet- the solution to handle- Throws:
TupleQueryResultHandlerException
-
getTupleQueryResultFormat
Description copied from interface:TupleQueryResultWriterGets the query result format that this writer uses.- Specified by:
getTupleQueryResultFormatin interfaceTupleQueryResultWriter
-
getQueryResultFormat
Description copied from interface:QueryResultWriterGets the query result format that this writer uses.- Specified by:
getQueryResultFormatin interfaceQueryResultWriter
-
writeValue
- Throws:
IOException
-
writeResource
- Throws:
IOException
-
writeURI
- Throws:
IOException
-
writeBNode
- Throws:
IOException
-
startDocument
Description copied from interface:QueryResultWriterIndicates the start of the document.- Specified by:
startDocumentin interfaceQueryResultWriter- Throws:
TupleQueryResultHandlerException
-
handleStylesheet
Description copied from interface:QueryResultWriterHandles a stylesheet URL. If this is called, it must be called afterQueryResultWriter.startDocument()and beforeQueryResultWriter.startHeader().NOTE: If the format does not support stylesheets, it must silently ignore calls to this method.
- Specified by:
handleStylesheetin interfaceQueryResultWriter- Parameters:
stylesheetUrl- The URL of the stylesheet to be used to style the results.- Throws:
TupleQueryResultHandlerException
-
startHeader
Description copied from interface:QueryResultWriterIndicates the start of the header.- Specified by:
startHeaderin interfaceQueryResultWriter- Throws:
TupleQueryResultHandlerException- See Also:
-
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:
TupleQueryResultHandlerException- See Also:
-
endHeader
Description copied from interface:QueryResultWriterIndicates the end of the header. This must be called afterQueryResultWriter.startHeader()and before any calls toQueryResultHandler.handleSolution(org.eclipse.rdf4j.query.BindingSet).- Specified by:
endHeaderin interfaceQueryResultWriter- Throws:
TupleQueryResultHandlerException
-
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.
-
handleNamespace
Description copied from interface:QueryResultWriterHandles a namespace prefix declaration. If this is called, it should be called beforeQueryResultWriter.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.
- Specified by:
handleNamespacein interfaceQueryResultWriter- Parameters:
prefix- The prefix to use for the namespaceuri- The full URI that is to be represented by the prefix.- Throws:
QueryResultHandlerException
-