Package org.eclipse.rdf4j.query.resultio

## Interface QueryResultWriter

- All Superinterfaces:
    `QueryResultHandler`
  All Known Subinterfaces:
    `BooleanQueryResultWriter`, `TupleQueryResultWriter`
  All Known Implementing Classes:
    `AbstractQueryResultWriter`, `BinaryQueryResultWriter`, `BooleanTextWriter`, `ConsoleQueryResultWriter`, `SPARQLBooleanJSONWriter`, `SPARQLBooleanXMLWriter`, `SPARQLResultsCSVWriter`, `SPARQLResultsJSONWriter`, `SPARQLResultsTSVWriter`, `SPARQLResultsXMLWriter`, `SPARQLStarResultsJSONWriter`, `SPARQLStarResultsJSONWriter`, `SPARQLStarResultsTSVWriter`, `SPARQLStarResultsTSVWriter`, `SPARQLStarResultsXMLWriter`

      public interface QueryResultWriter
      extends QueryResultHandler

  The base interface for writers of query results sets and boolean results.
  Author:
    Peter Ansell

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `endHeader()` | Indicates the end of the header.
    `QueryResultFormat` | `getQueryResultFormat()` | Gets the query result format that this writer uses.
    `Collection<RioSetting<?>>` | `getSupportedSettings()` |
    `WriterConfig` | `getWriterConfig()` | Retrieves the current writer configuration as a single object.
    `void` | `handleNamespace​(String prefix, String uri)` | Handles a namespace prefix declaration.
    `void` | `handleStylesheet​(String stylesheetUrl)` | Handles a stylesheet URL.
    `void` | `setWriterConfig​(WriterConfig config)` | Sets all supplied writer configuration options.
    `void` | `startDocument()` | Indicates the start of the document.
    `void` | `startHeader()` | Indicates the start of the header.

    - ### Methods inherited from interface org.eclipse.rdf4j.query.QueryResultHandler

      `endQueryResult, handleBoolean, handleLinks, handleSolution, startQueryResult`

- - ### Method Detail

    - #### getQueryResultFormat

          QueryResultFormat getQueryResultFormat()

      Gets the query result format that this writer uses.

    - #### handleNamespace

          void handleNamespace​(String prefix,
                               String uri)
                        throws QueryResultHandlerException

      Handles a namespace prefix declaration. If this is called, it should be called before `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.

      Parameters:
        `prefix` - The prefix to use for the namespace
        `uri` - The full URI that is to be represented by the prefix.
      Throws:
        `QueryResultHandlerException`

    - #### startDocument

          void startDocument()
                      throws QueryResultHandlerException

      Indicates the start of the document.
      Throws:
        `QueryResultHandlerException` - If there was an error starting the writing of the results.

    - #### handleStylesheet

          void handleStylesheet​(String stylesheetUrl)
                         throws QueryResultHandlerException

      Handles a stylesheet URL. If this is called, it must be called after `startDocument()` and before `startHeader()`.

      NOTE: If the format does not support stylesheets, it must silently ignore calls to this method.

      Parameters:
        `stylesheetUrl` - The URL of the stylesheet to be used to style the results.
      Throws:
        `QueryResultHandlerException` - If there was an error handling the stylesheet. This error is not thrown in cases where stylesheets are not supported.

    - #### startHeader

          void startHeader()
                    throws QueryResultHandlerException

      Indicates the start of the header.
      Throws:
        `QueryResultHandlerException` - If there was an error writing the start of the header.
      See Also:
        SPARQL Query Results XML Format documentation for head element.

    - #### endHeader

          void endHeader()
                  throws QueryResultHandlerException

      Indicates the end of the header. This must be called after `startHeader()` and before any calls to `QueryResultHandler.handleSolution(org.eclipse.rdf4j.query.BindingSet)`.
      Throws:
        `QueryResultHandlerException` - If there was an error writing the end of the header.

    - #### setWriterConfig

          void setWriterConfig​(WriterConfig config)

      Sets all supplied writer configuration options.
      Parameters:
        `config` - a writer configuration object.

    - #### getWriterConfig

          WriterConfig getWriterConfig()

      Retrieves the current writer configuration as a single object.
      Returns:
        a writer configuration object representing the current configuration of the writer.

    - #### getSupportedSettings

          Collection<RioSetting<?>> getSupportedSettings()

      Returns:
        A collection of `RioSetting`s that are supported by this `QueryResultWriter`.