JSON.LD (JSON-LD.ex v0.3.3) View Source

Link to this section Summary

Functions

Compacts the given input according to the steps in the JSON-LD Compaction Algorithm.

Expands the given input according to the steps in the JSON-LD Expansion Algorithm.

Flattens the given input according to the steps in the JSON-LD Flattening Algorithm.

Returns if the given value is a JSON-LD keyword.

The set of all JSON-LD keywords.

Generator function for JSON-LD node maps.

Link to this section Functions

Link to this function

compact(input, context, options \\ %Options{})

View Source

Specs

compact(map() | [map()], map() | nil, JSON.LD.Options.t() | Enum.t()) :: map()

Compacts the given input according to the steps in the JSON-LD Compaction Algorithm.

Compaction is the process of applying a developer-supplied context to shorten IRIs to terms or compact IRIs and JSON-LD values expressed in expanded form to simple values such as strings or numbers. Often this makes it simpler to work with document as the data is expressed in application-specific terms. Compacted documents are also typically easier to read for humans.

-- https://www.w3.org/TR/json-ld/#compacted-document-form

Details at https://www.w3.org/TR/json-ld-api/#compaction-algorithms

Link to this function

context(args, opts \\ %Options{})

View Source

Specs

Generator function for JSON.LD.Contexts.

You can either pass a map with a "@context" key having the JSON-LD context object its value, or the JSON-LD context object directly.

Link to this function

expand(input, options \\ %Options{})

View Source

Specs

expand(map(), JSON.LD.Options.t() | Enum.t()) :: [map()]

Expands the given input according to the steps in the JSON-LD Expansion Algorithm.

Expansion is the process of taking a JSON-LD document and applying a @context such that all IRIs, types, and values are expanded so that the @context is no longer necessary.

-- https://www.w3.org/TR/json-ld/#expanded-document-form

Details at http://json-ld.org/spec/latest/json-ld-api/#expansion-algorithm

Link to this function

flatten(input, context \\ nil, options \\ %Options{})

View Source

Specs

flatten(map() | [map()], map() | nil, JSON.LD.Options.t() | Enum.t()) :: [map()]

Flattens the given input according to the steps in the JSON-LD Flattening Algorithm.

Flattening collects all properties of a node in a single JSON object and labels all blank nodes with blank node identifiers. This ensures a shape of the data and consequently may drastically simplify the code required to process JSON-LD in certain applications.

-- https://www.w3.org/TR/json-ld/#flattened-document-form

Details at https://www.w3.org/TR/json-ld-api/#flattening-algorithms

Specs

keyword?(String.t()) :: boolean()

Returns if the given value is a JSON-LD keyword.

Specs

keywords() :: [String.t()]

The set of all JSON-LD keywords.

see https://www.w3.org/TR/json-ld/#syntax-tokens-and-keywords

Link to this function

node_map(input, node_id_map \\ nil)

View Source

Specs

node_map([map()], pid() | nil) :: map()

Generator function for JSON-LD node maps.

Link to this function

read_file(file, opts \\ [])

View Source

Specs

read_file(Path.t(), keyword()) ::
  {:ok, RDF.Graph.t() | RDF.Dataset.t()} | {:error, any()}
Link to this function

read_file!(file, opts \\ [])

View Source

Specs

read_file!(Path.t(), keyword()) :: RDF.Graph.t() | RDF.Dataset.t()
Link to this function

read_string(content, opts \\ [])

View Source

Specs

read_string(String.t(), keyword()) ::
  {:ok, RDF.Graph.t() | RDF.Dataset.t()} | {:error, any()}
Link to this function

read_string!(content, opts \\ [])

View Source

Specs

read_string!(String.t(), keyword()) :: RDF.Graph.t() | RDF.Dataset.t()
Link to this function

write_file(data, path, opts \\ [])

View Source

Specs

write_file(RDF.Graph.t() | RDF.Dataset.t(), Path.t(), keyword()) ::
  :ok | {:error, any()}
Link to this function

write_file!(data, path, opts \\ [])

View Source

Specs

write_file!(RDF.Graph.t() | RDF.Dataset.t(), Path.t(), keyword()) :: :ok
Link to this function

write_string(data, opts \\ [])

View Source

Specs

write_string(RDF.Graph.t() | RDF.Dataset.t(), keyword()) ::
  {:ok, String.t()} | {:error, any()}
Link to this function

write_string!(data, opts \\ [])

View Source

Specs

write_string!(RDF.Graph.t() | RDF.Dataset.t(), keyword()) :: String.t()