public class BigdataNTriplesParser
extends org.openrdf.rio.helpers.RDFParserBase
This parser has been modified to support the inline notation for statements about statements.
This parser has been modified to reuse the same StringBuilder
in
order to minimize heap churn.
This parser has been modified to permit "-" and "_" in blank node IDs (they are not allowed in that position for NTRIPLES). This was done to support a demonstration use case. That change could (and should) be backed out. It is documented by FIXMEs in the code. One of the test files would also have to be fixed.
Constructor and Description |
---|
BigdataNTriplesParser()
Creates a new NTriplesParser that will use a
ValueFactoryImpl to
create object for resources, bNodes and literals. |
BigdataNTriplesParser(BigdataValueFactory 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 org.openrdf.model.Literal |
createLiteral(String label,
String lang,
String datatype) |
protected org.openrdf.model.URI |
createURI(String uri) |
org.openrdf.rio.RDFFormat |
getRDFFormat() |
protected BigdataValueFactory |
getValueFactory()
Return the
BigdataValueFactory . |
static boolean |
isLetterOrNumber(int c)
Checks whether the supplied character is a letter or number according to
the N-Triples specification.
|
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 void |
reportError(Exception e,
org.openrdf.rio.RioSetting<Boolean> setting) |
protected void |
reportError(String msg,
org.openrdf.rio.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. |
void |
setValueFactory(org.openrdf.model.ValueFactory valueFactory) |
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.
|
clear, clearBNodeIDMap, createBNode, createBNode, createLiteral, createLiteral, createStatement, createStatement, datatypeHandling, getNamespace, getParseErrorListener, getParseLocationListener, getParserConfig, getRDFHandler, getSupportedSettings, preserveBNodeIDs, reportError, reportError, reportFatalError, reportFatalError, reportLocation, reportWarning, resolveURI, setBaseURI, setBaseURI, setDatatypeHandling, setNamespace, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setStopAtFirstError, setVerifyData, stopAtFirstError, verifyData
public BigdataNTriplesParser()
ValueFactoryImpl
to
create object for resources, bNodes and literals.public BigdataNTriplesParser(BigdataValueFactory valueFactory)
valueFactory
- A ValueFactory.public void setValueFactory(org.openrdf.model.ValueFactory valueFactory)
setValueFactory
in interface org.openrdf.rio.RDFParser
setValueFactory
in class org.openrdf.rio.helpers.RDFParserBase
protected BigdataValueFactory getValueFactory()
BigdataValueFactory
.ClassCastException
- if you have not set a BigdataValueFactory
.public final org.openrdf.rio.RDFFormat getRDFFormat()
public void parse(InputStream in, String baseURI) throws IOException, org.openrdf.rio.RDFParseException, org.openrdf.rio.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.org.openrdf.rio.RDFParseException
- If the parser has found an unrecoverable parse error.org.openrdf.rio.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, org.openrdf.rio.RDFParseException, org.openrdf.rio.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.org.openrdf.rio.RDFParseException
- If the parser has found an unrecoverable parse error.org.openrdf.rio.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
IOException
protected int assertLineTerminates(int c) throws IOException, org.openrdf.rio.RDFParseException
IOException
org.openrdf.rio.RDFParseException
protected int skipLine(int c) throws IOException
IOException
public static boolean isLetterOrNumber(int c)
isLetter(int)
,
NTriplesUtil.isLetterOrNumber(int)
protected org.openrdf.model.URI createURI(String uri) throws org.openrdf.rio.RDFParseException
createURI
in class org.openrdf.rio.helpers.RDFParserBase
org.openrdf.rio.RDFParseException
protected org.openrdf.model.Literal createLiteral(String label, String lang, String datatype) throws org.openrdf.rio.RDFParseException
org.openrdf.rio.RDFParseException
protected void reportWarning(String msg)
RDFParserBase.reportWarning(String)
, adding line number
information to the error.reportWarning
in class org.openrdf.rio.helpers.RDFParserBase
protected void reportError(String msg, org.openrdf.rio.RioSetting<Boolean> setting) throws org.openrdf.rio.RDFParseException
RDFParserBase#reportError(String)
, adding line number
information to the error.reportError
in class org.openrdf.rio.helpers.RDFParserBase
org.openrdf.rio.RDFParseException
protected void reportError(Exception e, org.openrdf.rio.RioSetting<Boolean> setting) throws org.openrdf.rio.RDFParseException
org.openrdf.rio.RDFParseException
protected void reportFatalError(String msg) throws org.openrdf.rio.RDFParseException
RDFParserBase.reportFatalError(String)
, adding line
number information to the error.reportFatalError
in class org.openrdf.rio.helpers.RDFParserBase
org.openrdf.rio.RDFParseException
protected void reportFatalError(Exception e) throws org.openrdf.rio.RDFParseException
RDFParserBase.reportFatalError(Exception)
, adding line
number information to the error.reportFatalError
in class org.openrdf.rio.helpers.RDFParserBase
org.openrdf.rio.RDFParseException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.