public class TurtleParser extends RDFParserBase
This implementation is based on the 2006/01/02 version of the Turtle specification, with slight deviations:
RDFParser.DatatypeHandlingrdfHandler, valueFactory| Constructor and Description |
|---|
TurtleParser()
Creates a new TurtleParser that will use a
ValueFactoryImpl to
create RDF model objects. |
TurtleParser(ValueFactory valueFactory)
Creates a new TurtleParser that will use the supplied ValueFactory to
create RDF model objects.
|
| Modifier and Type | Method and Description |
|---|---|
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 void |
parseBase() |
protected Resource |
parseCollection()
Parses a collection, e.g.
|
protected void |
parseDirective(String directive) |
protected Resource |
parseImplicitBlank()
Parses an implicit blank node.
|
protected String |
parseLongString(int closingCharacter)
Parses a """long string""".
|
protected BNode |
parseNodeID()
Parses a blank node ID, e.g.
|
protected Literal |
parseNumber() |
protected void |
parseObject() |
protected void |
parseObjectList() |
protected URI |
parsePredicate() |
protected void |
parsePredicateObjectList() |
protected void |
parsePrefixID() |
protected Value |
parseQNameOrBoolean()
Parses qnames and boolean values, which have equivalent starting
characters.
|
protected Literal |
parseQuotedLiteral()
Parses a quoted string, optionally followed by a language tag or datatype.
|
protected String |
parseQuotedString()
Parses a quoted string, which is either a "normal string" or a """long
string""".
|
protected void |
parseStatement() |
protected String |
parseString(int closingCharacter)
Parses a "normal string".
|
protected void |
parseSubject() |
protected void |
parseTriples() |
protected URI |
parseURI() |
protected Value |
parseValue()
Parses an RDF value.
|
protected int |
peek() |
protected void |
processComment()
Consumes characters from reader until the first EOL has been read.
|
protected int |
read() |
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 |
reportLocation() |
protected void |
reportStatement(Resource subj,
URI pred,
Value obj) |
protected void |
reportWarning(String msg)
Overrides
RDFParserBase.reportWarning(String), adding line number
information to the error. |
protected int |
skipWSC()
Consumes any white space characters (space, tab, line feed, newline) and
comments (#-style) from reader.
|
protected void |
throwEOFException() |
protected void |
unread(int c) |
protected void |
unread(String directive) |
protected void |
verifyCharacterOrFail(int c,
String expected)
Verifies that the supplied character c is one of the expected
characters specified in expected.
|
clear, clearBNodeIDMap, createBNode, createBNode, createLiteral, createLiteral, createStatement, createStatement, createURI, 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, verifyDatapublic TurtleParser()
ValueFactoryImpl to
create RDF model objects.public TurtleParser(ValueFactory valueFactory)
valueFactory - A ValueFactory.public RDFFormat getRDFFormat()
public Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings in interface RDFParsergetSupportedSettings in class RDFParserBasepublic 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 UTF-8 encoded
Unicode characters, as per the Turtle 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 void parseStatement()
throws IOException,
RDFParseException,
RDFHandlerException
protected void parseDirective(String directive) throws IOException, RDFParseException, RDFHandlerException
protected void parsePrefixID()
throws IOException,
RDFParseException,
RDFHandlerException
protected void parseBase()
throws IOException,
RDFParseException,
RDFHandlerException
protected void parseTriples()
throws IOException,
RDFParseException,
RDFHandlerException
protected void parsePredicateObjectList()
throws IOException,
RDFParseException,
RDFHandlerException
protected void parseObjectList()
throws IOException,
RDFParseException,
RDFHandlerException
protected void parseSubject()
throws IOException,
RDFParseException,
RDFHandlerException
protected URI parsePredicate() throws IOException, RDFParseException
IOExceptionRDFParseExceptionprotected void parseObject()
throws IOException,
RDFParseException,
RDFHandlerException
protected Resource parseCollection() throws IOException, RDFParseException, RDFHandlerException
protected Resource parseImplicitBlank() throws IOException, RDFParseException, RDFHandlerException
protected Value parseValue() throws IOException, RDFParseException
IOExceptionRDFParseExceptionprotected Literal parseQuotedLiteral() throws IOException, RDFParseException
IOExceptionRDFParseExceptionprotected String parseQuotedString() throws IOException, RDFParseException
IOExceptionRDFParseExceptionprotected String parseString(int closingCharacter) throws IOException, RDFParseException
IOExceptionRDFParseExceptionprotected String parseLongString(int closingCharacter) throws IOException, RDFParseException
IOExceptionRDFParseExceptionprotected Literal parseNumber() throws IOException, RDFParseException
IOExceptionRDFParseExceptionprotected URI parseURI() throws IOException, RDFParseException
IOExceptionRDFParseExceptionprotected Value parseQNameOrBoolean() throws IOException, RDFParseException
IOExceptionRDFParseExceptionprotected BNode parseNodeID() throws IOException, RDFParseException
IOExceptionRDFParseExceptionprotected void reportStatement(Resource subj, URI pred, Value obj) throws RDFParseException, RDFHandlerException
RDFParseExceptionRDFHandlerExceptionprotected void verifyCharacterOrFail(int c,
String expected)
throws RDFParseException
RDFParseExceptionprotected int skipWSC()
throws IOException,
RDFHandlerException
IOExceptionRDFHandlerExceptionprotected void processComment()
throws IOException,
RDFHandlerException
RDFParserBase.rdfHandler as a comment.IOExceptionRDFHandlerExceptionprotected int read()
throws IOException
IOExceptionprotected void unread(int c)
throws IOException
IOExceptionprotected void unread(String directive) throws IOException
IOExceptionprotected int peek()
throws IOException
IOExceptionprotected void reportLocation()
protected 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 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
RDFParseExceptionCopyright © 2001-2014 Aduna. All Rights Reserved.