com.franz.openrdf.rio.nquads
Class NQuadsParser
java.lang.Object
org.openrdf.rio.helpers.RDFParserBase
com.franz.openrdf.rio.nquads.NQuadsParser
- All Implemented Interfaces:
- RDFParser
public class NQuadsParser
- extends RDFParserBase
RDF parser for N-Quads files.
A specification of NQuads can be found here.
This parser is not thread-safe, therefore its public methods are synchronized.
Modified from openrdf's NTriplesParser.
Constructor Summary |
NQuadsParser()
Creates a new NQuadsParser that will use a ValueFactoryImpl to
create object for resources, bNodes and literals. |
NQuadsParser(ValueFactory valueFactory)
Creates a new NQuadsParser that will use the supplied
ValueFactory to create RDF model objects. |
Method Summary |
RDFFormat |
getRDFFormat()
|
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. |
Methods inherited from class org.openrdf.rio.helpers.RDFParserBase |
datatypeHandling, getParseErrorListener, getParseLocationListener, getParserConfig, getRDFHandler, preserveBNodeIDs, setDatatypeHandling, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setStopAtFirstError, setValueFactory, setVerifyData, stopAtFirstError, verifyData |
NQuadsParser
public NQuadsParser()
- Creates a new NQuadsParser that will use a
ValueFactoryImpl
to
create object for resources, bNodes and literals.
NQuadsParser
public NQuadsParser(ValueFactory valueFactory)
- Creates a new NQuadsParser that will use the supplied
ValueFactory to create RDF model objects.
- Parameters:
valueFactory
- A ValueFactory.
getRDFFormat
public final RDFFormat getRDFFormat()
parse
public void parse(InputStream in,
String baseURI)
throws IOException,
RDFParseException,
RDFHandlerException
- Implementation of the parse(InputStream, String) method defined
in the RDFParser interface.
- Parameters:
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.
- Throws:
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.
parse
public void parse(Reader reader,
String baseURI)
throws IOException,
RDFParseException,
RDFHandlerException
- Implementation of the parse(Reader, String) method defined in
the RDFParser interface.
- Parameters:
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.
- Throws:
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.