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, SPARQLResultsJSONParser
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
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class AbstractQueryResultParser
handler, valueFactoryModifier and TypeFieldDescriptionprotected QueryResultHandlerTheQueryResultHandlerthat will handle the parsed query results.protected ValueFactoryTheValueFactoryto use for creating RDF model objects. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractSPARQLJSONParser(ValueFactory valueFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckTripleType(tools.jackson.core.JsonParser jp, String type) Collection<RioSetting<?>> voidParse the query results out of the givenInputStreaminto the handler setup usingQueryResultParser.setQueryResultHandler(QueryResultHandler).protected booleanparseQueryResultInternal(InputStream in, boolean attemptParseBoolean, boolean attemptParseTuple) protected TripleparseTripleValue(tools.jackson.core.JsonParser jp, String fieldName) protected ValueparseValue(tools.jackson.core.JsonParser jp, String bindingStr) Methods inherited from class AbstractQueryResultParser
getParseErrorListener, getParseLocationListener, getParserConfig, set, setParseErrorListener, setParseLocationListener, setParserConfig, setQueryResultHandler, setValueFactoryModifier and TypeMethodDescriptionRetrieves the current parser configuration as a single object.set(RioSetting<T> setting, T value) Set a setting on the parser, and return this parser object to allow chaining.Sets the ParseErrorListener that will be notified of any errors that this parser finds during parsing.Sets the ParseLocationListener that will be notified of the parser's progress during the parse process.setParserConfig(ParserConfig config) Sets all supplied parser configuration options.setQueryResultHandler(QueryResultHandler handler) Sets theQueryResultHandlerto be used when parsing query results usingQueryResultParser.parseQueryResult(InputStream).setValueFactory(ValueFactory valueFactory) Sets the ValueFactory that the parser will use to create Value objects for the parsed query result.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface QueryResultParser
getQueryResultFormatModifier and TypeMethodDescriptionGets the query result format that this parser can parse.
-
Field Details
-
HEAD
- See Also:
-
LINK
- See Also:
-
VARS
- See Also:
-
BOOLEAN
- See Also:
-
RESULTS
- See Also:
-
BINDINGS
- See Also:
-
TYPE
- See Also:
-
VALUE
- See Also:
-
XMLLANG
- See Also:
-
DATATYPE
- See Also:
-
LITERAL
- See Also:
-
TYPED_LITERAL
- See Also:
-
BNODE
- See Also:
-
URI
- See Also:
-
-
Constructor Details
-
AbstractSPARQLJSONParser
protected AbstractSPARQLJSONParser() -
AbstractSPARQLJSONParser
-
-
Method Details
-
parseQueryResult
public void parseQueryResult(InputStream in) throws IOException, QueryResultParseException, QueryResultHandlerException Description copied from interface:QueryResultParserParse the query results out of the givenInputStreaminto the handler setup usingQueryResultParser.setQueryResultHandler(QueryResultHandler).- Parameters:
in- TheInputStreamto 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 theQueryResultHandlerset inQueryResultParser.setQueryResultHandler(QueryResultHandler)throws an exception.
-
parseQueryResultInternal
protected boolean parseQueryResultInternal(InputStream in, boolean attemptParseBoolean, boolean attemptParseTuple) throws IOException, QueryResultParseException, QueryResultHandlerException -
parseValue
- Throws:
IOException
-
parseTripleValue
protected Triple parseTripleValue(tools.jackson.core.JsonParser jp, String fieldName) throws IOException - Throws:
IOException
-
checkTripleType
-
getSupportedSettings
- Specified by:
getSupportedSettingsin interfaceQueryResultParser- Overrides:
getSupportedSettingsin classAbstractQueryResultParser- Returns:
- A collection of
RioSettings that are supported by this QueryResultParser.
-