Skip to main content

compact_node

Function compact_node 

Source
pub fn compact_node(
    active_ctx: &JsonLdContext,
    _type_scoped_ctx: &JsonLdContext,
    _active_property: Option<&str>,
    node: &IndexMap<String, JsonLdValue>,
    options: &CompactionOptions,
) -> Result<JsonLdValue, CompactionError>
Expand description

Compact a node object.

This implements the node object compaction portion of the W3C JSON-LD 1.1 Compaction Algorithm.

§Steps (abbreviated)

  1. Compact @id, @type using context term definitions.
  2. Handle @reverse properties.
  3. Handle container types (@index, @graph, @set, @list, @language).
  4. Recursively compact all property values.

§Arguments

  • active_ctx — the current active context
  • type_scoped_ctx — type-scoped context (may differ from active_ctx when types change it)
  • active_property — the property under which this node appears
  • node — the expanded node object map
  • options — compaction options