Skip to main content

Crate jsonld_compaction

Crate jsonld_compaction 

Source
Expand description

Implementation of the JSON-LD compaction algorithms.

Compaction turns an expanded JSON-LD document back into the terse, human-friendly shape described by a @context: IRIs become terms or compact IRIs, single-element arrays collapse, and value objects reduce to plain JSON scalars wherever the context makes that lossless.

Compact compacts a whole document (an ExpandedDocument or a FlattenedDocument) and embeds the @context used into the output. CompactFragment compacts a single object, node, list or collection against an already-processed active context, and is what the document-level algorithm recurses through.

This crate is the compaction half of the jsonld family; the jsonld crate re-exports it behind a processor API that also handles expansion, flattening and RDF serialization.

Structs§

IriConfusedWithPrefix
An IRI cannot be written out because it would be read back as a compact IRI.
Options
Compaction options.

Enums§

Error
Error raised while compacting a document.

Traits§

Compact
Whole documents that can be compacted against a processed @context.
CompactFragment
Document fragments that can be compacted against an active context.
CompactIndexedFragment
Document fragments that carry an @index separately from their own contents.
EmbedContext
Documents that a @context can be embedded into.

Type Aliases§

CompactDocumentResult
Result of compacting a whole document.
CompactFragmentResult
Result of compacting a document fragment.