public class ParserConfig extends RioConfig implements Serializable
RDFParser
configuration options.log, settings, systemPropertyCache
Constructor and Description |
---|
ParserConfig()
Creates a ParserConfig object starting with default settings.
|
ParserConfig(boolean verifyData,
boolean stopAtFirstError,
boolean preserveBNodeIDs,
RDFParser.DatatypeHandling datatypeHandling)
Deprecated.
Use
ParserConfig() instead and set preserveBNodeIDs using
set(RioSetting, Object) with BasicParserSettings.PRESERVE_BNODE_IDS .
The other parameters are all deprecated and this constructor may be removed in a future release. This constructor calls #setNonFatalErrors using a best-effort algorithm that may not match the exact semantics of the pre-2.7 constructor. |
Modifier and Type | Method and Description |
---|---|
ParserConfig |
addNonFatalError(RioSetting<?> nextNonFatalError)
Add a non-fatal error to the set used by parsers to determine whether they should attempt to recover from a
particular parsing error.
|
RDFParser.DatatypeHandling |
datatypeHandling()
Deprecated.
Datatype handling is now split across
BasicParserSettings.VERIFY_DATATYPE_VALUES ,
BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES and
BasicParserSettings.NORMALIZE_DATATYPE_VALUES .
This method will be removed in a future release. |
Set<RioSetting<?>> |
getNonFatalErrors()
Get the current set of non-fatal errors.
|
boolean |
isNonFatalError(RioSetting<?> errorToCheck)
This method is used by the parser to check whether they should throw an exception or attempt to recover from a
non-fatal error.
|
boolean |
isPreserveBNodeIDs()
This method is preserved for backwards compatibility.
|
<T> ParserConfig |
set(RioSetting<T> setting,
T value)
Sets a
RioSetting to have a new value. |
ParserConfig |
setNonFatalErrors(Set<RioSetting<?>> nonFatalErrors)
This method indicates a list of optional errors that the parser should attempt to recover from.
|
boolean |
stopAtFirstError()
Deprecated.
All non-fatal errors must be specified using
setNonFatalErrors(Set) or
addNonFatalError(RioSetting) and checked using isNonFatalError(RioSetting) . |
ParserConfig |
useDefaults()
Resets all settings back to their default values.
|
boolean |
verifyData()
Deprecated.
All non-fatal verification errors must be specified using
addNonFatalError(RioSetting) and
checked using isNonFatalError(RioSetting) . |
public ParserConfig()
@Deprecated public ParserConfig(boolean verifyData, boolean stopAtFirstError, boolean preserveBNodeIDs, RDFParser.DatatypeHandling datatypeHandling)
ParserConfig()
instead and set preserveBNodeIDs using
set(RioSetting, Object)
with BasicParserSettings.PRESERVE_BNODE_IDS
.
The other parameters are all deprecated and this constructor may be removed in a future release.
This constructor calls #setNonFatalErrors using a best-effort algorithm that may not match the exact semantics of the pre-2.7 constructor.
public ParserConfig setNonFatalErrors(Set<RioSetting<?>> nonFatalErrors)
If recovery is not possible, then the parser will still abort with an exception.
Calls to this method will override previous calls, including the backwards-compatibility settings setup in the deprecated constructor.
Non-Fatal errors that are detected MUST be reported to the error listener.
nonFatalErrors
- The set of parser errors that are relevant topublic ParserConfig addNonFatalError(RioSetting<?> nextNonFatalError)
nextNonFatalError
- A non-fatal error that a parser should attempt to recover from.public boolean isNonFatalError(RioSetting<?> errorToCheck)
If this method returns false, then the given non-fatal error will cause the parser to throw an exception.
If this method returns true, then the parser will do its best to recover from the error, potentially by dropping triples or creating triples that do not exactly match the source.
By default this method will always return false until setNonFatalErrors(Set)
is called to specify the
set of errors that are non-fatal in the given context.
Non-Fatal errors that are detected MUST be reported to the error listener.
errorToCheck
- public Set<RioSetting<?>> getNonFatalErrors()
@Deprecated public boolean verifyData()
addNonFatalError(RioSetting)
and
checked using isNonFatalError(RioSetting)
.@Deprecated public boolean stopAtFirstError()
setNonFatalErrors(Set)
or
addNonFatalError(RioSetting)
and checked using isNonFatalError(RioSetting)
.public boolean isPreserveBNodeIDs()
Code should be gradually migrated to use BasicParserSettings.PRESERVE_BNODE_IDS
.
BasicParserSettings.PRESERVE_BNODE_IDS
setting.@Deprecated public RDFParser.DatatypeHandling datatypeHandling()
BasicParserSettings.VERIFY_DATATYPE_VALUES
,
BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES
and
BasicParserSettings.NORMALIZE_DATATYPE_VALUES
.
This method will be removed in a future release.
public ParserConfig useDefaults()
RioConfig
useDefaults
in class RioConfig
public <T> ParserConfig set(RioSetting<T> setting, T value)
RioConfig
RioSetting
to have a new value. If the value is null, the parser setting is removed and the
default will be used instead.set
in class RioConfig
setting
- The setting to set a new value for.value
- The value for the parser setting, or null to reset the parser setting to use the default value.Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.