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 until the end of the line.
|
protected void |
clear() |
protected Literal |
createLiteral(String label,
String lang,
String datatype) |
protected URI |
createURI(String uri) |
RDFFormat |
getRDFFormat() |
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 void |
reportError(Exception e,
RioSetting<Boolean> setting) |
protected void |
reportError(String msg,
RioSetting<Boolean> setting)
Overrides
RDFParserBase#reportError(String), 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 |
skipWhitespace(int c)
Reads characters from reader until it finds a character that is not a
space or tab, and returns this last character.
|
protected void |
throwEOFException() |
clearBNodeIDMap, createBNode, createBNode, createLiteral, createLiteral, createStatement, createStatement, datatypeHandling, getNamespace, getParseErrorListener, getParseLocationListener, getParserConfig, getRDFHandler, 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()
public 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 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
createURI in class RDFParserBaseRDFParseExceptionprotected 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), adding line number
information to the error.reportError in class RDFParserBaseRDFParseExceptionprotected 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()
clear in class RDFParserBasepublic Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings in interface RDFParsergetSupportedSettings in class RDFParserBaseCopyright © 2001-2014 Aduna. All Rights Reserved.