Struct json_ld::Options

source ·
pub struct Options<I = Index, M = Location<I>, C = Value<M>> {
    pub base: Option<I>,
    pub compact_arrays: bool,
    pub compact_to_relative: bool,
    pub expand_context: Option<RemoteDocumentReference<I, M, C>>,
    pub ordered: bool,
    pub processing_mode: ProcessingMode,
    pub rdf_direction: Option<RdfDirection>,
    pub produce_generalized_rdf: bool,
    pub expansion_policy: Policy,
}
Expand description

JSON-LD Processor options.

Fields§

§base: Option<I>

The base IRI to use when expanding or compacting the document.

If set, this overrides the input document’s IRI.

§compact_arrays: bool

If set to true, the JSON-LD processor replaces arrays with just one element with that element during compaction.

If set to false, all arrays will remain arrays even if they have just one element.

Defaults to true.

§compact_to_relative: bool

Determines if IRIs are compacted relative to the base option or document location when compacting.

Defaults to true.

§expand_context: Option<RemoteDocumentReference<I, M, C>>

A context that is used to initialize the active context when expanding a document.

§ordered: bool

If set to true, certain algorithm processing steps where indicated are ordered lexicographically.

If false, order is not considered in processing.

Defaults to false.

§processing_mode: ProcessingMode

Sets the processing mode.

Defaults to ProcessingMode::JsonLd1_1.

§rdf_direction: Option<RdfDirection>

Determines how value objects containing a base direction are transformed to and from RDF.

  • If set to RdfDirection::I18nDatatype, an RDF literal is generated using a datatype IRI based on https://www.w3.org/ns/i18n# with both the language tag (if present) and base direction encoded. When transforming from RDF, this datatype is decoded to create a value object containing @language (if present) and @direction.
  • If set to RdfDirection::CompoundLiteral, a blank node is emitted instead of a literal, where the blank node is the subject of rdf:value, rdf:direction, and rdf:language (if present) properties. When transforming from RDF, this object is decoded to create a value object containing @language (if present) and @direction.
§produce_generalized_rdf: bool

If set to true, the JSON-LD processor may emit blank nodes for triple predicates, otherwise they will be omitted. See https://www.w3.org/TR/rdf11-concepts/.

The use of blank node identifiers to label properties is obsolete, and may be removed in a future version of JSON-LD, as is the support for generalized RDF Datasets and thus this option may be also be removed.

§expansion_policy: Policy

Term expansion policy, passed to the document expansion algorithm.

Implementations§

Returns these options with the ordered flag set to false.

This means entries will not be ordered by keys before being processed.

Returns these options with the expand_context set to the given context.

Builds options for the context processing algorithm from these options.

Builds options for the expansion algorithm from these options.

Builds options for the compaction algorithm from these options.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Wraps self inside a Meta<Self, M> using the given metadata. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.