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
Abstract base class for SPARQL Results JSON Parsers. Provides a common implementation of both boolean and tuple
parsing.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
private static final String
Backwards compatibility with very early version of original SPARQL spec.static final String
static final String
static final String
private final org.slf4j.Logger
private static final String
Backwards compatibility with very early version of original SPARQL spec.static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser
handler, valueFactory
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
protected
AbstractSPARQLJSONParser
(ValueFactory valueFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkTripleType
(com.fasterxml.jackson.core.JsonParser jp, String type) private com.fasterxml.jackson.core.JsonFactory
Get an instance of JsonFactory configured using the settings fromAbstractQueryResultParser.getParserConfig()
.Collection
<RioSetting<?>> void
Parse the query results out of the givenInputStream
into the handler setup usingQueryResultParser.setQueryResultHandler(QueryResultHandler)
.protected boolean
parseQueryResultInternal
(InputStream in, boolean attemptParseBoolean, boolean attemptParseTuple) private Triple
parseStardogTripleValue
(com.fasterxml.jackson.core.JsonParser jp, String fieldName) protected Triple
parseTripleValue
(com.fasterxml.jackson.core.JsonParser jp, String fieldName) protected Value
parseValue
(com.fasterxml.jackson.core.JsonParser jp, String bindingStr) private Value
parseValue
(String type, String value, String language, String datatype) Parse a value out of the elements for a binding.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 Details
-
logger
private final org.slf4j.Logger logger -
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:
-
DISTINCT
Backwards compatibility with very early version of original SPARQL spec.- See Also:
-
ORDERED
Backwards compatibility with very early version of original SPARQL spec.- See Also:
-
-
Constructor Details
-
AbstractSPARQLJSONParser
protected AbstractSPARQLJSONParser() -
AbstractSPARQLJSONParser
-
-
Method Details
-
parseQueryResult
public void parseQueryResult(InputStream in) throws IOException, QueryResultParseException, QueryResultHandlerException Description copied from interface:QueryResultParser
Parse the query results out of the givenInputStream
into the handler setup usingQueryResultParser.setQueryResultHandler(QueryResultHandler)
.- Parameters:
in
- TheInputStream
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 theQueryResultHandler
set inQueryResultParser.setQueryResultHandler(QueryResultHandler)
throws an exception.
-
parseQueryResultInternal
protected boolean parseQueryResultInternal(InputStream in, boolean attemptParseBoolean, boolean attemptParseTuple) throws IOException, QueryResultParseException, QueryResultHandlerException -
parseValue
protected Value parseValue(com.fasterxml.jackson.core.JsonParser jp, String bindingStr) throws IOException - Throws:
IOException
-
parseStardogTripleValue
private Triple parseStardogTripleValue(com.fasterxml.jackson.core.JsonParser jp, String fieldName) throws IOException - Throws:
IOException
-
parseTripleValue
protected Triple parseTripleValue(com.fasterxml.jackson.core.JsonParser jp, String fieldName) throws IOException - Throws:
IOException
-
checkTripleType
-
parseValue
Parse a value out of the elements for a binding.- Parameters:
type
-LITERAL
,TYPED_LITERAL
,BNODE
orURI
value
- actual value textlanguage
- language tag, if applicabledatatype
- datatype tag, if applicable- Returns:
- the value corresponding to the given parameters
-
getSupportedSettings
- Specified by:
getSupportedSettings
in interfaceQueryResultParser
- Overrides:
getSupportedSettings
in classAbstractQueryResultParser
- Returns:
- A collection of
RioSetting
s that are supported by this QueryResultParser.
-
configureNewJsonFactory
private com.fasterxml.jackson.core.JsonFactory configureNewJsonFactory()Get an instance of JsonFactory configured using the settings fromAbstractQueryResultParser.getParserConfig()
.- Returns:
- A newly configured JsonFactory based on the currently enabled settings
-