public abstract class AbstractRDFParser extends Object implements org.openrdf.rio.RDFParser
RDFParsers offering common functionality for RDF
parsers.| Modifier and Type | Field and Description |
|---|---|
protected info.aduna.net.ParsedURI |
baseURI
The base URI for resolving relative URIs.
|
protected Map<String,String> |
namespaceTable
Mapping from namespace prefixes to namespace names.
|
protected org.openrdf.rio.RDFHandler |
rdfHandler
The RDFHandler that will handle the parsed RDF.
|
protected StardogValueFactory |
valueFactory
The ValueFactory to use for creating RDF model objects.
|
| Constructor and Description |
|---|
AbstractRDFParser()
Creates a new RDFParserBase that will use a
SimpleValueFactory to
create RDF model objects. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
clear()
Clears any information that has been collected while parsing.
|
protected void |
clearBNodeIDMap()
Deprecated.
Map is no longer used.
|
protected org.openrdf.model.BNode |
createBNode()
Creates a new
BNode object. |
protected org.openrdf.model.BNode |
createBNode(String nodeID)
Creates a
BNode object for the specified identifier. |
protected org.openrdf.model.Literal |
createLiteral(String label,
String lang,
org.openrdf.model.IRI datatype,
int lineNo,
int columnNo)
Creates a
Literal object with the supplied parameters, using the
lineNo and columnNo to enhance error messages or exceptions that may be
generated during the creation of the literal. |
protected org.openrdf.model.Statement |
createStatement(org.openrdf.model.Resource subj,
org.openrdf.model.IRI pred,
org.openrdf.model.Value obj)
Creates a new
Statement object with the supplied components. |
protected org.openrdf.model.Statement |
createStatement(org.openrdf.model.Resource subj,
org.openrdf.model.IRI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource context)
Creates a new
Statement object with the supplied components. |
protected org.openrdf.model.IRI |
createURI(String uri)
Creates a
IRI object for the specified URI-string. |
protected org.openrdf.model.IRI |
createURI(String namespace,
String localName)
Creates a
IRI object for the specified namespace and localname. |
org.openrdf.rio.RDFParser.DatatypeHandling |
datatypeHandling()
Deprecated.
Use
BasicParserSettings.VERIFY_DATATYPE_VALUES and
BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES and
BasicParserSettings.NORMALIZE_DATATYPE_VALUES instead. |
protected String |
getNamespace(String prefix)
Gets the namespace that is associated with the specified prefix or throws
an
RDFParseException. |
org.openrdf.rio.ParseErrorListener |
getParseErrorListener() |
org.openrdf.rio.ParseLocationListener |
getParseLocationListener() |
org.openrdf.rio.ParserConfig |
getParserConfig() |
org.openrdf.rio.RDFHandler |
getRDFHandler() |
Collection<org.openrdf.rio.RioSetting<?>> |
getSupportedSettings() |
protected void |
initConfigParams() |
protected void |
initializeNamespaceTableFromConfiguration() |
boolean |
preserveBNodeIDs() |
protected void |
reportError(Exception e,
int lineNo,
int columnNo,
org.openrdf.rio.RioSetting<Boolean> relevantSetting)
Reports an error with associated line- and column number to the registered
ParseErrorListener, if the given setting has been set to true.
|
protected void |
reportError(String msg,
int lineNo,
int columnNo,
org.openrdf.rio.RioSetting<Boolean> relevantSetting)
Reports an error with associated line- and column number to the registered
ParseErrorListener, if the given setting has been set to true.
|
protected void |
reportError(String msg,
org.openrdf.rio.RioSetting<Boolean> relevantSetting)
Reports an error with associated line- and column number to the registered
ParseErrorListener, if the given setting has been set to true.
|
protected void |
reportFatalError(Exception e)
Reports a fatal error to the registered ParseErrorListener, if any, and
throws a ParseException afterwards.
|
protected void |
reportFatalError(Exception e,
int lineNo,
int columnNo)
Reports a fatal error with associated line- and column number to the
registered ParseErrorListener, if any, and throws a
ParseException wrapped the supplied exception afterwards.
|
protected void |
reportFatalError(String msg)
Reports a fatal error to the registered ParseErrorListener, if any, and
throws a ParseException afterwards.
|
protected void |
reportFatalError(String msg,
int lineNo,
int columnNo)
Reports a fatal error with associated line- and column number to the
registered ParseErrorListener, if any, and throws a
ParseException afterwards.
|
protected void |
reportLocation(int lineNo,
int columnNo)
Reports the specified line- and column number to the registered
ParseLocationListener, if any. |
protected void |
reportWarning(String msg)
Reports a warning to the registered ParseErrorListener, if any.
|
protected void |
reportWarning(String msg,
int lineNo,
int columnNo)
Reports a warning with associated line- and column number to the
registered ParseErrorListener, if any.
|
protected org.openrdf.model.IRI |
resolveURI(String uriSpec)
Resolves a URI-string against the base URI and creates a
IRI
object for it. |
<T> org.openrdf.rio.RDFParser |
set(org.openrdf.rio.RioSetting<T> setting,
T value) |
protected void |
setBaseURI(info.aduna.net.ParsedURI baseURI)
Sets the base URI for resolving relative URIs.
|
protected void |
setBaseURI(String uriSpec)
Parses and normalizes the supplied URI-string and sets it as the base URI
for resolving relative URIs.
|
void |
setDatatypeHandling(org.openrdf.rio.RDFParser.DatatypeHandling datatypeHandling) |
protected void |
setNamespace(String prefix,
String namespace)
Associates the specified prefix to the specified namespace.
|
AbstractRDFParser |
setParseErrorListener(org.openrdf.rio.ParseErrorListener el) |
AbstractRDFParser |
setParseLocationListener(org.openrdf.rio.ParseLocationListener el) |
org.openrdf.rio.RDFParser |
setParserConfig(org.openrdf.rio.ParserConfig config) |
void |
setPreserveBNodeIDs(boolean preserveBNodeIDs) |
AbstractRDFParser |
setRDFHandler(org.openrdf.rio.RDFHandler handler) |
void |
setStopAtFirstError(boolean stopAtFirstError)
Deprecated.
|
org.openrdf.rio.RDFParser |
setValueFactory(org.openrdf.model.ValueFactory valueFactory) |
void |
setVerifyData(boolean verifyData) |
boolean |
stopAtFirstError()
Deprecated.
Check specific settings instead.
|
boolean |
verifyData()
Deprecated.
Use specific settings instead.
|
protected org.openrdf.rio.RDFHandler rdfHandler
protected final StardogValueFactory valueFactory
protected info.aduna.net.ParsedURI baseURI
public AbstractRDFParser()
SimpleValueFactory to
create RDF model objects.public org.openrdf.rio.RDFParser setValueFactory(org.openrdf.model.ValueFactory valueFactory)
setValueFactory in interface org.openrdf.rio.RDFParserpublic AbstractRDFParser setRDFHandler(org.openrdf.rio.RDFHandler handler)
setRDFHandler in interface org.openrdf.rio.RDFParserpublic org.openrdf.rio.RDFHandler getRDFHandler()
public AbstractRDFParser setParseErrorListener(org.openrdf.rio.ParseErrorListener el)
setParseErrorListener in interface org.openrdf.rio.RDFParserpublic org.openrdf.rio.ParseErrorListener getParseErrorListener()
public AbstractRDFParser setParseLocationListener(org.openrdf.rio.ParseLocationListener el)
setParseLocationListener in interface org.openrdf.rio.RDFParserpublic org.openrdf.rio.ParseLocationListener getParseLocationListener()
public org.openrdf.rio.RDFParser setParserConfig(org.openrdf.rio.ParserConfig config)
setParserConfig in interface org.openrdf.rio.RDFParserpublic org.openrdf.rio.ParserConfig getParserConfig()
getParserConfig in interface org.openrdf.rio.RDFParserpublic Collection<org.openrdf.rio.RioSetting<?>> getSupportedSettings()
getSupportedSettings in interface org.openrdf.rio.RDFParserpublic <T> org.openrdf.rio.RDFParser set(org.openrdf.rio.RioSetting<T> setting,
T value)
set in interface org.openrdf.rio.RDFParserpublic void setVerifyData(boolean verifyData)
setVerifyData in interface org.openrdf.rio.RDFParser@Deprecated public boolean verifyData()
public void setPreserveBNodeIDs(boolean preserveBNodeIDs)
setPreserveBNodeIDs in interface org.openrdf.rio.RDFParserpublic boolean preserveBNodeIDs()
@Deprecated public void setStopAtFirstError(boolean stopAtFirstError)
setStopAtFirstError in interface org.openrdf.rio.RDFParser@Deprecated public boolean stopAtFirstError()
public void setDatatypeHandling(org.openrdf.rio.RDFParser.DatatypeHandling datatypeHandling)
setDatatypeHandling in interface org.openrdf.rio.RDFParser@Deprecated public org.openrdf.rio.RDFParser.DatatypeHandling datatypeHandling()
BasicParserSettings.VERIFY_DATATYPE_VALUES and
BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES and
BasicParserSettings.NORMALIZE_DATATYPE_VALUES instead.protected void setBaseURI(String uriSpec)
protected void setBaseURI(info.aduna.net.ParsedURI baseURI)
protected void setNamespace(String prefix, String namespace)
protected String getNamespace(String prefix) throws org.openrdf.rio.RDFParseException
RDFParseException.org.openrdf.rio.RDFParseException - if no namespace is associated with this prefixprotected void clear()
protected void initializeNamespaceTableFromConfiguration()
protected void initConfigParams()
@Deprecated protected void clearBNodeIDMap()
protected org.openrdf.model.IRI resolveURI(String uriSpec) throws org.openrdf.rio.RDFParseException
IRI
object for it.org.openrdf.rio.RDFParseExceptionprotected org.openrdf.model.IRI createURI(String uri) throws org.openrdf.rio.RDFParseException
IRI object for the specified URI-string.org.openrdf.rio.RDFParseExceptionprotected org.openrdf.model.IRI createURI(String namespace, String localName) throws org.openrdf.rio.RDFParseException
IRI object for the specified namespace and localname.org.openrdf.rio.RDFParseExceptionprotected org.openrdf.model.BNode createBNode()
throws org.openrdf.rio.RDFParseException
BNode object.org.openrdf.rio.RDFParseExceptionprotected org.openrdf.model.BNode createBNode(String nodeID) throws org.openrdf.rio.RDFParseException
BNode object for the specified identifier.org.openrdf.rio.RDFParseExceptionprotected org.openrdf.model.Literal createLiteral(String label, String lang, org.openrdf.model.IRI datatype, int lineNo, int columnNo) throws org.openrdf.rio.RDFParseException
Literal object with the supplied parameters, using the
lineNo and columnNo to enhance error messages or exceptions that may be
generated during the creation of the literal.org.openrdf.rio.RDFParseExceptionRDFParserHelper.createLiteral(String, String,
IRI, ParserConfig, ParseErrorListener, ValueFactory, long, long)protected org.openrdf.model.Statement createStatement(org.openrdf.model.Resource subj,
org.openrdf.model.IRI pred,
org.openrdf.model.Value obj)
throws org.openrdf.rio.RDFParseException
Statement object with the supplied components.org.openrdf.rio.RDFParseExceptionprotected org.openrdf.model.Statement createStatement(org.openrdf.model.Resource subj,
org.openrdf.model.IRI pred,
org.openrdf.model.Value obj,
org.openrdf.model.Resource context)
throws org.openrdf.rio.RDFParseException
Statement object with the supplied components.org.openrdf.rio.RDFParseExceptionprotected void reportLocation(int lineNo,
int columnNo)
ParseLocationListener, if any.protected void reportWarning(String msg)
reportWarning(String,int,int) supplying
-1 for the line- and column number.protected void reportWarning(String msg, int lineNo, int columnNo)
protected void reportError(String msg, org.openrdf.rio.RioSetting<Boolean> relevantSetting) throws org.openrdf.rio.RDFParseException
This method also throws an RDFParseException when the given
setting has been set to true and it is not a nonFatalError.
msg - The message to use for
ParseErrorListener.error(String, long, long) and for
RDFParseException.RDFParseException(String, long, long).relevantSetting - The boolean setting that will be checked to determine if this is an
issue that we need to look at at all. If this setting is true, then
the error listener will receive the error, and if
ParserConfig.isNonFatalError(RioSetting) returns true an
exception will be thrown.org.openrdf.rio.RDFParseException - If RioConfig.get(RioSetting) returns true, and
ParserConfig.isNonFatalError(RioSetting) returns true for
the given setting.protected void reportError(String msg, int lineNo, int columnNo, org.openrdf.rio.RioSetting<Boolean> relevantSetting) throws org.openrdf.rio.RDFParseException
This method also throws an RDFParseException when the given
setting has been set to true and it is not a nonFatalError.
msg - The message to use for
ParseErrorListener.error(String, long, long) and for
RDFParseException.RDFParseException(String, long, long).lineNo - Optional line number, should default to setting this as -1 if not
known. Used for ParseErrorListener.error(String, long, long)
and for
RDFParseException.RDFParseException(String, long, long).columnNo - Optional column number, should default to setting this as -1 if not
known. Used for ParseErrorListener.error(String, long, long)
and for
RDFParseException.RDFParseException(String, long, long).relevantSetting - The boolean setting that will be checked to determine if this is an
issue that we need to look at at all. If this setting is true, then
the error listener will receive the error, and if
ParserConfig.isNonFatalError(RioSetting) returns true an
exception will be thrown.org.openrdf.rio.RDFParseException - If RioConfig.get(RioSetting) returns true, and
ParserConfig.isNonFatalError(RioSetting) returns true for
the given setting.protected void reportError(Exception e, int lineNo, int columnNo, org.openrdf.rio.RioSetting<Boolean> relevantSetting) throws org.openrdf.rio.RDFParseException
This method also throws an RDFParseException when the given
setting has been set to true and it is not a nonFatalError.
e - The exception whose message will be used for
ParseErrorListener.error(String, long, long) and for
RDFParseException.RDFParseException(String, long, long).lineNo - Optional line number, should default to setting this as -1 if not
known. Used for ParseErrorListener.error(String, long, long)
and for
RDFParseException.RDFParseException(String, long, long).columnNo - Optional column number, should default to setting this as -1 if not
known. Used for ParseErrorListener.error(String, long, long)
and for
RDFParseException.RDFParseException(String, long, long).relevantSetting - The boolean setting that will be checked to determine if this is an
issue that we need to look at at all. If this setting is true, then
the error listener will receive the error, and if
ParserConfig.isNonFatalError(RioSetting) returns true an
exception will be thrown.org.openrdf.rio.RDFParseException - If RioConfig.get(RioSetting) returns true, and
ParserConfig.isNonFatalError(RioSetting) returns true for
the given setting.protected void reportFatalError(String msg) throws org.openrdf.rio.RDFParseException
reportFatalError(String,int,int) supplying -1 for the
line- and column number.org.openrdf.rio.RDFParseExceptionprotected void reportFatalError(String msg, int lineNo, int columnNo) throws org.openrdf.rio.RDFParseException
org.openrdf.rio.RDFParseExceptionprotected void reportFatalError(Exception e) throws org.openrdf.rio.RDFParseException
RDFParseException; in that
case the supplied exception is not wrapped in another ParseException and
the error message is not reported to the ParseErrorListener, assuming that
it has already been reported when the original ParseException was thrown.
This method simply calls reportFatalError(Exception,int,int)
supplying -1 for the line- and column number.
org.openrdf.rio.RDFParseExceptionprotected void reportFatalError(Exception e, int lineNo, int columnNo) throws org.openrdf.rio.RDFParseException
RDFParseException; in that case the supplied exception is not
wrapped in another ParseException and the error message is not reported to
the ParseErrorListener, assuming that it has already been reported when
the original ParseException was thrown.org.openrdf.rio.RDFParseExceptionCopyright © 2010-2016 Stardog Union. All Rights Reserved.