public interface RDFParser
Modifier and Type | Interface and Description |
---|---|
static class |
RDFParser.DatatypeHandling
Deprecated.
These settings are not recognised and will be removed in a future version. Use
BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES
BasicParserSettings.NORMALIZE_DATATYPE_VALUES and
BasicParserSettings.VERIFY_DATATYPE_VALUES instead. |
Modifier and Type | Method and Description |
---|---|
ParserConfig |
getParserConfig()
Retrieves the current parser configuration as a single object.
|
RDFFormat |
getRDFFormat()
Gets the RDF format that this parser can parse.
|
Collection<RioSetting<?>> |
getSupportedSettings() |
default void |
parse(InputStream in)
Parses the data from the supplied InputStream.
|
void |
parse(InputStream in,
String baseURI)
Parses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.
|
default void |
parse(Reader reader)
Parses the data from the supplied Reader.
|
void |
parse(Reader reader,
String baseURI)
Parses the data from the supplied Reader, using the supplied baseURI to resolve any relative URI references.
|
<T> RDFParser |
set(RioSetting<T> setting,
T value)
Set a setting on the parser, and return this parser object to allow chaining.
|
void |
setDatatypeHandling(RDFParser.DatatypeHandling datatypeHandling)
Deprecated.
since 2.0. Use
getParserConfig() with BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES ,
BasicParserSettings.VERIFY_DATATYPE_VALUES , and/or
BasicParserSettings.NORMALIZE_DATATYPE_VALUES instead. |
RDFParser |
setParseErrorListener(ParseErrorListener el)
Sets the ParseErrorListener that will be notified of any errors that this parser finds during parsing.
|
RDFParser |
setParseLocationListener(ParseLocationListener ll)
Sets the ParseLocationListener that will be notified of the parser's progress during the parse process.
|
RDFParser |
setParserConfig(ParserConfig config)
Sets all supplied parser configuration options.
|
void |
setPreserveBNodeIDs(boolean preserveBNodeIDs)
Set whether the parser should preserve bnode identifiers specified in the source (default is false).
|
RDFParser |
setRDFHandler(RDFHandler handler)
Sets the RDFHandler that will handle the parsed RDF data.
|
void |
setStopAtFirstError(boolean stopAtFirstError)
Deprecated.
since 2.0. Use
getParserConfig() with ParserConfig.addNonFatalError(RioSetting) to
select which errors will not always fail the parse prematurely. |
RDFParser |
setValueFactory(ValueFactory valueFactory)
Sets the ValueFactory that the parser will use to create Value objects for the parsed RDF data.
|
void |
setVerifyData(boolean verifyData)
Deprecated.
since 2.0. Use
getParserConfig() with BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES ,
BasicParserSettings.VERIFY_DATATYPE_VALUES , and/or
BasicParserSettings.NORMALIZE_DATATYPE_VALUES instead. |
RDFFormat getRDFFormat()
RDFParser setValueFactory(ValueFactory valueFactory)
valueFactory
- The value factory that the parser should use.RDFParser setRDFHandler(RDFHandler handler)
handler
- The RDFHandler to handle the parsed data.RDFParser setParseErrorListener(ParseErrorListener el)
el
- The ParseErrorListener that will be notified of errors or warnings.RDFParser setParseLocationListener(ParseLocationListener ll)
ll
- The ParseLocationListener that will be notified of the parser's progress.RDFParser setParserConfig(ParserConfig config)
config
- a parser configuration object.ParserConfig getParserConfig()
Collection<RioSetting<?>> getSupportedSettings()
RioSetting
s that are supported by this RDFParser.<T> RDFParser set(RioSetting<T> setting, T value)
setting
- The setting to change.value
- The value to change.@Deprecated void setVerifyData(boolean verifyData)
getParserConfig()
with BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES
,
BasicParserSettings.VERIFY_DATATYPE_VALUES
, and/or
BasicParserSettings.NORMALIZE_DATATYPE_VALUES
instead.void setPreserveBNodeIDs(boolean preserveBNodeIDs)
@Deprecated void setStopAtFirstError(boolean stopAtFirstError)
getParserConfig()
with ParserConfig.addNonFatalError(RioSetting)
to
select which errors will not always fail the parse prematurely.@Deprecated void setDatatypeHandling(RDFParser.DatatypeHandling datatypeHandling)
getParserConfig()
with BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES
,
BasicParserSettings.VERIFY_DATATYPE_VALUES
, and/or
BasicParserSettings.NORMALIZE_DATATYPE_VALUES
instead.datatypeHandling
- A datatype handling option.default void parse(InputStream in) throws IOException, RDFParseException, RDFHandlerException
in
- The InputStream from which to read the data.IOException
- If an I/O error occurred while data was read from the InputStream.RDFParseException
- If the parser has found an unrecoverable parse error.RDFHandlerException
- If the configured statement handler has encountered an unrecoverable error.void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException
in
- The InputStream from which to read the data.baseURI
- The URI associated with the data in the InputStream. May be null
. Parsers for syntax
formats that do not support relative URIs will ignore this argument.
Note that if the data contains an embedded base URI, that embedded base URI will overrule the value supplied here (see RFC 3986 section 5.1 for details).
IOException
- If an I/O error occurred while data was read from the InputStream.RDFParseException
- If the parser has found an unrecoverable parse error.RDFHandlerException
- If the configured statement handler has encountered an unrecoverable error.default void parse(Reader reader) throws IOException, RDFParseException, RDFHandlerException
reader
- The Reader from which to read the data.IOException
- If an I/O error occurred while data was read from the InputStream.RDFParseException
- If the parser has found an unrecoverable parse error.RDFHandlerException
- If the configured statement handler has encountered an unrecoverable error.void parse(Reader reader, String baseURI) throws IOException, RDFParseException, RDFHandlerException
reader
- The Reader from which to read the data.baseURI
- The URI associated with the data in the InputStream. May be null
. Parsers for syntax
formats that do not support relative URIs will ignore this argument.
Note that if the data contains an embedded base URI, that embedded base URI will overrule the value supplied here (see RFC 3986 section 5.1 for details).
IOException
- If an I/O error occurred while data was read from the InputStream.RDFParseException
- If the parser has found an unrecoverable parse error.RDFHandlerException
- If the configured statement handler has encountered an unrecoverable error.Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.