JSON.LD.Encoder (JSON-LD.ex v1.0.0)
View SourceAn encoder for JSON-LD serializations of RDF.ex data structures.
As for all encoders of RDF.Serialization.Formats, you normally won't use these
functions directly, but via one of the write_ functions on the JSON.LD
format module or the generic RDF.Serialization module.
Options
:context: When a context map or remote context URL string is given, compaction is performed using this context:base: : Allows to specify a base URI to be used during compaction (only when:contextis provided). Default is the base IRI of the encoded graph or if none present or in case of encoded datasets theRDF.default_base_iri/0.:use_native_types: If this flag is set totrue, RDF literals with a datatype IRI that equalsxsd:integerorxsd:doubleare converted to a JSON numbers and RDF literals with a datatype IRI that equalsxsd:booleanare converted totrueorfalsebased on their lexical form. (default:false):use_rdf_type: Unless this flag is set totrue,rdf:typepredicates will be serialized as@typeas long as the associated object is either an IRI or blank node identifier. (default:false)
The given options are also passed through to Jason.encode/2, so you can also
provide any the options this function supports, most notably the :pretty option.
Summary
Types
@type input() :: RDF.Dataset.t() | RDF.Description.t() | RDF.Graph.t()
Functions
@spec from_rdf(RDF.Data.t(), JSON.LD.Options.t() | Enum.t()) :: {:ok, [map()]} | {:error, any()}
@spec from_rdf!(RDF.Data.t(), JSON.LD.Options.t() | Enum.t()) :: [map()]