|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.openrdf.rio.turtle.TurtleParser
Parser for Turtle files. A specification of Turtle can be found in this document. This parser is not thread-safe, therefore its public methods are synchronized.
This implementation is based on the 2006/01/02 version of the Turtle specification, with slight deviations:
| Field Summary |
| Fields inherited from interface org.openrdf.rio.Parser |
DT_IGNORE, DT_NORMALIZE, DT_VERIFY |
| Constructor Summary | |
TurtleParser()
Creates a new TurtleParser that will use a ValueFactoryImpl to create object for resources, bNodes and literals. |
|
TurtleParser(ValueFactory valueFactory)
Creates a new TurtleParser that will use the supplied ValueFactory to create objects for resources, bNodes and literals. |
|
| Method Summary | |
void |
parse(InputStream in,
String baseURI)
Implementation of the parse(InputStream, String) method defined in the Parser interface. |
void |
parse(Reader reader,
String baseURI)
Implementation of the parse(Reader, String) method defined in the Parser interface. |
void |
setDatatypeHandling(int datatypeHandling)
Sets the datatype handling mode. |
void |
setNamespaceListener(NamespaceListener nl)
Sets the NamespaceListener that will be notified of any namespace declarations that the parser finds during parsing. |
void |
setParseErrorListener(ParseErrorListener el)
Sets the ParseErrorListener that will be notified of any errors that this parser finds during parsing. |
void |
setParseLocationListener(ParseLocationListener el)
Sets the ParseLocationListener that will be notified of the parser's progress during the parse process. |
void |
setPreserveBNodeIds(boolean preserveBNodeIds)
Set whether the parser should preserve bnode identifiers specified in the source (default is false). |
void |
setStatementHandler(StatementHandler sh)
Sets the StatementHandler that will be notified of statements that are parsed by this parser. |
void |
setStopAtFirstError(boolean stopAtFirstError)
Sets whether the parser should stop immediately if it finds an error in the data (default value is true). |
void |
setVerifyData(boolean verifyData)
Sets whether the parser should verify the data it parses (default value is true). |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TurtleParser()
ValueFactoryImplpublic TurtleParser(ValueFactory valueFactory)
valueFactory - A ValueFactory.| Method Detail |
public void setStatementHandler(StatementHandler sh)
Parser
setStatementHandler in interface Parserpublic void setNamespaceListener(NamespaceListener nl)
Parser
setNamespaceListener in interface Parserpublic void setParseErrorListener(ParseErrorListener el)
Parser
setParseErrorListener in interface Parserpublic void setParseLocationListener(ParseLocationListener el)
Parser
setParseLocationListener in interface Parserpublic void setVerifyData(boolean verifyData)
Parser
setVerifyData in interface Parserpublic void setPreserveBNodeIds(boolean preserveBNodeIds)
Parser
setPreserveBNodeIds in interface Parserpublic void setStopAtFirstError(boolean stopAtFirstError)
Parser
setStopAtFirstError in interface Parserpublic void setDatatypeHandling(int datatypeHandling)
Parser
setDatatypeHandling in interface ParserdatatypeHandling - One of the constants
DT_IGNORE, DT_VERIFY or
DT_NORMALIZE.Parser.DT_IGNORE,
Parser.DT_VERIFY,
Parser.DT_NORMALIZE
public void parse(InputStream in,
String baseURI)
throws IOException,
ParseException,
StatementHandlerException
parse in interface Parserin - The InputStream from which to read the data. 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.
IOException - If an I/O error occurred while data was read
from the InputStream.
ParseException - If the parser has found an unrecoverable
parse error.
StatementHandler - If the configured statement handler
encountered an unrecoverable error.
IllegalArgumentException - If the supplied input stream or
base URI is null.
StatementHandlerException - If the configured statement handler
has encountered an unrecoverable error.
public void parse(Reader reader,
String baseURI)
throws IOException,
ParseException,
StatementHandlerException
parse in interface Parserreader - The Reader from which to read the data.baseURI - The URI associated with the data in the Reader.
IOException - If an I/O error occurred while data was read
from the InputStream.
ParseException - If the parser has found an unrecoverable
parse error.
StatementHandler - If the configured statement handler
encountered an unrecoverable error.
IllegalArgumentException - If the supplied reader or base URI
is null.
StatementHandlerException - If the configured statement handler
has encountered an unrecoverable error.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||