pub fn compact_value(
active_ctx: &JsonLdContext,
active_property: Option<&str>,
value: &JsonLdValue,
) -> Result<JsonLdValue, CompactionError>Expand description
Compact a JSON-LD value object.
Applies the W3C JSON-LD 1.1 Value Compaction algorithm: https://www.w3.org/TR/json-ld11-api/#value-compaction
§Compaction rules
- If the value is
{"@value": v, "@type": "@json"}— keep as-is. - If the value has
@typeand the active property’s term has a matching type mapping — drop the@typeand@valuewrapper. - If the value has
@languageand the active property’s term has a matching language mapping — drop the wrapper. - Plain string values without type/language — drop
@valuewrapper. - Numeric and boolean values — return native JSON representation.
§Arguments
active_ctx— the active contextactive_property— the property whose value is being compactedvalue— the expanded value object