Class XMLReaderBasedParser
java.lang.Object
org.eclipse.rdf4j.rio.helpers.AbstractRDFParser
org.eclipse.rdf4j.rio.helpers.XMLReaderBasedParser
- All Implemented Interfaces:
RDFParser
- Direct Known Subclasses:
RDFXMLParser, TriXParser
Base class for Rio parsers that are based on a SAX
XMLReader.- Author:
- Jeen Broekstra
-
Field Summary
Fields inherited from class AbstractRDFParser
rdfHandler, valueFactoryModifier and TypeFieldDescriptionprotected RDFHandlerThe RDFHandler that will handle the parsed RDF.protected ValueFactoryThe ValueFactory to use for creating RDF model objects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a collection of settings that will always be set as XML parser features usingXMLReader.setFeature(String, boolean).Collection<RioSetting<?>> Returns a collection of settings that will always be set as XML parser properties usingXMLReader.setProperty(String, Object)Returns a collection of settings that will be used, if set inAbstractRDFParser.getParserConfig(), as XML parser features usingXMLReader.setFeature(String, boolean).Collection<RioSetting<?>> Returns a collection of settings that will be used, if set inAbstractRDFParser.getParserConfig(), as XML parser properties usingXMLReader.setProperty(String, Object)protected XMLReaderCreates an XML Reader configured using the current parser settings.Methods inherited from class AbstractRDFParser
clear, clearBNodeIDMap, createBNode, createBNode, createLiteral, createLiteral, createLiteral, createNode, createNode, createStatement, createStatement, createURI, getNamespace, getParseErrorListener, getParseLocationListener, getParserConfig, getRDFHandler, getSupportedSettings, initializeNamespaceTableFromConfiguration, preserveBNodeIDs, reportError, reportError, reportError, reportError, reportError, reportFatalError, reportFatalError, reportFatalError, reportFatalError, reportFatalError, reportLocation, reportWarning, reportWarning, resolveURI, set, setBaseURI, setBaseURI, setNamespace, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setValueFactoryModifier and TypeMethodDescriptionprotected voidclear()Clears any information that has been collected while parsing.protected voidDeprecated.protected BNodeDeprecated.protected BNodecreateBNode(String nodeID) Deprecated.protected LiteralcreateLiteral(String label, String lang, CoreDatatype datatype, long lineNo, long columnNo) Creates aLiteralobject 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 LiteralcreateLiteral(String label, String lang, IRI datatype) Creates aLiteralobject with the supplied parameters.protected LiteralcreateLiteral(String label, String lang, IRI datatype, long lineNo, long columnNo) Creates aLiteralobject 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 Resourceprotected ResourcecreateNode(String nodeID) protected StatementcreateStatement(Resource subj, IRI pred, Value obj) Creates a newStatementobject with the supplied components.protected StatementcreateStatement(Resource subj, IRI pred, Value obj, Resource context) Creates a newStatementobject with the supplied components.protected IRICreates aIRIobject for the specified URI-string.protected StringgetNamespace(String prefix) Gets the namespace that is associated with the specified prefix or throws anRDFParseException.Retrieves the current parser configuration as a single object.Collection<RioSetting<?>> protected voidbooleanprotected voidreportError(Exception e, long lineNo, long columnNo, 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 voidreportError(Exception e, 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 voidreportError(String msg, long lineNo, long columnNo, 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 voidreportError(String msg, Exception e, long lineNo, long columnNo, 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 voidreportError(String msg, 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 voidReports a fatal error to the registered ParseErrorListener, if any, and throws a ParseException afterwards.protected voidreportFatalError(Exception e, long lineNo, long 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 voidreportFatalError(String msg) Reports a fatal error to the registered ParseErrorListener, if any, and throws a ParseException afterwards.protected voidreportFatalError(String msg, long lineNo, long columnNo) Reports a fatal error with associated line- and column number to the registered ParseErrorListener, if any, and throws a ParseException afterwards.protected voidreportFatalError(String message, Exception e, long lineNo, long 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 voidreportLocation(long lineNo, long columnNo) Reports the specified line- and column number to the registeredParseLocationListener, if any.protected voidreportWarning(String msg) Reports a warning to the registered ParseErrorListener, if any.protected voidreportWarning(String msg, long lineNo, long columnNo) Reports a warning with associated line- and column number to the registered ParseErrorListener, if any.protected IRIresolveURI(String uriSpec) Resolves a URI-string against the base URI and creates aIRIobject for it.<T> RDFParserset(RioSetting<T> setting, T value) Set a setting on the parser, and return this parser object to allow chaining.protected voidsetBaseURI(String uriSpec) Parses the supplied URI-string and sets it as the base URI for resolving relative URIs.protected voidsetBaseURI(ParsedIRI baseURI) Sets the base URI for resolving relative URIs.protected voidsetNamespace(String prefix, String namespace) Associates the specified prefix to the specified namespace.Sets the ParseErrorListener that will be notified of any errors that this parser finds during parsing.Sets the ParseLocationListener that will be notified of the parser's progress during the parse process.setParserConfig(ParserConfig config) Sets all supplied parser configuration options.voidsetPreserveBNodeIDs(boolean preserveBNodeIDs) Set whether the parser should preserve bnode identifiers specified in the source (default is false).setRDFHandler(RDFHandler handler) Sets the RDFHandler that will handle the parsed RDF data.setValueFactory(ValueFactory valueFactory) Sets the ValueFactory that the parser will use to create Value objects for the parsed RDF data.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RDFParser
getRDFFormat, parse, parse, parse, parseModifier and TypeMethodDescriptionGets the RDF format that this parser can parse.default voidparse(InputStream in) Parses the data from the supplied InputStream.voidparse(InputStream in, String baseURI) Parses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.default voidParses the data from the supplied Reader.voidParses the data from the supplied Reader, using the supplied baseURI to resolve any relative URI references.
-
Constructor Details
-
XMLReaderBasedParser
-
-
Method Details
-
getCompulsoryXmlPropertySettings
Returns a collection of settings that will always be set as XML parser properties usingXMLReader.setProperty(String, Object)Subclasses can override this to specify more supported settings.
- Returns:
- A collection of
RioSettings that indicate which properties will always be setup usingXMLReader.setProperty(String, Object).
-
getCompulsoryXmlFeatureSettings
Returns a collection of settings that will always be set as XML parser features usingXMLReader.setFeature(String, boolean).Subclasses can override this to specify more supported settings.
- Returns:
- A collection of
RioSettings that indicate which boolean settings will always be setup usingXMLReader.setFeature(String, boolean).
-
getOptionalXmlPropertySettings
Returns a collection of settings that will be used, if set inAbstractRDFParser.getParserConfig(), as XML parser properties usingXMLReader.setProperty(String, Object)Subclasses can override this to specify more supported settings.
- Returns:
- A collection of
RioSettings that indicate which properties can be setup usingXMLReader.setProperty(String, Object).
-
getOptionalXmlFeatureSettings
Returns a collection of settings that will be used, if set inAbstractRDFParser.getParserConfig(), as XML parser features usingXMLReader.setFeature(String, boolean).Subclasses can override this to specify more supported settings.
- Returns:
- A collection of
RioSettings that indicate which boolean settings can be setup usingXMLReader.setFeature(String, boolean).
-
getXMLReader
Creates an XML Reader configured using the current parser settings.- Returns:
- a configured
XMLReader - Throws:
SAXException- if an error occurs during configuration.
-
AbstractRDFParser.clear()instead.