package rdf_json_ld

  1. Overview
  2. Docs

Module Rdf_json_ld.Json_ldSource

JSON-LD API.

Only minimum functions to communicate with JSON-LD are implemented, i.e. context processing, expansion, deserialization and serialization.

Use of JSON-LD should be avoided when possible.

Sourceval init_ctx : Iri.t -> Expand.ctx

Initialize an expansion context from the given base IRI.

Sourceval ctx_of_options : T.options -> Iri.t -> Expand.ctx Lwt.t

Same as init_ctx but will use the provided T.options to initialize a context. This includes downloading and processing an optional "expand context".

Sourceval expansion : T.options -> ?frame_expansion:bool -> Expand.ctx -> J.json -> Iri.t -> J.json Lwt.t

expansion options context json base expands the given json value in context, with base IRI, honouring options. Optional argument frame_expansion is supposed to work as specified here (default is false).

to_rdf options json graph builds a context from options, expands the json value (using graph name as base IRI), then applies the node map generation and JSON-LD to RDF algorithms to build the returned dataset. The provided graph is the default graph of the returned dataset. The function also returns the optional root IRI if there is only one root object and it has an @id.

from_rdf options dataset serializes the given dataset to a JSON-LD value, honouring options. Beware that the specified RDF to JSON-LD algorithm is not implemented, but a simpler version returning some flat (but correct) JSON-LD.

from_rdf_root options graph root serializes the given graph to a JSON-LD value, with a single object starting from root term, honouring options. Beware that the specified RDF to JSON-LD algorithm is not implemented, but a simpler version returning some flat (but correct) JSON-LD. Lists are represented using json list, though.