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 QueryResultParserBase interface for parsers of query results in both boolean and tuple forms.- Author:
- Peter Ansell
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ParserConfiggetParserConfig()Retrieves the current parser configuration as a single object.QueryResultFormatgetQueryResultFormat()Gets the query result format that this parser can parse.Collection<RioSetting<?>>getSupportedSettings()voidparseQueryResult(InputStream in)Parse the query results out of the givenInputStreaminto the handler setup usingsetQueryResultHandler(QueryResultHandler).<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 ll)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 usingparseQueryResult(InputStream).QueryResultParsersetValueFactory(ValueFactory valueFactory)Sets the ValueFactory that the parser will use to create Value objects for the parsed query result.
-
-
-
Method Detail
-
getQueryResultFormat
QueryResultFormat getQueryResultFormat()
Gets the query result format that this parser can parse.- Returns:
- The
QueryResultFormatsupported by this parser.
-
setQueryResultHandler
QueryResultParser setQueryResultHandler(QueryResultHandler handler)
Sets theQueryResultHandlerto be used when parsing query results usingparseQueryResult(InputStream).- Parameters:
handler- TheQueryResultHandlerto use for handling results.
-
setValueFactory
QueryResultParser setValueFactory(ValueFactory valueFactory)
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
QueryResultParser setParseErrorListener(ParseErrorListener el)
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
QueryResultParser setParseLocationListener(ParseLocationListener ll)
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 givenInputStreaminto the handler setup usingsetQueryResultHandler(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 insetQueryResultHandler(QueryResultHandler)throws an exception.
-
setParserConfig
QueryResultParser setParserConfig(ParserConfig config)
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
RioSettings that are supported by this QueryResultParser.
-
set
<T> QueryResultParser set(RioSetting<T> setting, T value)
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.
-
-