Expand description
Implementation of the JSON-LD 1.1 Expansion algorithm.
Expansion rewrites a JSON-LD document into a regular form: terms and
compact IRIs become full IRIs, the defaults a context sets (@base,
@vocab, @language…) are applied to every value, and the @context
entries themselves disappear. It is the first step of almost every other
JSON-LD algorithm, since it removes the many ways the syntax offers to say
the same thing.
The algorithm operates on the JSON syntax tree of the jstrict crate and
produces the ExpandedDocument type of the jsonld-core crate.
§Usage
Expansion is exposed by the Expand trait, implemented for
jstrict::Value (a parsed JSON document) and for RemoteDocument
(a parsed JSON document along with the URL it comes from, used to resolve
relative IRI references).
Most users will not depend on this crate directly but on the
jsonld crate, which re-exports
Expand next to the other JSON-LD algorithms.
Structs§
- Context
- Active context: everything the algorithms need to expand or compact against the current scope.
- Environment
- Vocabulary, loader and warning handler an algorithm runs against.
- Expanded
Document - Result of the document expansion algorithm: a set of (indexed) objects.
- NotA
Literal - Error raised when value expansion is asked to expand something that is not a JSON scalar, such as an array or an object.
- Options
- Expansion options.
- Policy
- Key expansion policy.
- Remote
Document - Remote document.
Enums§
- Action
- How strictly to treat a term whose expansion is questionable.
- Error
- Error raised while expanding a document.
- Expanded
- Result of expanding a fragment of a JSON-LD document.
- Into
Iter - Owning iterator over the objects of an expansion result.
- Invalid
Value - Error raised while expanding a value object, a map with an
@valueentry. - Iter
- Iterator over the objects of an expansion result.
- Literal
Expansion Error - Error raised while expanding a scalar into a literal or a node reference.
- Slice
Expansion Error - Error of
expand_slice. - Warning
- Warning raised while expanding a document.
Traits§
- Expand
- Document expansion.
- Loader
- Document loader.
- Warning
Handler - Handler for the warnings emitted while expanding a JSON-LD document.
Functions§
- expand_
slice - Expands the JSON-LD document whose JSON text is
bytes.
Type Aliases§
- Expansion
Result - Result of a document expansion, where
Eis the error type of the document loader used to fetch the remote contexts.