pub fn compact_node_reference<N>(
vocabulary: &N,
id: &Id<N::Iri, N::BlankId>,
index: Option<&str>,
active_context: &Context<N::Iri, N::BlankId>,
active_property: Option<&str>,
options: Options,
) -> Result<Value, IriConfusedWithPrefix>Expand description
Compacts a node reference, a node object whose only entry is @id,
against an active context in which the active property’s scoped context
is already in force.
Follows step 7 of the value compaction algorithm: under a term whose
type mapping is @id the reference becomes the @id compacted as an IRI
reference (vocab set to false), under a term whose type mapping is
@vocab it becomes the @id compacted with vocab set to true, and in
either case index is dropped. Otherwise the result is an object holding
the @id, compacted with vocab set to false, under the active
context’s alias of @id, plus index under the alias of @index unless
the active property’s container mapping includes @index.
active_property is the compacted term the reference is written under,
or None at the top level. When that term defines a scoped @context,
active_context must be the result of processing it on top of the
context the term was selected in; a node reference does not revert a
term-scoped context to the previous context, and type-scoped contexts do
not apply because a reference has no @type. This is synchronous and
needs no loader.
§Errors
Returns IriConfusedWithPrefix when the @id can only be written out
in full and would then be read back as a compact IRI.