Package org.eclipse.rdf4j.query.resultio
Class AbstractQueryResultParser
- java.lang.Object
-
- org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser
-
- All Implemented Interfaces:
QueryResultParser
- Direct Known Subclasses:
AbstractSPARQLJSONParser
,AbstractSPARQLXMLParser
,AbstractTupleQueryResultParser
,BooleanTextParser
public abstract class AbstractQueryResultParser extends Object implements QueryResultParser
Base class forQueryResultParser
s offering common functionality for query result parsers.
-
-
Field Summary
Fields Modifier and Type Field Description protected QueryResultHandler
handler
TheQueryResultHandler
that will handle the parsed query results.protected ValueFactory
valueFactory
TheValueFactory
to use for creating RDF model objects.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractQueryResultParser()
Creates a new parser base that, by default, will use the global instance ofSimpleValueFactory
to create Value objects.protected
AbstractQueryResultParser(ValueFactory valueFactory)
Creates a new parser base that will use the supplied ValueFactory to create Value objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParseErrorListener
getParseErrorListener()
ParseLocationListener
getParseLocationListener()
ParserConfig
getParserConfig()
Retrieves the current parser configuration as a single object.Collection<RioSetting<?>>
getSupportedSettings()
<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 el)
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 theQueryResultHandler
to be used when parsing query results usingQueryResultParser.parseQueryResult(InputStream)
.QueryResultParser
setValueFactory(ValueFactory valueFactory)
Sets the ValueFactory that the parser will use to create Value objects for the parsed query result.-
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, parseQueryResult
-
-
-
-
Field Detail
-
valueFactory
protected ValueFactory valueFactory
TheValueFactory
to use for creating RDF model objects.
-
handler
protected QueryResultHandler handler
TheQueryResultHandler
that will handle the parsed query results.
-
-
Constructor Detail
-
AbstractQueryResultParser
protected AbstractQueryResultParser()
Creates a new parser base that, by default, will use the global instance ofSimpleValueFactory
to create Value objects.
-
AbstractQueryResultParser
protected AbstractQueryResultParser(ValueFactory valueFactory)
Creates a new parser base that will use the supplied ValueFactory to create Value objects.
-
-
Method Detail
-
setValueFactory
public QueryResultParser setValueFactory(ValueFactory valueFactory)
Description copied from interface:QueryResultParser
Sets the ValueFactory that the parser will use to create Value objects for the parsed query result.- Specified by:
setValueFactory
in interfaceQueryResultParser
- Parameters:
valueFactory
- The value factory that the parser should use.
-
setQueryResultHandler
public QueryResultParser setQueryResultHandler(QueryResultHandler handler)
Description copied from interface:QueryResultParser
Sets theQueryResultHandler
to be used when parsing query results usingQueryResultParser.parseQueryResult(InputStream)
.- Specified by:
setQueryResultHandler
in interfaceQueryResultParser
- Parameters:
handler
- TheQueryResultHandler
to use for handling results.
-
setParserConfig
public QueryResultParser setParserConfig(ParserConfig config)
Description copied from interface:QueryResultParser
Sets all supplied parser configuration options.- Specified by:
setParserConfig
in interfaceQueryResultParser
- Parameters:
config
- a parser configuration object.
-
getParserConfig
public ParserConfig getParserConfig()
Description copied from interface:QueryResultParser
Retrieves the current parser configuration as a single object.- Specified by:
getParserConfig
in interfaceQueryResultParser
- Returns:
- a parser configuration object representing the current configuration of the parser.
-
setParseErrorListener
public QueryResultParser setParseErrorListener(ParseErrorListener el)
Description copied from interface:QueryResultParser
Sets the ParseErrorListener that will be notified of any errors that this parser finds during parsing.- Specified by:
setParseErrorListener
in interfaceQueryResultParser
- 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.
-
getParseErrorListener
public ParseErrorListener getParseErrorListener()
-
setParseLocationListener
public QueryResultParser setParseLocationListener(ParseLocationListener el)
Description copied from interface:QueryResultParser
Sets the ParseLocationListener that will be notified of the parser's progress during the parse process.- Specified by:
setParseLocationListener
in interfaceQueryResultParser
- Parameters:
el
- 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.
-
getParseLocationListener
public ParseLocationListener getParseLocationListener()
-
getSupportedSettings
public Collection<RioSetting<?>> getSupportedSettings()
- Specified by:
getSupportedSettings
in interfaceQueryResultParser
- Returns:
- A collection of
RioSetting
s that are supported by this QueryResultParser.
-
set
public <T> QueryResultParser set(RioSetting<T> setting, T value)
Description copied from interface:QueryResultParser
Set a setting on the parser, and return this parser object to allow chaining.- Specified by:
set
in interfaceQueryResultParser
- 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.
-
-