pub fn compact_iri<N>(
vocabulary: &N,
active_context: &Context<N::Iri, N::BlankId>,
var: &Term<N::Iri, N::BlankId>,
vocab: bool,
reverse: bool,
options: Options,
) -> Result<Option<Arc<str>>, IriConfusedWithPrefix>Expand description
Compacts var into a term, compact IRI or relative IRI reference, without
considering any value.
Runs the IRI compaction algorithm with no value, which is how keys,
@type values, @id values and the values of @vocab-typed terms are
compacted. vocab is true where @vocab applies (keys, @type values,
@vocab-typed values) and false for @id values, which may then become
IRI references relative to the active context’s base IRI. reverse
restricts selection to terms declared with @reverse. Only
options.processing_mode is read.
active_context is a processed context, typically the one
Process produced for the
document’s @context. Returns None when var is Term::Null.
Memoized per active context: a repeated (var, vocab, reverse, processing mode) lookup returns the cached result instead of rerunning the algorithm.
The processing mode belongs in the key because term selection depends on
it — an @index container term, for instance, is only eligible for an
index-less value under JSON-LD 1.1.
§Errors
Returns IriConfusedWithPrefix when var can only be written out in
full and would then be read back as a compact IRI.