Struct json_ld::Options

source ·
pub struct Options<I = IriBuf> {
    pub base: Option<I>,
    pub compact_arrays: bool,
    pub compact_to_relative: bool,
    pub expand_context: Option<RemoteContextReference<I>>,
    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<RemoteContextReference<I>>

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§

source§

impl<I> Options<I>

source

pub fn unordered(self) -> Self

Returns these options with the ordered flag set to false.

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

source

pub fn with_expand_context(self, context: RemoteContextReference<I>) -> Self

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

source

pub fn context_processing_options(&self) -> Options

Builds options for the context processing algorithm from these options.

source

pub fn expansion_options(&self) -> Options

Builds options for the expansion algorithm from these options.

source

pub fn compaction_options(&self) -> Options

Builds options for the compaction algorithm from these options.

Trait Implementations§

source§

impl<I: Clone> Clone for Options<I>

source§

fn clone(&self) -> Options<I>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I> Default for Options<I>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<I> Freeze for Options<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for Options<I>
where I: RefUnwindSafe,

§

impl<I> Send for Options<I>
where I: Send,

§

impl<I> Sync for Options<I>
where I: Sync,

§

impl<I> Unpin for Options<I>
where I: Unpin,

§

impl<I> UnwindSafe for Options<I>
where I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> At for T

source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> BorrowStripped for T

source§

fn stripped(&self) -> &Stripped<T>

source§

impl<T> BorrowUnordered for T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, C> FromWithContext<T, C> for T

source§

fn from_with(value: T, _context: &C) -> T

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

source§

fn into_with(self, context: &C) -> U

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToOwned for T

§

type Owned = T

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

§

type Error = Infallible

source§

fn try_from_with( value: U, context: &C ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

§

type Error = <U as TryFromWithContext<T, C>>::Error

source§

fn try_into_with( self, context: &C ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

source§

impl<T> WithContext for T
where T: ?Sized,

source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

source§

fn into_with<C>(self, context: C) -> Contextual<T, C>

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more