public class TriXParser extends XMLReaderBasedParser implements ErrorHandler
RDFParser.DatatypeHandling
rdfHandler, valueFactory
Constructor and Description |
---|
TriXParser()
Creates a new TriXParser that will use a
SimpleValueFactory to create objects for resources, bNodes,
literals and statements. |
TriXParser(ValueFactory valueFactory)
Creates a new TriXParser that will use the supplied ValueFactory to create objects for resources, bNodes,
literals and statements.
|
Modifier and Type | Method and Description |
---|---|
protected Literal |
createLiteral(String label,
String lang,
IRI datatype)
Creates a
Literal object with the supplied parameters. |
void |
error(SAXParseException exception)
Implementation of SAX ErrorHandler.error
|
void |
fatalError(SAXParseException exception)
Implementation of SAX ErrorHandler.fatalError
|
RDFFormat |
getRDFFormat()
Gets the RDF format that this parser can parse.
|
Collection<RioSetting<?>> |
getSupportedSettings() |
void |
parse(InputStream in,
String baseURI)
Parses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.
|
void |
parse(Reader reader,
String baseURI)
Parses the data from the supplied Reader, using the supplied baseURI to resolve any relative URI references.
|
protected void |
reportError(String msg,
RioSetting<Boolean> setting)
Overrides
AbstractRDFParser.reportError(String, RioSetting) , adding line- and column number information
to the error. |
protected void |
reportFatalError(Exception e)
Overrides
AbstractRDFParser.reportFatalError(Exception) , adding line- and column number information to
the error. |
protected void |
reportFatalError(String msg)
Overrides
AbstractRDFParser.reportFatalError(String) , adding line- and column number information to the
error. |
protected void |
reportWarning(String msg)
Overrides
AbstractRDFParser.reportWarning(String) , adding line- and column number information to the
error. |
void |
warning(SAXParseException exception)
Implementation of SAX ErrorHandler.warning
|
getCompulsoryXmlFeatureSettings, getCompulsoryXmlPropertySettings, getOptionalXmlFeatureSettings, getOptionalXmlPropertySettings, getXMLReader
clear, clearBNodeIDMap, createBNode, createBNode, createLiteral, createNode, createNode, createStatement, createStatement, createURI, datatypeHandling, getNamespace, getParseErrorListener, getParseLocationListener, getParserConfig, getRDFHandler, initializeNamespaceTableFromConfiguration, preserveBNodeIDs, reportError, reportError, reportError, reportError, reportFatalError, reportFatalError, reportFatalError, reportLocation, reportWarning, resolveURI, set, setBaseURI, setBaseURI, setDatatypeHandling, setNamespace, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setStopAtFirstError, setValueFactory, setVerifyData, stopAtFirstError, verifyData
public TriXParser()
SimpleValueFactory
to create objects for resources, bNodes,
literals and statements.public TriXParser(ValueFactory valueFactory)
valueFactory
- A ValueFactory.public final RDFFormat getRDFFormat()
RDFParser
getRDFFormat
in interface RDFParser
public Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings
in interface RDFParser
getSupportedSettings
in class AbstractRDFParser
RioSetting
s that are supported by this RDFParser.public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException
parse
in interface RDFParser
in
- The InputStream from which to read the data, must not be null.baseURI
- The URI associated with the data in the InputStream, must not be null.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 encountered an unrecoverable error.IllegalArgumentException
- If the supplied input stream or base URI is null.public void parse(Reader reader, String baseURI) throws IOException, RDFParseException, RDFHandlerException
parse
in interface RDFParser
reader
- The Reader from which to read the data, must not be null.baseURI
- The URI associated with the data in the InputStream, must not be null.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.IllegalArgumentException
- If the supplied reader or base URI is null.protected Literal createLiteral(String label, String lang, IRI datatype) throws RDFParseException
AbstractRDFParser
Literal
object with the supplied parameters.createLiteral
in class AbstractRDFParser
RDFParseException
protected void reportWarning(String msg)
AbstractRDFParser.reportWarning(String)
, adding line- and column number information to the
error.reportWarning
in class AbstractRDFParser
protected void reportError(String msg, RioSetting<Boolean> setting) throws RDFParseException
AbstractRDFParser.reportError(String, RioSetting)
, adding line- and column number information
to the error.reportError
in class AbstractRDFParser
msg
- The message to use for ParseErrorListener.error(String, long, long)
and for
RDFParseException.RDFParseException(String, long, long)
.setting
- 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.RDFParseException
- If RioConfig.get(RioSetting)
returns true, and
ParserConfig.isNonFatalError(RioSetting)
returns true for the given setting.protected void reportFatalError(String msg) throws RDFParseException
AbstractRDFParser.reportFatalError(String)
, adding line- and column number information to the
error.reportFatalError
in class AbstractRDFParser
RDFParseException
protected void reportFatalError(Exception e) throws RDFParseException
AbstractRDFParser.reportFatalError(Exception)
, adding line- and column number information to
the error.reportFatalError
in class AbstractRDFParser
RDFParseException
public void warning(SAXParseException exception) throws SAXException
warning
in interface ErrorHandler
SAXException
public void error(SAXParseException exception) throws SAXException
error
in interface ErrorHandler
SAXException
public void fatalError(SAXParseException exception) throws SAXException
fatalError
in interface ErrorHandler
SAXException
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.