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 ofrdf:value
,rdf:direction
, andrdf: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>
impl<I> Options<I>
sourcepub fn unordered(self) -> Self
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.
sourcepub fn with_expand_context(self, context: RemoteContextReference<I>) -> Self
pub fn with_expand_context(self, context: RemoteContextReference<I>) -> Self
Returns these options with the expand_context
set to the given
context
.
sourcepub fn context_processing_options(&self) -> Options
pub fn context_processing_options(&self) -> Options
Builds options for the context processing algorithm from these options.
sourcepub fn expansion_options(&self) -> Options
pub fn expansion_options(&self) -> Options
Builds options for the expansion algorithm from these options.
sourcepub fn compaction_options(&self) -> Options
pub fn compaction_options(&self) -> Options
Builds options for the compaction algorithm from these options.