pub trait Context<T: Id = IriBuf>: Clone {
type LocalContext: Local<T>;
fn new(base_iri: Option<Iri<'_>>) -> Self;
fn get(&self, term: &str) -> Option<&TermDefinition<T, Self>>;
fn original_base_url(&self) -> Option<Iri<'_>>;
fn base_iri(&self) -> Option<Iri<'_>>;
fn vocabulary(&self) -> Option<&Term<T>>;
fn default_language(&self) -> Option<LenientLanguageTag<'_>>;
fn default_base_direction(&self) -> Option<Direction>;
fn previous_context(&self) -> Option<&Self>;
fn definitions<'a>(
&'a self
) -> Box<dyn Iterator<Item = (&'a String, &'a TermDefinition<T, Self>)> + 'a>;
fn get_opt(&self, term: Option<&str>) -> Option<&TermDefinition<T, Self>> { ... }
fn contains(&self, term: &str) -> bool { ... }
}
Expand description
JSON-LD context.
A context holds all the term definitions used to expand a JSON-LD value.
Associated Types
type LocalContext: Local<T>
type LocalContext: Local<T>
The type of local contexts associated to this type of contexts.
Required methods
Create a newly-initialized active context with the given base IRI.
fn get(&self, term: &str) -> Option<&TermDefinition<T, Self>>
fn get(&self, term: &str) -> Option<&TermDefinition<T, Self>>
Get the definition of a term.
fn original_base_url(&self) -> Option<Iri<'_>>
fn original_base_url(&self) -> Option<Iri<'_>>
Original base URL of the context.
fn vocabulary(&self) -> Option<&Term<T>>
fn vocabulary(&self) -> Option<&Term<T>>
Optional vocabulary mapping.
fn default_language(&self) -> Option<LenientLanguageTag<'_>>
fn default_language(&self) -> Option<LenientLanguageTag<'_>>
Optional default language.
fn default_base_direction(&self) -> Option<Direction>
fn default_base_direction(&self) -> Option<Direction>
Optional default base direction.
fn previous_context(&self) -> Option<&Self>
fn previous_context(&self) -> Option<&Self>
Get the previous context.