pub struct ContextResolver {
pub vocab: Option<String>,
pub prefixes: HashMap<String, String>,
pub terms: HashMap<String, TermDef>,
}Expand description
A resolved JSON-LD context that maps short terms to full IRIs.
Fields§
§vocab: Option<String>@vocab — default IRI prefix for unmapped terms
prefixes: HashMap<String, String>prefix:suffix mappings (e.g., “oo” -> “https://…#”)
terms: HashMap<String, TermDef>Direct term mappings (e.g., “Class” -> TermDef { iri, type_coercion })
Implementations§
Source§impl ContextResolver
impl ContextResolver
pub fn new() -> Self
Sourcepub fn from_context_value(
context_value: &JsonLdVal,
known_contexts: &HashMap<String, JsonLdVal>,
) -> Result<Self>
pub fn from_context_value( context_value: &JsonLdVal, known_contexts: &HashMap<String, JsonLdVal>, ) -> Result<Self>
Parse a JSON-LD @context value and build the resolver.
known_contexts maps context IRIs to their parsed JsonLdVal content.
Sourcepub fn expand_term(&self, term: &str) -> String
pub fn expand_term(&self, term: &str) -> String
Expand a compacted term to a full IRI.
Sourcepub fn compact_iri(&self, iri: &str) -> String
pub fn compact_iri(&self, iri: &str) -> String
Compact a full IRI back to a prefixed form.
Trait Implementations§
Source§impl Clone for ContextResolver
impl Clone for ContextResolver
Source§fn clone(&self) -> ContextResolver
fn clone(&self) -> ContextResolver
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextResolver
impl Debug for ContextResolver
Source§impl Default for ContextResolver
impl Default for ContextResolver
Source§fn default() -> ContextResolver
fn default() -> ContextResolver
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContextResolver
impl RefUnwindSafe for ContextResolver
impl Send for ContextResolver
impl Sync for ContextResolver
impl Unpin for ContextResolver
impl UnsafeUnpin for ContextResolver
impl UnwindSafe for ContextResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more