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 java.lang.Object implements QueryResultParser
Base class forQueryResultParsers offering common functionality for query result parsers.
-
-
Field Summary
Fields Modifier and Type Field Description private ParseErrorListenererrListenerAn optional ParseErrorListener to report parse errors to.protected QueryResultHandlerhandlerTheQueryResultHandlerthat will handle the parsed query results.private ParseLocationListenerlocationListenerAn optional ParseLocationListener to report parse progress in the form of line- and column numbers to.private ParserConfigparserConfigA collection of configuration options for this parser.protected ValueFactoryvalueFactoryTheValueFactoryto use for creating RDF model objects.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractQueryResultParser()Creates a new parser base that, by default, will use the global instance ofSimpleValueFactoryto create Value objects.protectedAbstractQueryResultParser(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 ParseErrorListenergetParseErrorListener()ParseLocationListenergetParseLocationListener()ParserConfiggetParserConfig()Retrieves the current parser configuration as a single object.java.util.Collection<RioSetting<?>>getSupportedSettings()<T> QueryResultParserset(RioSetting<T> setting, T value)Set a setting on the parser, and return this parser object to allow chaining.QueryResultParsersetParseErrorListener(ParseErrorListener el)Sets the ParseErrorListener that will be notified of any errors that this parser finds during parsing.QueryResultParsersetParseLocationListener(ParseLocationListener el)Sets the ParseLocationListener that will be notified of the parser's progress during the parse process.QueryResultParsersetParserConfig(ParserConfig config)Sets all supplied parser configuration options.QueryResultParsersetQueryResultHandler(QueryResultHandler handler)Sets theQueryResultHandlerto be used when parsing query results usingQueryResultParser.parseQueryResult(InputStream).QueryResultParsersetValueFactory(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
TheValueFactoryto use for creating RDF model objects.
-
handler
protected QueryResultHandler handler
TheQueryResultHandlerthat will handle the parsed query results.
-
parserConfig
private ParserConfig parserConfig
A collection of configuration options for this parser.
-
errListener
private ParseErrorListener errListener
An optional ParseErrorListener to report parse errors to.
-
locationListener
private ParseLocationListener locationListener
An optional ParseLocationListener to report parse progress in the form of line- and column numbers to.
-
-
Constructor Detail
-
AbstractQueryResultParser
protected AbstractQueryResultParser()
Creates a new parser base that, by default, will use the global instance ofSimpleValueFactoryto 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:QueryResultParserSets the ValueFactory that the parser will use to create Value objects for the parsed query result.- Specified by:
setValueFactoryin interfaceQueryResultParser- Parameters:
valueFactory- The value factory that the parser should use.
-
setQueryResultHandler
public QueryResultParser setQueryResultHandler(QueryResultHandler handler)
Description copied from interface:QueryResultParserSets theQueryResultHandlerto be used when parsing query results usingQueryResultParser.parseQueryResult(InputStream).- Specified by:
setQueryResultHandlerin interfaceQueryResultParser- Parameters:
handler- TheQueryResultHandlerto use for handling results.
-
setParserConfig
public QueryResultParser setParserConfig(ParserConfig config)
Description copied from interface:QueryResultParserSets all supplied parser configuration options.- Specified by:
setParserConfigin interfaceQueryResultParser- Parameters:
config- a parser configuration object.
-
getParserConfig
public ParserConfig getParserConfig()
Description copied from interface:QueryResultParserRetrieves the current parser configuration as a single object.- Specified by:
getParserConfigin interfaceQueryResultParser- Returns:
- a parser configuration object representing the current configuration of the parser.
-
setParseErrorListener
public QueryResultParser setParseErrorListener(ParseErrorListener el)
Description copied from interface:QueryResultParserSets the ParseErrorListener that will be notified of any errors that this parser finds during parsing.- Specified by:
setParseErrorListenerin 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:QueryResultParserSets the ParseLocationListener that will be notified of the parser's progress during the parse process.- Specified by:
setParseLocationListenerin 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 java.util.Collection<RioSetting<?>> getSupportedSettings()
- Specified by:
getSupportedSettingsin interfaceQueryResultParser- Returns:
- A collection of
RioSettings that are supported by this QueryResultParser.
-
set
public <T> QueryResultParser set(RioSetting<T> setting, T value)
Description copied from interface:QueryResultParserSet a setting on the parser, and return this parser object to allow chaining.- Specified by:
setin 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.
-
-