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
An
RDFParser that links to JSONLDInternalTripleCallback.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.fasterxml.jackson.databind.ObjectMapperFields inherited from class AbstractRDFParser
rdfHandler, valueFactory -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorJSONLDParser(ValueFactory valueFactory) Creates a JSONLD Parser using the givenValueFactoryto create newValues. -
Method Summary
Modifier and TypeMethodDescriptionprivate com.fasterxml.jackson.core.JsonFactoryGet an instance of JsonFactory configured using the settings fromAbstractRDFParser.getParserConfig().protected ObjectgetJSONObject(InputStream in, Reader reader, com.fasterxml.jackson.core.JsonFactory factory) Gets the RDF format that this parser can parse.Collection<RioSetting<?>> private voidparse(InputStream in, Reader reader, String baseURI) Parsevoidparse(InputStream in, String baseURI) Parses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.voidParses the data from the supplied Reader, using the supplied baseURI to resolve any relative URI references.Methods inherited from class 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
-
Field Details
-
JSON_MAPPER
private static final com.fasterxml.jackson.databind.ObjectMapper JSON_MAPPER
-
-
Constructor Details
-
JSONLDParser
public JSONLDParser()Default constructor -
JSONLDParser
Creates a JSONLD Parser using the givenValueFactoryto create newValues.- Parameters:
valueFactory- The ValueFactory to use
-
-
Method Details
-
getRDFFormat
-
getSupportedSettings
- Specified by:
getSupportedSettingsin interfaceRDFParser- Overrides:
getSupportedSettingsin classAbstractRDFParser- Returns:
- A collection of
RioSettings that are supported by this RDFParser.
-
parse
public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException Description copied from interface:RDFParserParses 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:
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(Reader reader, String baseURI) throws IOException, RDFParseException, RDFHandlerException Description copied from interface:RDFParserParses 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:
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(InputStream in, Reader reader, String baseURI) throws IOException, RDFParseException, RDFHandlerException Parse- Parameters:
in-reader-baseURI-- Throws:
IOExceptionRDFParseExceptionRDFHandlerException
-
getJSONObject
protected Object getJSONObject(InputStream in, Reader reader, com.fasterxml.jackson.core.JsonFactory factory) throws IOException - Throws:
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
-