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>
impl<G, I> WithGenerator<G, I>
pub fn new(interpretation: I, generator: G) -> Self
pub fn into_parts(self) -> (I, G)
pub fn inner_interpretation(&self) -> &I
pub fn inner_interpretation_mut(&mut self) -> &mut I
pub fn generator(&self) -> &G
pub fn generator_mut(&mut self) -> &mut G
pub fn into_inner_interpretation(self) -> I
pub fn into_generator(self) -> G
Trait Implementations§
Source§impl<B, I: BlankIdInterpretation<B>, G> BlankIdInterpretation<B> for WithGenerator<G, I>
impl<B, I: BlankIdInterpretation<B>, G> BlankIdInterpretation<B> for WithGenerator<G, I>
Source§fn blank_id_interpretation(&self, blank_id: &B) -> Option<Self::Resource>
fn blank_id_interpretation(&self, blank_id: &B) -> Option<Self::Resource>
Returns the interpretation of the given blank node identifier, if any.
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>
impl<B, I: BlankIdInterpretationMut<B>, G> BlankIdInterpretationMut<B> for WithGenerator<G, I>
Source§fn interpret_blank_id(&mut self, blank_id: B) -> Self::Resource
fn interpret_blank_id(&mut self, blank_id: B) -> Self::Resource
Interprets the given blank node identifier.
fn interpret_lexical_blank_id( &mut self, vocabulary: &mut impl BlankIdVocabularyMut<BlankId = B>, blank_id: &BlankId, ) -> Self::Resource
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>
impl<I: Interpretation, G> Interpretation for WithGenerator<G, I>
Source§type Resource = <I as Interpretation>::Resource
type Resource = <I as Interpretation>::Resource
Resource identifier type.
Source§impl<V: IriVocabulary + BlankIdVocabulary, I, G: Generator<V>> InterpretationMut<V> for WithGenerator<G, I>
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
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>
impl<Iri, I: IriInterpretation<Iri>, G> IriInterpretation<Iri> for WithGenerator<G, I>
Source§fn iri_interpretation(&self, iri: &Iri) -> Option<Self::Resource>
fn iri_interpretation(&self, iri: &Iri) -> Option<Self::Resource>
Returns the interpretation of the given IRI, if any.
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>
impl<Iri, I: IriInterpretationMut<Iri>, G> IriInterpretationMut<Iri> for WithGenerator<G, I>
Source§fn interpret_iri(&mut self, iri: Iri) -> Self::Resource
fn interpret_iri(&mut self, iri: Iri) -> Self::Resource
Interprets the given IRI.
fn interpret_lexical_iri( &mut self, vocabulary: &mut impl IriVocabularyMut<Iri = I>, iri: &Iri, ) -> Self::Resource
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>
impl<L, I: LiteralInterpretation<L>, G> LiteralInterpretation<L> for WithGenerator<G, I>
Source§fn literal_interpretation(&self, literal: &L) -> Option<Self::Resource>
fn literal_interpretation(&self, literal: &L) -> Option<Self::Resource>
Returns the interpretation of the given literal value, if any.
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>
impl<L, I: LiteralInterpretationMut<L>, G> LiteralInterpretationMut<L> for WithGenerator<G, I>
Source§fn interpret_literal(&mut self, literal: L) -> Self::Resource
fn interpret_literal(&mut self, literal: L) -> Self::Resource
Interprets the given literal value.
fn interpret_lexical_literal<V: LiteralVocabularyMut<Literal = L>>( &mut self, vocabulary: &mut V, literal: LiteralRef<'_, V::Iri>, ) -> Self::Resource
fn interpret_owned_lexical_literal<V: LiteralVocabularyMut<Literal = L>>( &mut self, vocabulary: &mut V, literal: Literal<V::Iri>, ) -> Self::Resource
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>
impl<I: ReverseBlankIdInterpretation, G> ReverseBlankIdInterpretation for WithGenerator<G, I>
type BlankId = <I as ReverseBlankIdInterpretation>::BlankId
type BlankIds<'a> = <I as ReverseBlankIdInterpretation>::BlankIds<'a> where Self: 'a
fn blank_ids_of<'a>(&'a self, id: &'a Self::Resource) -> Self::BlankIds<'a>
Source§impl<I: ReverseBlankIdInterpretationMut, G> ReverseBlankIdInterpretationMut for WithGenerator<G, I>
impl<I: ReverseBlankIdInterpretationMut, G> ReverseBlankIdInterpretationMut for WithGenerator<G, I>
Source§impl<I: ReverseIriInterpretation, G> ReverseIriInterpretation for WithGenerator<G, I>
impl<I: ReverseIriInterpretation, G> ReverseIriInterpretation for WithGenerator<G, I>
Source§impl<I: ReverseIriInterpretationMut, G> ReverseIriInterpretationMut for WithGenerator<G, I>
impl<I: ReverseIriInterpretationMut, G> ReverseIriInterpretationMut for WithGenerator<G, I>
Source§impl<I: ReverseLiteralInterpretation, G> ReverseLiteralInterpretation for WithGenerator<G, I>
impl<I: ReverseLiteralInterpretation, G> ReverseLiteralInterpretation for WithGenerator<G, I>
type Literal = <I as ReverseLiteralInterpretation>::Literal
type Literals<'a> = <I as ReverseLiteralInterpretation>::Literals<'a> where Self: 'a
fn literals_of<'a>(&'a self, id: &'a Self::Resource) -> Self::Literals<'a>
Source§impl<I: ReverseLiteralInterpretationMut, G> ReverseLiteralInterpretationMut for WithGenerator<G, I>
impl<I: ReverseLiteralInterpretationMut, G> ReverseLiteralInterpretationMut for WithGenerator<G, I>
Auto Trait Implementations§
impl<G, I> Freeze for WithGenerator<G, I>
impl<G, I> RefUnwindSafe for WithGenerator<G, I>where
I: RefUnwindSafe,
G: RefUnwindSafe,
impl<G, I> Send for WithGenerator<G, I>
impl<G, I> Sync for WithGenerator<G, I>
impl<G, I> Unpin for WithGenerator<G, I>
impl<G, I> UnwindSafe for WithGenerator<G, I>where
I: UnwindSafe,
G: UnwindSafe,
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
Source§impl<I> FallibleInterpretation for Iwhere
I: Interpretation,
impl<I> FallibleInterpretation for Iwhere
I: Interpretation,
type Resource = <I as Interpretation>::Resource
type Error = Infallible
Source§impl<V, I> FallibleInterpretationMut<V> for Iwhere
I: InterpretationMut<V>,
impl<V, I> FallibleInterpretationMut<V> for Iwhere
I: InterpretationMut<V>,
fn try_new_resource( &mut self, vocabulary: &mut V, ) -> Result<<I as FallibleInterpretation>::Resource, <I as FallibleInterpretation>::Error>
Source§impl<I, B, T> IdInterpretation<I, B> for Twhere
T: IriInterpretation<I> + BlankIdInterpretation<B>,
impl<I, B, T> IdInterpretation<I, B> for Twhere
T: IriInterpretation<I> + BlankIdInterpretation<B>,
Source§fn id_interpretation(&self, id: &Id<I, B>) -> Option<Self::Resource>
fn id_interpretation(&self, id: &Id<I, B>) -> Option<Self::Resource>
Returns the interpretation of the given node identifier, if any.
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 Twhere
T: IriInterpretationMut<I> + BlankIdInterpretationMut<B>,
impl<I, B, T> IdInterpretationMut<I, B> for Twhere
T: IriInterpretationMut<I> + BlankIdInterpretationMut<B>,
Source§fn interpret_id(&mut self, id: Id<I, B>) -> Self::Resource
fn interpret_id(&mut self, id: Id<I, B>) -> Self::Resource
Interprets the given identifier.
fn interpret_lexical_id( &mut self, vocabulary: &mut (impl IriVocabularyMut<Iri = I> + BlankIdVocabularyMut<BlankId = B>), id: Id<&Iri, &BlankId>, ) -> Self::Resource
fn interpret_owned_lexical_id( &mut self, vocabulary: &mut (impl IriVocabularyMut<Iri = I> + BlankIdVocabularyMut<BlankId = B>), id: Id, ) -> Self::Resource
Source§impl<I> ReverseIdInterpretation for I
impl<I> ReverseIdInterpretation for I
Source§impl<I> ReverseIdInterpretationMut for I
impl<I> ReverseIdInterpretationMut for I
Source§impl<I> ReverseTermInterpretation for I
impl<I> ReverseTermInterpretation for I
fn terms_of<'a>(&'a self, id: &'a Self::Resource) -> TermsOf<'a, Self> ⓘ
fn term_of<'a>(&'a self, id: &'a Self::Resource) -> Option<TermOf<'a, Self>>
fn has_term(&self, id: &Self::Resource) -> bool
fn quads_of<'a>( &'a self, quad: Quad<&'a Self::Resource, &'a Self::Resource, &'a Self::Resource, &'a Self::Resource>, ) -> QuadsOf<'a, Self> ⓘ
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
impl<I> ReverseTermInterpretationMut for I
Source§fn assign_term(
&mut self,
resource: &Self::Resource,
term: Term<Id<Self::Iri, Self::BlankId>, Self::Literal>,
) -> bool
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>>,
)
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>,
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 Twhere
T: IdInterpretation<I, B> + LiteralInterpretation<L>,
impl<I, B, L, T> TermInterpretation<I, B, L> for Twhere
T: IdInterpretation<I, B> + LiteralInterpretation<L>,
Source§fn term_interpretation(
&self,
term: &Term<Id<I, B>, L>,
) -> Option<Self::Resource>
fn term_interpretation( &self, term: &Term<Id<I, B>, L>, ) -> Option<Self::Resource>
Returns the interpretation of the given term, if any.