org.eclipse.rdf4j.query.resultio.sparqljson

## Class AbstractSPARQLJSONParser

- java.lang.Object
- - org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser
  - - org.eclipse.rdf4j.query.resultio.sparqljson.AbstractSPARQLJSONParser

- All Implemented Interfaces:
    QueryResultParser
  Direct Known Subclasses:
    SPARQLBooleanJSONParser, SPARQLJSONParserBase, SPARQLResultsJSONParser

      public abstract class AbstractSPARQLJSONParser
      extends AbstractQueryResultParser

  Abstract base class for SPARQL Results JSON Parsers. Provides a common implementation of both boolean and tuple parsing.
  Author:
    Peter Ansell, Sebastian Schaffert

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `BINDINGS`
    `static String` | `BNODE`
    `static String` | `BOOLEAN`
    `static String` | `DATATYPE`
    `static String` | `HEAD`
    `static String` | `LINK`
    `static String` | `LITERAL`
    `static String` | `RESULTS`
    `static String` | `TYPE`
    `static String` | `TYPED_LITERAL`
    `static String` | `URI`
    `static String` | `VALUE`
    `static String` | `VARS`
    `static String` | `XMLLANG`

    - ### Fields inherited from class org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser

      `handler, valueFactory`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractSPARQLJSONParser()`
    `protected` | `AbstractSPARQLJSONParser(ValueFactory valueFactory)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `checkTripleType(com.fasterxml.jackson.core.JsonParser jp, String type)`
    `Collection<RioSetting<?>>` | `getSupportedSettings()`
    `void` | `parseQueryResult(InputStream in)` Parse the query results out of the given `InputStream` into the handler setup using `QueryResultParser.setQueryResultHandler(QueryResultHandler)`.
    `protected boolean` | `parseQueryResultInternal(InputStream in, boolean attemptParseBoolean, boolean attemptParseTuple)`
    `protected Triple` | `parseTripleValue(com.fasterxml.jackson.core.JsonParser jp, String fieldName)`
    `protected Value` | `parseValue(com.fasterxml.jackson.core.JsonParser jp, String bindingStr)`

    - ### Methods inherited from class org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser

      `getParseErrorListener, getParseLocationListener, getParserConfig, set, setParseErrorListener, setParseLocationListener, setParserConfig, setQueryResultHandler, setValueFactory`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.query.resultio.QueryResultParser

      `getQueryResultFormat`

- - ### Field Detail

    - #### HEAD

          public static final String HEAD

      See Also:
        Constant Field Values

    - #### LINK

          public static final String LINK

      See Also:
        Constant Field Values

    - #### VARS

          public static final String VARS

      See Also:
        Constant Field Values

    - #### BOOLEAN

          public static final String BOOLEAN

      See Also:
        Constant Field Values

    - #### RESULTS

          public static final String RESULTS

      See Also:
        Constant Field Values

    - #### BINDINGS

          public static final String BINDINGS

      See Also:
        Constant Field Values

    - #### TYPE

          public static final String TYPE

      See Also:
        Constant Field Values

    - #### VALUE

          public static final String VALUE

      See Also:
        Constant Field Values

    - #### XMLLANG

          public static final String XMLLANG

      See Also:
        Constant Field Values

    - #### DATATYPE

          public static final String DATATYPE

      See Also:
        Constant Field Values

    - #### LITERAL

          public static final String LITERAL

      See Also:
        Constant Field Values

    - #### TYPED_LITERAL

          public static final String TYPED_LITERAL

      See Also:
        Constant Field Values

    - #### BNODE

          public static final String BNODE

      See Also:
        Constant Field Values

    - #### URI

          public static final String URI

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractSPARQLJSONParser

          protected AbstractSPARQLJSONParser()

    - #### AbstractSPARQLJSONParser

          protected AbstractSPARQLJSONParser(ValueFactory valueFactory)

  - ### Method Detail

    - #### parseQueryResult

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

      Description copied from interface: `QueryResultParser`
      Parse the query results out of the given `InputStream` into the handler setup using `QueryResultParser.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 `QueryResultParser.setQueryResultHandler(QueryResultHandler)` throws an exception.

    - #### parseQueryResultInternal

          protected boolean parseQueryResultInternal(InputStream in,
                                                     boolean attemptParseBoolean,
                                                     boolean attemptParseTuple)
                                              throws IOException,
                                                     QueryResultParseException,
                                                     QueryResultHandlerException

      Throws:
        `IOException`
        `QueryResultParseException`
        `QueryResultHandlerException`

    - #### parseValue

          protected Value parseValue(com.fasterxml.jackson.core.JsonParser jp,
                                     String bindingStr)
                              throws IOException

      Throws:
        `IOException`

    - #### parseTripleValue

          protected Triple parseTripleValue(com.fasterxml.jackson.core.JsonParser jp,
                                            String fieldName)
                                     throws IOException

      Throws:
        `IOException`

    - #### checkTripleType

          protected boolean checkTripleType(com.fasterxml.jackson.core.JsonParser jp,
                                            String type)

    - #### getSupportedSettings

          public Collection<RioSetting<?>> getSupportedSettings()

      Specified by:
        `getSupportedSettings` in interface `QueryResultParser`
      Overrides:
        `getSupportedSettings` in class `AbstractQueryResultParser`
      Returns:
        A collection of `RioSetting`s that are supported by this QueryResultParser.

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