Package org.eclipse.rdf4j.rio.jsonld
Class JSONLDParser
- java.lang.Object
-
- org.eclipse.rdf4j.rio.helpers.AbstractRDFParser
-
- org.eclipse.rdf4j.rio.jsonld.JSONLDParser
-
- All Implemented Interfaces:
RDFParser
- Direct Known Subclasses:
NDJSONLDParser
public class JSONLDParser extends AbstractRDFParser
AnRDFParser
that links toJSONLDInternalTripleCallback
.
-
-
Field Summary
Fields Modifier and Type Field Description private static com.fasterxml.jackson.databind.ObjectMapper
JSON_MAPPER
-
Fields inherited from class org.eclipse.rdf4j.rio.helpers.AbstractRDFParser
rdfHandler, valueFactory
-
-
Constructor Summary
Constructors Constructor Description JSONLDParser()
Default constructorJSONLDParser(ValueFactory valueFactory)
Creates a JSONLD Parser using the givenValueFactory
to create newValue
s.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private com.fasterxml.jackson.core.JsonFactory
configureNewJsonFactory()
Get an instance of JsonFactory configured using the settings fromAbstractRDFParser.getParserConfig()
.protected java.lang.Object
getJSONObject(java.io.InputStream in, java.io.Reader reader, com.fasterxml.jackson.core.JsonFactory factory)
RDFFormat
getRDFFormat()
Gets the RDF format that this parser can parse.java.util.Collection<RioSetting<?>>
getSupportedSettings()
private void
parse(java.io.InputStream in, java.io.Reader reader, java.lang.String baseURI)
Parsevoid
parse(java.io.InputStream in, java.lang.String baseURI)
Parses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.void
parse(java.io.Reader reader, java.lang.String baseURI)
Parses the data from the supplied Reader, using the supplied baseURI to resolve any relative URI references.-
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, setNamespace, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setValueFactory
-
-
-
-
Constructor Detail
-
JSONLDParser
public JSONLDParser()
Default constructor
-
JSONLDParser
public JSONLDParser(ValueFactory valueFactory)
Creates a JSONLD Parser using the givenValueFactory
to create newValue
s.- Parameters:
valueFactory
- The ValueFactory to use
-
-
Method Detail
-
getRDFFormat
public RDFFormat getRDFFormat()
Description copied from interface:RDFParser
Gets the RDF format that this parser can parse.
-
getSupportedSettings
public java.util.Collection<RioSetting<?>> getSupportedSettings()
- Specified by:
getSupportedSettings
in interfaceRDFParser
- Overrides:
getSupportedSettings
in classAbstractRDFParser
- Returns:
- A collection of
RioSetting
s that are supported by this RDFParser.
-
parse
public void parse(java.io.InputStream in, java.lang.String baseURI) throws java.io.IOException, RDFParseException, RDFHandlerException
Description copied from interface:RDFParser
Parses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.- 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:
java.io.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 has encountered an unrecoverable error.
-
parse
public void parse(java.io.Reader reader, java.lang.String baseURI) throws java.io.IOException, RDFParseException, RDFHandlerException
Description copied from interface:RDFParser
Parses the data from the supplied Reader, using the supplied baseURI to resolve any relative URI references.- Parameters:
reader
- The Reader 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:
java.io.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 has encountered an unrecoverable error.
-
parse
private void parse(java.io.InputStream in, java.io.Reader reader, java.lang.String baseURI) throws java.io.IOException, RDFParseException, RDFHandlerException
Parse- Parameters:
in
-reader
-baseURI
-- Throws:
java.io.IOException
RDFParseException
RDFHandlerException
-
getJSONObject
protected java.lang.Object getJSONObject(java.io.InputStream in, java.io.Reader reader, com.fasterxml.jackson.core.JsonFactory factory) throws java.io.IOException
- Throws:
java.io.IOException
-
configureNewJsonFactory
private com.fasterxml.jackson.core.JsonFactory configureNewJsonFactory()
Get an instance of JsonFactory configured using the settings fromAbstractRDFParser.getParserConfig()
.- Returns:
- A newly configured JsonFactory based on the currently enabled settings
-
-