pub struct Context<T, B, L, M> { /* private fields */ }
Expand description
JSON-LD context.
Implementations§
source§impl<T, B, L, M> Context<T, B, L, M>
impl<T, B, L, M> Context<T, B, L, M>
sourcepub fn new(base_iri: Option<T>) -> Context<T, B, L, M>where
T: Clone,
pub fn new(base_iri: Option<T>) -> Context<T, B, L, M>where
T: Clone,
Create a new context with the given base IRI.
sourcepub fn get<Q>(&self, term: &Q) -> Option<TermDefinitionRef<'_, T, B, L, M>>where
Key: Borrow<Q>,
KeywordType: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get<Q>(&self, term: &Q) -> Option<TermDefinitionRef<'_, T, B, L, M>>where
Key: Borrow<Q>,
KeywordType: Borrow<Q>,
Q: Hash + Eq + ?Sized,
Returns a reference to the given term
definition, if any.
sourcepub fn get_normal<Q>(
&self,
term: &Q
) -> Option<&NormalTermDefinition<T, B, L, M>>where
Key: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get_normal<Q>(
&self,
term: &Q
) -> Option<&NormalTermDefinition<T, B, L, M>>where
Key: Borrow<Q>,
Q: Hash + Eq + ?Sized,
Returns a reference to the given term
normal definition, if any.
sourcepub fn get_type(&self) -> Option<&TypeTermDefinition>
pub fn get_type(&self) -> Option<&TypeTermDefinition>
Returns a reference to the @type
definition, if any.
sourcepub fn contains_term<Q>(&self, term: &Q) -> boolwhere
Key: Borrow<Q>,
KeywordType: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn contains_term<Q>(&self, term: &Q) -> boolwhere
Key: Borrow<Q>,
KeywordType: Borrow<Q>,
Q: Hash + Eq + ?Sized,
Checks if the given term
is defined.
sourcepub fn original_base_url(&self) -> Option<&T>
pub fn original_base_url(&self) -> Option<&T>
Returns the original base URL of the context.
sourcepub fn vocabulary(&self) -> Option<&Term<T, B>>
pub fn vocabulary(&self) -> Option<&Term<T, B>>
Returns the @vocab
value, if any.
sourcepub fn default_language(&self) -> Option<LenientLanguageTag<'_>>
pub fn default_language(&self) -> Option<LenientLanguageTag<'_>>
Returns the default @language
value.
sourcepub fn default_base_direction(&self) -> Option<Direction>
pub fn default_base_direction(&self) -> Option<Direction>
Returns the default @direction
value.
sourcepub fn previous_context(&self) -> Option<&Context<T, B, L, M>>
pub fn previous_context(&self) -> Option<&Context<T, B, L, M>>
Returns a reference to the previous context.
sourcepub fn definitions(&self) -> &Definitions<T, B, L, M>
pub fn definitions(&self) -> &Definitions<T, B, L, M>
Returns a handle to the term definitions.
sourcepub fn has_protected_items(&self) -> bool
pub fn has_protected_items(&self) -> bool
Checks if the context has a protected definition.
sourcepub fn inverse(&self) -> &InverseContext<T, B>where
T: Clone + Hash + Eq,
B: Clone + Hash + Eq,
pub fn inverse(&self) -> &InverseContext<T, B>where
T: Clone + Hash + Eq,
B: Clone + Hash + Eq,
Returns the inverse of this context.
sourcepub fn set_normal(
&mut self,
key: Key,
definition: Option<NormalTermDefinition<T, B, L, M>>
) -> Option<NormalTermDefinition<T, B, L, M>>
pub fn set_normal(
&mut self,
key: Key,
definition: Option<NormalTermDefinition<T, B, L, M>>
) -> Option<NormalTermDefinition<T, B, L, M>>
Sets the normal definition for the given term key
.
sourcepub fn set_type(
&mut self,
type_: Option<TypeTermDefinition>
) -> Option<TypeTermDefinition>
pub fn set_type(
&mut self,
type_: Option<TypeTermDefinition>
) -> Option<TypeTermDefinition>
Sets the @type
definition.
sourcepub fn set_base_iri(&mut self, iri: Option<T>)
pub fn set_base_iri(&mut self, iri: Option<T>)
Sets the base IRI.
sourcepub fn set_vocabulary(&mut self, vocab: Option<Term<T, B>>)
pub fn set_vocabulary(&mut self, vocab: Option<Term<T, B>>)
Sets the @vocab
value.
sourcepub fn set_default_language(&mut self, lang: Option<LenientLanguageTagBuf>)
pub fn set_default_language(&mut self, lang: Option<LenientLanguageTagBuf>)
Sets the default @language
value.
sourcepub fn set_default_base_direction(&mut self, dir: Option<Direction>)
pub fn set_default_base_direction(&mut self, dir: Option<Direction>)
Sets the default @direction
value.
sourcepub fn set_previous_context(&mut self, previous: Context<T, B, L, M>)
pub fn set_previous_context(&mut self, previous: Context<T, B, L, M>)
Sets the previous context.
sourcepub fn into_syntax_definition(
self,
vocabulary: &impl Vocabulary<Iri = T, BlankId = B>,
meta: M
) -> Meta<Definition<M, Value<M>>, M>where
L: IntoSyntax<T, B, M>,
M: Clone,
pub fn into_syntax_definition(
self,
vocabulary: &impl Vocabulary<Iri = T, BlankId = B>,
meta: M
) -> Meta<Definition<M, Value<M>>, M>where
L: IntoSyntax<T, B, M>,
M: Clone,
Converts this context into its syntactic definition.