Package org.eclipse.rdf4j.rio.ndjsonld
Class NDJSONLDParser
- java.lang.Object
-
- org.eclipse.rdf4j.rio.helpers.AbstractRDFParser
-
- org.eclipse.rdf4j.rio.jsonld.JSONLDParser
-
- org.eclipse.rdf4j.rio.ndjsonld.NDJSONLDParser
-
- All Implemented Interfaces:
RDFParser
public class NDJSONLDParser extends JSONLDParser implements RDFParser
Introduce a parser capable of parsing Newline Delimited JSON-LD, where each line is a serialized JSON-LD record. The format is inspired by Newline Delimited JSON formathttp://ndjson.org/. Even though each line is a separate JSON-LD document, the whole document is treated as a single RDF document, having one single BNodes context to preserve BNodes identifiers.- Author:
- Desislava Hristova
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.rdf4j.rio.RDFParser
RDFParser.DatatypeHandling
-
-
Field Summary
-
Fields inherited from class org.eclipse.rdf4j.rio.helpers.AbstractRDFParser
rdfHandler, valueFactory
-
-
Constructor Summary
Constructors Constructor Description NDJSONLDParser()Default constructorNDJSONLDParser(ValueFactory valueFactory)Creates a RDF4J NDJSONLD Parser using the givenValueFactoryto create newValues.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ObjectgetJSONObject(InputStream in, Reader reader, com.fasterxml.jackson.core.JsonFactory factory)RDFFormatgetRDFFormat()Gets the RDF format that this parser can parse.voidparse(InputStream in, String baseURI)Parses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.-
Methods inherited from class org.eclipse.rdf4j.rio.jsonld.JSONLDParser
getSupportedSettings, parse
-
Methods inherited from class org.eclipse.rdf4j.rio.helpers.AbstractRDFParser
clear, clearBNodeIDMap, createBNode, createBNode, createLiteral, createLiteral, createNode, createNode, createStatement, createStatement, createURI, getNamespace, getParseErrorListener, getParseLocationListener, getParserConfig, getRDFHandler, initializeNamespaceTableFromConfiguration, preserveBNodeIDs, reportError, reportError, reportError, reportError, reportError, reportFatalError, reportFatalError, reportFatalError, reportFatalError, reportFatalError, reportLocation, reportWarning, reportWarning, resolveURI, set, setBaseURI, setBaseURI, setDatatypeHandling, setNamespace, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setStopAtFirstError, setValueFactory, setVerifyData, stopAtFirstError, verifyData
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.rio.RDFParser
getParserConfig, getSupportedSettings, parse, parse, parse, set, setDatatypeHandling, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setStopAtFirstError, setValueFactory, setVerifyData
-
-
-
-
Constructor Detail
-
NDJSONLDParser
public NDJSONLDParser()
Default constructor
-
NDJSONLDParser
public NDJSONLDParser(ValueFactory valueFactory)
Creates a RDF4J NDJSONLD Parser using the givenValueFactoryto create newValues.- Parameters:
valueFactory- The ValueFactory to use
-
-
Method Detail
-
getRDFFormat
public RDFFormat getRDFFormat()
Description copied from interface:RDFParserGets the RDF format that this parser can parse.- Specified by:
getRDFFormatin interfaceRDFParser- Overrides:
getRDFFormatin classJSONLDParser
-
getJSONObject
protected Object getJSONObject(InputStream in, Reader reader, com.fasterxml.jackson.core.JsonFactory factory) throws IOException
- Overrides:
getJSONObjectin classJSONLDParser- Throws:
IOException
-
parse
public void parse(InputStream in, String baseURI) throws RDFParseException, RDFHandlerException, IOException
Description copied from interface:RDFParserParses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.- Specified by:
parsein interfaceRDFParser- Overrides:
parsein classJSONLDParser- Parameters:
in- The InputStream from which to read the data.baseURI- The URI associated with the data in the InputStream. May benull. Parsers for syntax formats that do not support relative URIs will ignore this argument.Note that if the data contains an embedded base URI, that embedded base URI will overrule the value supplied here (see RFC 3986 section 5.1 for details).
- Throws:
RDFParseException- If the parser has found an unrecoverable parse error.RDFHandlerException- If the configured statement handler has encountered an unrecoverable error.IOException- If an I/O error occurred while data was read from the InputStream.
-
-