public class NTriplesParser extends RDFParserBase
RDFParser.DatatypeHandling| Modifier and Type | Field and Description |
|---|---|
protected int |
lineNo |
protected Value |
object |
protected URI |
predicate |
protected Reader |
reader |
protected Resource |
subject |
rdfHandler, valueFactory| Constructor and Description |
|---|
NTriplesParser()
Creates a new NTriplesParser that will use a
ValueFactoryImpl to
create object for resources, bNodes and literals. |
NTriplesParser(ValueFactory valueFactory)
Creates a new NTriplesParser that will use the supplied
ValueFactory to create RDF model objects.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
assertLineTerminates(int c)
Verifies that there is only whitespace or comments until the end of the
line.
|
protected void |
clear()
Clears any information that has been collected while parsing.
|
protected Literal |
createLiteral(String label,
String lang,
String datatype) |
protected URI |
createURI(String uri)
Creates a
URI object for the specified URI-string. |
RDFFormat |
getRDFFormat()
Gets the RDF format that this parser can parse.
|
Collection<RioSetting<?>> |
getSupportedSettings() |
void |
parse(InputStream in,
String baseURI)
Implementation of the parse(InputStream, String) method defined
in the RDFParser interface.
|
void |
parse(Reader reader,
String baseURI)
Implementation of the parse(Reader, String) method defined in the
RDFParser interface.
|
protected int |
parseNodeID(int c,
StringBuilder name) |
protected int |
parseObject(int c) |
protected int |
parsePredicate(int c) |
protected int |
parseSubject(int c) |
protected int |
parseUriRef(int c,
StringBuilder uriRef) |
protected int |
readCodePoint()
Reads the next Unicode code point.
|
protected void |
reportError(Exception e,
RioSetting<Boolean> setting) |
protected void |
reportError(String msg,
RioSetting<Boolean> setting)
Overrides
RDFParserBase.reportError(String, RioSetting), adding
line number information to the error. |
protected void |
reportFatalError(Exception e)
Overrides
RDFParserBase.reportFatalError(Exception), adding line
number information to the error. |
protected void |
reportFatalError(String msg)
Overrides
RDFParserBase.reportFatalError(String), adding line
number information to the error. |
protected void |
reportWarning(String msg)
Overrides
RDFParserBase.reportWarning(String), adding line number
information to the error. |
protected int |
skipLine(int c)
Reads characters from reader until the first EOL has been read.
|
protected int |
skipToEndOfLine(int c)
Reads characters from reader until the first EOL has been read.
|
protected int |
skipWhitespace(int c)
Reads characters from reader until it finds a character that is not a
space or tab, and returns this last character code point.
|
protected void |
throwEOFException() |
clearBNodeIDMap, createBNode, createBNode, createLiteral, createLiteral, createStatement, createStatement, datatypeHandling, getNamespace, getParseErrorListener, getParseLocationListener, getParserConfig, getRDFHandler, initializeNamespaceTableFromConfiguration, preserveBNodeIDs, reportError, reportError, reportFatalError, reportFatalError, reportLocation, reportWarning, resolveURI, setBaseURI, setBaseURI, setDatatypeHandling, setNamespace, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setStopAtFirstError, setValueFactory, setVerifyData, stopAtFirstError, verifyDataprotected Reader reader
protected int lineNo
protected Resource subject
protected URI predicate
protected Value object
public NTriplesParser()
ValueFactoryImpl to
create object for resources, bNodes and literals.public NTriplesParser(ValueFactory valueFactory)
valueFactory - A ValueFactory.public RDFFormat getRDFFormat()
RDFParserpublic void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException
in - The InputStream from which to read the data, must not be
null. The InputStream is supposed to contain 7-bit
US-ASCII characters, as per the N-Triples specification.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
reader - The Reader from which to read the data, must not be null.baseURI - The URI associated with the data in the Reader, 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 reader or base URI is null.protected int skipWhitespace(int c)
throws IOException
IOExceptionprotected int assertLineTerminates(int c)
throws IOException,
RDFParseException
IOExceptionRDFParseExceptionprotected int skipToEndOfLine(int c)
throws IOException
IOExceptionprotected int skipLine(int c)
throws IOException
IOExceptionprotected int parseSubject(int c)
throws IOException,
RDFParseException
IOExceptionRDFParseExceptionprotected int parsePredicate(int c)
throws IOException,
RDFParseException
IOExceptionRDFParseExceptionprotected int parseObject(int c)
throws IOException,
RDFParseException
IOExceptionRDFParseExceptionprotected int parseUriRef(int c,
StringBuilder uriRef)
throws IOException,
RDFParseException
IOExceptionRDFParseExceptionprotected int parseNodeID(int c,
StringBuilder name)
throws IOException,
RDFParseException
IOExceptionRDFParseExceptionprotected URI createURI(String uri) throws RDFParseException
RDFParserBaseURI object for the specified URI-string.createURI in class RDFParserBaseRDFParseExceptionprotected int readCodePoint()
throws IOException
IOExceptionprotected Literal createLiteral(String label, String lang, String datatype) throws RDFParseException
RDFParseExceptionprotected void reportWarning(String msg)
RDFParserBase.reportWarning(String), adding line number
information to the error.reportWarning in class RDFParserBaseprotected void reportError(String msg, RioSetting<Boolean> setting) throws RDFParseException
RDFParserBase.reportError(String, RioSetting), adding
line number information to the error.reportError in class RDFParserBasemsg - The message to use for
ParseErrorListener.error(String, int, int) and for
RDFParseException.RDFParseException(String, int, int).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 reportError(Exception e, RioSetting<Boolean> setting) throws RDFParseException
RDFParseExceptionprotected void reportFatalError(String msg) throws RDFParseException
RDFParserBase.reportFatalError(String), adding line
number information to the error.reportFatalError in class RDFParserBaseRDFParseExceptionprotected void reportFatalError(Exception e) throws RDFParseException
RDFParserBase.reportFatalError(Exception), adding line
number information to the error.reportFatalError in class RDFParserBaseRDFParseExceptionprotected void throwEOFException()
throws RDFParseException
RDFParseExceptionprotected void clear()
RDFParserBaseclear in class RDFParserBasepublic Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings in interface RDFParsergetSupportedSettings in class RDFParserBaseRioSettings that are supported by this
RDFParser.Copyright © 2001–2015 Aduna. All rights reserved.