package rdf_json_ld

  1. Overview
  2. Docs

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.

val init_ctx : Iri.t -> Expand.ctx

Initialize an expansion context from the given base IRI.

val 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".

val 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.

val from_rdf : T.options -> Rdf.Ds.dataset -> J.json

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.

OCaml

Innovation. Community. Security.