Package org.eclipse.rdf4j.query.resultio
Interface QueryResultParser
- All Known Subinterfaces:
BooleanQueryResultParser
,TupleQueryResultParser
- All Known Implementing Classes:
AbstractQueryResultParser
,AbstractSPARQLJSONParser
,AbstractSPARQLXMLParser
,AbstractTupleQueryResultParser
,BinaryQueryResultParser
,BooleanTextParser
,SPARQLBooleanJSONParser
,SPARQLBooleanXMLParser
,SPARQLResultsCSVParser
,SPARQLResultsJSONParser
,SPARQLResultsTSVParser
,SPARQLResultsXMLParser
,SPARQLStarResultsJSONParser
,SPARQLStarResultsTSVParser
,SPARQLStarResultsXMLParser
public interface QueryResultParser
Base interface for parsers of query results in both boolean and tuple forms.
- Author:
- Peter Ansell
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the current parser configuration as a single object.Gets the query result format that this parser can parse.Collection
<RioSetting<?>> void
Parse the query results out of the givenInputStream
into the handler setup usingsetQueryResultHandler(QueryResultHandler)
.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 theQueryResultHandler
to be used when parsing query results usingparseQueryResult(InputStream)
.setValueFactory
(ValueFactory valueFactory) Sets the ValueFactory that the parser will use to create Value objects for the parsed query result.
-
Method Details
-
getQueryResultFormat
QueryResultFormat getQueryResultFormat()Gets the query result format that this parser can parse.- Returns:
- The
QueryResultFormat
supported by this parser.
-
setQueryResultHandler
Sets theQueryResultHandler
to be used when parsing query results usingparseQueryResult(InputStream)
.- Parameters:
handler
- TheQueryResultHandler
to use for handling results.
-
setValueFactory
Sets the ValueFactory that the parser will use to create Value objects for the parsed query result.- Parameters:
valueFactory
- The value factory that the parser should use.
-
setParseErrorListener
Sets the ParseErrorListener that will be notified of any errors that this parser finds during parsing.- 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.
-
setParseLocationListener
Sets the ParseLocationListener that will be notified of the parser's progress during the parse process.- Parameters:
ll
- 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.
-
parseQueryResult
void parseQueryResult(InputStream in) throws IOException, QueryResultParseException, QueryResultHandlerException Parse the query results out of the givenInputStream
into the handler setup usingsetQueryResultHandler(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 insetQueryResultHandler(QueryResultHandler)
throws an exception.
-
setParserConfig
Sets all supplied parser configuration options.- Parameters:
config
- a parser configuration object.
-
getParserConfig
ParserConfig getParserConfig()Retrieves the current parser configuration as a single object.- Returns:
- a parser configuration object representing the current configuration of the parser.
-
getSupportedSettings
Collection<RioSetting<?>> getSupportedSettings()- Returns:
- A collection of
RioSetting
s that are supported by this QueryResultParser.
-
set
Set a setting on the parser, and return this parser object to allow chaining.- 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.
-