Struct WithGenerator

Source
pub struct WithGenerator<G, I = ()> { /* private fields */ }
Expand description

Combines any RDF interpretation with a node id generator to make it implement InterpretationMut.

§Use cases

§() does not implement InterpretationMut

The transparent interpretation (the unit type ()) does not implement InterpretationMut because the new_resource method would require the creation of a fresh, unused, blank node identifier, which the transparent interpretation cannot create without a node id generator.

§Resources returned by InterpretationMut::new_resource have no lexical representation

Interpreted resources are not required to have a lexical representation. This is most probably the case for new resources returned by InterpretationMut::new_resource. You can use WithGenerator to pair the interpretation with a node id generator so that new_resource will assign a lexical representation to new resources (a fresh blank node id for instance).

Implementations§

Source§

impl<G, I> WithGenerator<G, I>

Source

pub fn new(interpretation: I, generator: G) -> Self

Source

pub fn into_parts(self) -> (I, G)

Source

pub fn inner_interpretation(&self) -> &I

Source

pub fn inner_interpretation_mut(&mut self) -> &mut I

Source

pub fn generator(&self) -> &G

Source

pub fn generator_mut(&mut self) -> &mut G

Source

pub fn into_inner_interpretation(self) -> I

Source

pub fn into_generator(self) -> G

Trait Implementations§

Source§

impl<B, I: BlankIdInterpretation<B>, G> BlankIdInterpretation<B> for WithGenerator<G, I>

Source§

fn blank_id_interpretation(&self, blank_id: &B) -> Option<Self::Resource>

Returns the interpretation of the given blank node identifier, if any.
Source§

fn lexical_blank_id_interpretation( &self, vocabulary: &impl BlankIdVocabulary<BlankId = B>, blank_id: &BlankId, ) -> Option<Self::Resource>
where B: Sized,

Source§

impl<B, I: BlankIdInterpretationMut<B>, G> BlankIdInterpretationMut<B> for WithGenerator<G, I>

Source§

fn interpret_blank_id(&mut self, blank_id: B) -> Self::Resource

Interprets the given blank node identifier.
Source§

fn interpret_lexical_blank_id( &mut self, vocabulary: &mut impl BlankIdVocabularyMut<BlankId = B>, blank_id: &BlankId, ) -> Self::Resource

Source§

fn interpret_owned_lexical_blank_id( &mut self, vocabulary: &mut impl BlankIdVocabularyMut<BlankId = B>, blank_id: BlankIdBuf, ) -> Self::Resource

Source§

impl<I: Interpretation, G> Interpretation for WithGenerator<G, I>

Source§

type Resource = <I as Interpretation>::Resource

Resource identifier type.
Source§

impl<V: IriVocabulary + BlankIdVocabulary, I, G: Generator<V>> InterpretationMut<V> for WithGenerator<G, I>

Source§

fn new_resource(&mut self, vocabulary: &mut V) -> Self::Resource

Creates a new resource.
Source§

impl<Iri, I: IriInterpretation<Iri>, G> IriInterpretation<Iri> for WithGenerator<G, I>

Source§

fn iri_interpretation(&self, iri: &Iri) -> Option<Self::Resource>

Returns the interpretation of the given IRI, if any.
Source§

fn lexical_iri_interpretation( &self, vocabulary: &impl IriVocabulary<Iri = I>, iri: &Iri, ) -> Option<Self::Resource>
where I: Sized,

Source§

impl<Iri, I: IriInterpretationMut<Iri>, G> IriInterpretationMut<Iri> for WithGenerator<G, I>

Source§

fn interpret_iri(&mut self, iri: Iri) -> Self::Resource

Interprets the given IRI.
Source§

fn interpret_lexical_iri( &mut self, vocabulary: &mut impl IriVocabularyMut<Iri = I>, iri: &Iri, ) -> Self::Resource

Source§

fn interpret_owned_lexical_iri( &mut self, vocabulary: &mut impl IriVocabularyMut<Iri = I>, iri: IriBuf, ) -> Self::Resource

Source§

impl<L, I: LiteralInterpretation<L>, G> LiteralInterpretation<L> for WithGenerator<G, I>

Source§

fn literal_interpretation(&self, literal: &L) -> Option<Self::Resource>

Returns the interpretation of the given literal value, if any.
Source§

fn lexical_literal_interpretation<V: LiteralVocabulary<Literal = L>>( &self, vocabulary: &V, literal: LiteralRef<'_, V::Iri>, ) -> Option<Self::Resource>

Source§

impl<L, I: LiteralInterpretationMut<L>, G> LiteralInterpretationMut<L> for WithGenerator<G, I>

Source§

fn interpret_literal(&mut self, literal: L) -> Self::Resource

Interprets the given literal value.
Source§

fn interpret_lexical_literal<V: LiteralVocabularyMut<Literal = L>>( &mut self, vocabulary: &mut V, literal: LiteralRef<'_, V::Iri>, ) -> Self::Resource

Source§

fn interpret_owned_lexical_literal<V: LiteralVocabularyMut<Literal = L>>( &mut self, vocabulary: &mut V, literal: Literal<V::Iri>, ) -> Self::Resource

Source§

fn interpret_full_lexical_literal( &mut self, vocabulary: &mut (impl IriVocabularyMut + LiteralVocabularyMut<Literal = L>), literal: Literal, ) -> Self::Resource

Source§

impl<I: ReverseBlankIdInterpretation, G> ReverseBlankIdInterpretation for WithGenerator<G, I>

Source§

type BlankId = <I as ReverseBlankIdInterpretation>::BlankId

Source§

type BlankIds<'a> = <I as ReverseBlankIdInterpretation>::BlankIds<'a> where Self: 'a

Source§

fn blank_ids_of<'a>(&'a self, id: &'a Self::Resource) -> Self::BlankIds<'a>

Source§

impl<I: ReverseBlankIdInterpretationMut, G> ReverseBlankIdInterpretationMut for WithGenerator<G, I>

Source§

fn assign_blank_id( &mut self, id: &Self::Resource, blank_id: Self::BlankId, ) -> bool

Source§

impl<I: ReverseIriInterpretation, G> ReverseIriInterpretation for WithGenerator<G, I>

Source§

type Iri = <I as ReverseIriInterpretation>::Iri

Source§

type Iris<'a> = <I as ReverseIriInterpretation>::Iris<'a> where Self: 'a

Source§

fn iris_of<'a>(&'a self, id: &'a Self::Resource) -> Self::Iris<'a>

Source§

impl<I: ReverseIriInterpretationMut, G> ReverseIriInterpretationMut for WithGenerator<G, I>

Source§

fn assign_iri(&mut self, id: &Self::Resource, iri: Self::Iri) -> bool

Source§

impl<I: ReverseLiteralInterpretation, G> ReverseLiteralInterpretation for WithGenerator<G, I>

Source§

type Literal = <I as ReverseLiteralInterpretation>::Literal

Source§

type Literals<'a> = <I as ReverseLiteralInterpretation>::Literals<'a> where Self: 'a

Source§

fn literals_of<'a>(&'a self, id: &'a Self::Resource) -> Self::Literals<'a>

Source§

impl<I: ReverseLiteralInterpretationMut, G> ReverseLiteralInterpretationMut for WithGenerator<G, I>

Source§

fn assign_literal( &mut self, resource: &Self::Resource, literal: Self::Literal, ) -> bool

Assigns the given literal to the given resource.

Auto Trait Implementations§

§

impl<G, I> Freeze for WithGenerator<G, I>
where I: Freeze, G: Freeze,

§

impl<G, I> RefUnwindSafe for WithGenerator<G, I>

§

impl<G, I> Send for WithGenerator<G, I>
where I: Send, G: Send,

§

impl<G, I> Sync for WithGenerator<G, I>
where I: Sync, G: Sync,

§

impl<G, I> Unpin for WithGenerator<G, I>
where I: Unpin, G: Unpin,

§

impl<G, I> UnwindSafe for WithGenerator<G, I>
where I: UnwindSafe, G: 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> 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<I> FallibleInterpretation for I
where I: Interpretation,

Source§

impl<V, I> FallibleInterpretationMut<V> for I
where I: InterpretationMut<V>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<I, B, T> IdInterpretation<I, B> for T

Source§

fn id_interpretation(&self, id: &Id<I, B>) -> Option<Self::Resource>

Returns the interpretation of the given node identifier, if any.
Source§

fn lexical_id_interpretation( &self, vocabulary: &(impl IriVocabulary<Iri = I> + BlankIdVocabulary<BlankId = B>), id: Id<&Iri, &BlankId>, ) -> Option<Self::Resource>

Source§

impl<I, B, T> IdInterpretationMut<I, B> for T

Source§

fn interpret_id(&mut self, id: Id<I, B>) -> Self::Resource

Interprets the given identifier.
Source§

fn interpret_lexical_id( &mut self, vocabulary: &mut (impl IriVocabularyMut<Iri = I> + BlankIdVocabularyMut<BlankId = B>), id: Id<&Iri, &BlankId>, ) -> Self::Resource

Source§

fn interpret_owned_lexical_id( &mut self, vocabulary: &mut (impl IriVocabularyMut<Iri = I> + BlankIdVocabularyMut<BlankId = B>), id: Id, ) -> Self::Resource

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<I> ReverseIdInterpretation for I

Source§

fn ids_of<'a>(&'a self, id: &'a Self::Resource) -> IdsOf<'a, Self>

Source§

impl<I> ReverseIdInterpretationMut for I

Source§

fn assign_id( &mut self, r: &Self::Resource, id: Id<Self::Iri, Self::BlankId>, ) -> bool

Source§

impl<I> ReverseTermInterpretation for I

Source§

fn terms_of<'a>(&'a self, id: &'a Self::Resource) -> TermsOf<'a, Self>

Source§

fn term_of<'a>(&'a self, id: &'a Self::Resource) -> Option<TermOf<'a, Self>>

Source§

fn has_term(&self, id: &Self::Resource) -> bool

Source§

fn quads_of<'a>( &'a self, quad: Quad<&'a Self::Resource, &'a Self::Resource, &'a Self::Resource, &'a Self::Resource>, ) -> QuadsOf<'a, Self>

Source§

fn grdf_quads_of<'a>( &'a self, quad: Quad<&'a Self::Resource, &'a Self::Resource, &'a Self::Resource, &'a Self::Resource>, ) -> GrdfQuadsOf<'a, Self>

Source§

impl<I> ReverseTermInterpretationMut for I

Source§

fn assign_term( &mut self, resource: &Self::Resource, term: Term<Id<Self::Iri, Self::BlankId>, Self::Literal>, ) -> bool

Assigns the given term to the given resource.
Source§

fn assign_terms( &mut self, f: impl FnMut(&Self, &Self::Resource) -> Option<Term<Id<Self::Iri, Self::BlankId>, Self::Literal>>, )

Assigns a term to all the interpreted resources.
Source§

fn generate_ids<V: IriVocabulary + BlankIdVocabulary>( &mut self, vocabulary: &mut V, generator: &mut impl Generator<V>, )
where Self::Resource: Clone, Self: TraversableInterpretation + ReverseTermInterpretationMut<Iri = V::Iri, BlankId = V::BlankId>,

Generates and assign a node identifier for all the resources that don’t have any term, using the given generator.
Source§

impl<I, B, L, T> TermInterpretation<I, B, L> for T

Source§

fn term_interpretation( &self, term: &Term<Id<I, B>, L>, ) -> Option<Self::Resource>

Returns the interpretation of the given term, if any.
Source§

fn lexical_term_interpretation( &self, vocabulary: &impl Vocabulary<Iri = I, BlankId = B, Literal = L>, term: Term<Id<&Iri, &BlankId>, LiteralRef<'_, I>>, ) -> Option<Self::Resource>

Source§

impl<I, B, L, T> TermInterpretationMut<I, B, L> for T

Source§

fn interpret_term(&mut self, term: Term<Id<I, B>, L>) -> Self::Resource

Source§

fn interpret_lexical_term( &mut self, vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B, Literal = L>, term: Term<Id<&Iri, &BlankId>, LiteralRef<'_, I>>, ) -> Self::Resource

Source§

fn interpret_owned_lexical_term( &mut self, vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B, Literal = L>, term: Term<Id, Literal<I>>, ) -> Self::Resource

Source§

fn interpret_full_lexical_term( &mut self, vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B, Literal = L>, term: Term, ) -> Self::Resource

Source§

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

Source§

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> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.