org.eclipse.rdf4j.query.resultio

## Interface QueryResultParser

- All Known Subinterfaces:
    BooleanQueryResultParser, TupleQueryResultParser
  All Known Implementing Classes:
    AbstractQueryResultParser, AbstractSPARQLJSONParser, AbstractSPARQLXMLParser, AbstractTupleQueryResultParser, BinaryQueryResultParser, BooleanTextParser, QueryResultParserBase, SPARQLBooleanJSONParser, SPARQLBooleanXMLParser, SPARQLJSONParserBase, SPARQLResultsCSVParser, SPARQLResultsJSONParser, SPARQLResultsTSVParser, SPARQLResultsXMLParser, SPARQLStarResultsJSONParser, SPARQLStarResultsJSONParser, SPARQLStarResultsTSVParser, SPARQLStarResultsTSVParser, SPARQLStarResultsXMLParser, SPARQLXMLParserBase, TupleQueryResultParserBase

      public interface QueryResultParser

  Base interface for parsers of query results in both boolean and tuple forms.
  Author:
    Peter Ansell

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `ParserConfig` | `getParserConfig()` Retrieves the current parser configuration as a single object.
    `QueryResultFormat` | `getQueryResultFormat()` Gets the query result format that this parser can parse.
    `Collection<RioSetting<?>>` | `getSupportedSettings()`
    `void` | `parseQueryResult(InputStream in)` Parse the query results out of the given `InputStream` into the handler setup using `setQueryResultHandler(QueryResultHandler)`.
    `<T> QueryResultParser` | `set(RioSetting<T> setting, T value)` Set a setting on the parser, and return this parser object to allow chaining.
    `QueryResultParser` | `setParseErrorListener(ParseErrorListener el)` Sets the ParseErrorListener that will be notified of any errors that this parser finds during parsing.
    `QueryResultParser` | `setParseLocationListener(ParseLocationListener ll)` Sets the ParseLocationListener that will be notified of the parser's progress during the parse process.
    `QueryResultParser` | `setParserConfig(ParserConfig config)` Sets all supplied parser configuration options.
    `QueryResultParser` | `setQueryResultHandler(QueryResultHandler handler)` Sets the `QueryResultHandler` to be used when parsing query results using `parseQueryResult(InputStream)`.
    `QueryResultParser` | `setValueFactory(ValueFactory valueFactory)` Sets the ValueFactory that the parser will use to create Value objects for the parsed query result.

- - ### Method Detail

    - #### getQueryResultFormat

          QueryResultFormat getQueryResultFormat()

      Gets the query result format that this parser can parse.
      Returns:
        The `QueryResultFormat` supported by this parser.

    - #### setQueryResultHandler

          QueryResultParser setQueryResultHandler(QueryResultHandler handler)

      Sets the `QueryResultHandler` to be used when parsing query results using `parseQueryResult(InputStream)`.
      Parameters:
        `handler` - The `QueryResultHandler` to use for handling results.

    - #### setValueFactory

          QueryResultParser setValueFactory(ValueFactory valueFactory)

      Sets the ValueFactory that the parser will use to create Value objects for the parsed query result.
      Parameters:
        `valueFactory` - The value factory that the parser should use.

    - #### setParseErrorListener

          QueryResultParser setParseErrorListener(ParseErrorListener el)

      Sets the ParseErrorListener that will be notified of any errors that this parser finds during parsing.
      Parameters:
        `el` - The ParseErrorListener that will be notified of errors or warnings.
      Returns:
        Either a copy of this parser, if it is immutable, or this object, to allow chaining of method calls.

    - #### setParseLocationListener

          QueryResultParser setParseLocationListener(ParseLocationListener ll)

      Sets the ParseLocationListener that will be notified of the parser's progress during the parse process.
      Parameters:
        `ll` - The ParseLocationListener that will be notified of the parser's progress.
      Returns:
        Either a copy of this parser, if it is immutable, or this object, to allow chaining of method calls.

    - #### parseQueryResult

          void parseQueryResult(InputStream in)
                         throws IOException,
                                QueryResultParseException,
                                QueryResultHandlerException

      Parse the query results out of the given `InputStream` into the handler setup using `setQueryResultHandler(QueryResultHandler)`.
      Parameters:
        `in` - The `InputStream` to parse the results from.
      Throws:
        `IOException` - If there is an exception from the InputStream.
        `QueryResultParseException` - If the query results are not parsable by this parser.
        `QueryResultHandlerException` - If the `QueryResultHandler` set in `setQueryResultHandler(QueryResultHandler)` throws an exception.

    - #### setParserConfig

          QueryResultParser setParserConfig(ParserConfig config)

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

    - #### getParserConfig

          ParserConfig getParserConfig()

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

    - #### getSupportedSettings

          Collection<RioSetting<?>> getSupportedSettings()

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

    - #### set

          <T> QueryResultParser set(RioSetting<T> setting,
                                    T value)

      Set a setting on the parser, and return this parser object to allow chaining.
      Parameters:
        `setting` - The setting to change.
        `value` - The value to change.
      Returns:
        Either a copy of this parser, if it is immutable, or this object, to allow chaining of method calls.

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.