Package org.apache.jena.riot.lang
Class JsonLDReader
java.lang.Object
org.apache.jena.riot.lang.JsonLDReader
- All Implemented Interfaces:
ReaderRIOT
One can pass a jsonld context using the (jena) Context mechanism, defining a (jena) Context
(sorry for this clash of "contexts"), (cf. last argument in
ReaderRIOT.read(InputStream in, String baseURI, ContentType ct, StreamRDF output, Context context))
with:
Context jenaContext = new Context() jenaCtx.set(JsonLdReader.JSONLD_CONTEXT, contextAsJsonString);where contextAsJsonString is a JSON string containing the value of the "@context". It is also possible to define the different options supported by JSONLD-java using the
JSONLD_OPTIONS Symbol
The JsonLDReadContext is a convenience class that extends Context and
provides methods to set the values of these different Symbols that are used in controlling the writing of JSON-LD.
Note: it is possible to override jsonld's "@context" value by providing one,
using a Context, and setting the JSONLD_CONTEXT Symbol's value
to the data expected by JSON-LD java API (a Map).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Stringstatic Stringstatic final SymbolSymbol to use to pass (in a Context object) the "@context" to be used when reading jsonld (overriding the actual @context in the jsonld) Expected value: the value of the "@context", as expected by the JSONLD-java API (a Map)static final Symbolvalue: the option object expected by JsonLdProcessor (instance of JsonLdOptions)static String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidread(InputStream in, String baseURI, ContentType ct, StreamRDF output, Context context) Read from an InputStream and output RDF on the StreamRDF.voidRead from an InputStream and output RDF on the StreamRDF.
-
Field Details
-
JSONLD_CONTEXT
Symbol to use to pass (in a Context object) the "@context" to be used when reading jsonld (overriding the actual @context in the jsonld) Expected value: the value of the "@context", as expected by the JSONLD-java API (a Map) -
JSONLD_OPTIONS
value: the option object expected by JsonLdProcessor (instance of JsonLdOptions) -
LITERAL
-
BLANK_NODE
-
IRI
-
-
Constructor Details
-
JsonLDReader
-
-
Method Details
-
read
Description copied from interface:ReaderRIOTRead from an InputStream and output RDF on the StreamRDF.- Specified by:
readin interfaceReaderRIOT- Parameters:
reader- Reader. InputStreams are preferred because Reader do not allow RIOT to set the character set.baseURI- Base URI (or null)ct- Content-Type if available. Routing to the right parser will have already been done so this only useful to get addition Content-Type information or if this ReaderRIOT can handle multiple media types.output- Destination for the parser output.context- Environment settings.
-
read
Description copied from interface:ReaderRIOTRead from an InputStream and output RDF on the StreamRDF.- Specified by:
readin interfaceReaderRIOT- Parameters:
in- InputStreambaseURI- Base URI (or null)ct- Content-Type if available. Routing to the right parser will have already been done so this only useful to get addition Content-Type information or if this ReaderRIOT can handle multiple media types.output- Destination for the parser output.context- Environment settings.
-