JSON.LD.Options (JSON-LD.ex v1.0.0)

View Source

Options accepted by the JSON-LD processing algorithms.

as specified at https://www.w3.org/TR/json-ld11-api/#the-jsonldoptions-type

Additional options

Besides the standard JSON-LD options described in the specification, this implementation provides the following additional options:

  • :lowercase_language - When set to true (default), language tags are automatically converted to lowercase during processing.

  • :warn - Configures how warnings are handled during processing. Possible values:

    • :default - Uses the value from the application config (defaults to :log)
    • :ignore - Silently ignores warnings
    • :raise - Raises an exception on warnings
    • :log - Logs warnings using Logger
    • true - Same as :default
    • false - Same as :ignore
    • A function accepting a message string

    The default warning behavior can be configured in your application config:

    config :json_ld,
      warn: :log  # or any other valid warning option, except :default

Limitations

The :produce_generalized_rdf option is currently not supported due to lack of Generalized RDF support in RDF.ex.

Summary

Types

convertible()

@type convertible() :: t() | keyword() | Enum.t()

t()

@type t() :: %JSON.LD.Options{
  base: String.t() | nil,
  compact_arrays: boolean(),
  compact_to_relative: boolean(),
  document_loader: nil,
  expand_context: map() | String.t() | nil,
  extract_all_scripts: boolean(),
  frame_expansion: boolean(),
  lowercase_language: boolean(),
  ordered: boolean(),
  processing_mode: String.t(),
  produce_generalized_rdf: boolean(),
  profile: String.t() | nil,
  rdf_direction: String.t() | nil,
  request_profile: String.t() | [String.t()] | nil,
  use_native_types: boolean(),
  use_rdf_type: boolean(),
  warn: warn_method()
}

warn_method()

@type warn_method() ::
  :default | :ignore | :raise | :log | boolean() | (binary() -> any())

Functions

extract(options)

new()

@spec new() :: t()

new(options)

@spec new(convertible()) :: t()

set_base(options, base)

@spec set_base(t(), RDF.IRI.coercible()) :: t()

warn_default()