pub struct WithGenerator<G, I = StaticDomain<Term>> { /* private fields */ }Expand description
Combines any RDF interpretation with a node id generator.
- Provides a
GenDomainimplementation, using the given generator to create fresh node identifiers. - Assigns a node identifier to each new resource created by
GenDomain::new_resource, based on the generator.
Note that in the case of the unit (()) interpretation, using
GenDomain will give you a similar result but with other
advantages (such as a ConstGenDomain implementation).
Implementations§
Source§impl<G, I> WithGenerator<G, I>
impl<G, I> WithGenerator<G, I>
Sourcepub fn new(interpretation: I, generator: G) -> Self
pub fn new(interpretation: I, generator: G) -> Self
Combines the given interpretation with the given generator.
Sourcepub fn into_parts(self) -> (I, G)
pub fn into_parts(self) -> (I, G)
Discards this wrapper, returning the inner interpretation and generator.
Sourcepub fn inner_interpretation(&self) -> &I
pub fn inner_interpretation(&self) -> &I
Returns a reference to the inner interpretation.
Sourcepub fn inner_interpretation_mut(&mut self) -> &mut I
pub fn inner_interpretation_mut(&mut self) -> &mut I
Returns a mutable reference to the inner interpretation.
Sourcepub fn generator_mut(&mut self) -> &mut G
pub fn generator_mut(&mut self) -> &mut G
Returns a mutable reference to the inner generator.
Sourcepub fn into_inner_interpretation(self) -> I
pub fn into_inner_interpretation(self) -> I
Discards this wrapper and the generator, returning the inner interpretation.
Sourcepub fn into_generator(self) -> G
pub fn into_generator(self) -> G
Discards this wrapper and the interpretation, returning the inner generator.
Trait Implementations§
Source§impl<I: Domain, G> Domain for WithGenerator<G, I>
impl<I: Domain, G> Domain for WithGenerator<G, I>
Source§impl<I: InterpretationMut, G: Generator> GenDomain for WithGenerator<G, I>
impl<I: InterpretationMut, G: Generator> GenDomain for WithGenerator<G, I>
Source§fn new_resource(&mut self) -> Self::Resource
fn new_resource(&mut self) -> Self::Resource
Create a new resource.
Source§impl<I: GroundInterpretation, G> GroundInterpretation for WithGenerator<G, I>
impl<I: GroundInterpretation, G> GroundInterpretation for WithGenerator<G, I>
Source§fn literal<'a>(
&self,
literal: impl Into<LiteralRef<'a>>,
) -> Option<Self::Resource>
fn literal<'a>( &self, literal: impl Into<LiteralRef<'a>>, ) -> Option<Self::Resource>
Interprets the given literal, if possible.
Source§fn ground_term<'a>(
&self,
term: impl Into<GroundTermRef<'a>>,
) -> Option<Self::Resource>
fn ground_term<'a>( &self, term: impl Into<GroundTermRef<'a>>, ) -> Option<Self::Resource>
Interprets the given ground term (an IRI or a literal), if possible.
Source§impl<I: GroundInterpretationMut, G> GroundInterpretationMut for WithGenerator<G, I>
impl<I: GroundInterpretationMut, G> GroundInterpretationMut for WithGenerator<G, I>
Source§fn insert_iri<'a>(&mut self, iri: impl Into<Cow<'a, Iri>>) -> Self::Resource
fn insert_iri<'a>(&mut self, iri: impl Into<Cow<'a, Iri>>) -> Self::Resource
Interprets the given IRI, inserting a fresh resource for it if none
exists yet.
Source§fn insert_literal<'a>(
&mut self,
literal: impl Into<CowLiteral<'a>>,
) -> Self::Resource
fn insert_literal<'a>( &mut self, literal: impl Into<CowLiteral<'a>>, ) -> Self::Resource
Interprets the given literal, inserting a fresh resource for it if
none exists yet.
Source§fn insert_ground_term<'a>(
&mut self,
term: impl Into<CowGroundTerm<'a>>,
) -> Self::Resource
fn insert_ground_term<'a>( &mut self, term: impl Into<CowGroundTerm<'a>>, ) -> Self::Resource
Interprets the given ground term, inserting a fresh resource for it
if none exists yet.
Source§impl<I: Interpretation, G> Interpretation for WithGenerator<G, I>
impl<I: Interpretation, G> Interpretation for WithGenerator<G, I>
Source§fn blank_id<'a>(&'a self, blank_id: &'a BlankId) -> Option<Self::Resource>
fn blank_id<'a>(&'a self, blank_id: &'a BlankId) -> Option<Self::Resource>
Interprets the given blank node identifier, if possible.
Source§impl<I: InterpretationMut, G> InterpretationMut for WithGenerator<G, I>
impl<I: InterpretationMut, G> InterpretationMut for WithGenerator<G, I>
Source§fn insert_blank_id<'a>(
&mut self,
blank_id: impl Into<Cow<'a, BlankId>>,
) -> Self::Resource
fn insert_blank_id<'a>( &mut self, blank_id: impl Into<Cow<'a, BlankId>>, ) -> Self::Resource
Interprets the given blank node identifier, inserting a fresh
resource for it if none exists yet.
Source§impl<I: ReverseGroundInterpretation, G> ReverseGroundInterpretation for WithGenerator<G, I>
impl<I: ReverseGroundInterpretation, G> ReverseGroundInterpretation for WithGenerator<G, I>
Source§type Iris<'a> = <I as ReverseGroundInterpretation>::Iris<'a>
where
Self: 'a
type Iris<'a> = <I as ReverseGroundInterpretation>::Iris<'a> where Self: 'a
Iterator over the IRIs of a resource.
Source§type Literals<'a> = <I as ReverseGroundInterpretation>::Literals<'a>
where
Self: 'a
type Literals<'a> = <I as ReverseGroundInterpretation>::Literals<'a> where Self: 'a
Iterator over the literals of a resource.
Source§fn iris_of<'a>(&'a self, resource: &'a Self::Resource) -> Self::Iris<'a>
fn iris_of<'a>(&'a self, resource: &'a Self::Resource) -> Self::Iris<'a>
Returns an iterator over the IRIs of
resource.Source§fn literals_of<'a>(&'a self, resource: &'a Self::Resource) -> Self::Literals<'a>
fn literals_of<'a>(&'a self, resource: &'a Self::Resource) -> Self::Literals<'a>
Returns an iterator over the literals of
resource.Source§fn ground_terms_of<'a>(
&'a self,
resource: &'a Self::Resource,
) -> GroundTermsOf<'a, Self> ⓘ
fn ground_terms_of<'a>( &'a self, resource: &'a Self::Resource, ) -> GroundTermsOf<'a, Self> ⓘ
Returns an iterator over the ground terms (IRIs and literals) of
resource.Source§fn is_anonymous(&self, resource: &Self::Resource) -> bool
fn is_anonymous(&self, resource: &Self::Resource) -> bool
Checks whether
resource has no ground term lexical representation.Source§impl<I: ReverseInterpretation, G> ReverseInterpretation for WithGenerator<G, I>
impl<I: ReverseInterpretation, G> ReverseInterpretation for WithGenerator<G, I>
Source§type BlankIds<'a> = <I as ReverseInterpretation>::BlankIds<'a>
where
Self: 'a
type BlankIds<'a> = <I as ReverseInterpretation>::BlankIds<'a> where Self: 'a
Iterator over the blank node identifiers of a resource.
Source§fn blank_ids_of<'a>(
&'a self,
resource: &'a Self::Resource,
) -> Self::BlankIds<'a>
fn blank_ids_of<'a>( &'a self, resource: &'a Self::Resource, ) -> Self::BlankIds<'a>
Returns an iterator over the blank node identifiers of
resource.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> UnsafeUnpin for WithGenerator<G, I>where
I: UnsafeUnpin,
G: UnsafeUnpin,
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> TryGroundInterpretation for Iwhere
I: GroundInterpretation,
impl<I> TryGroundInterpretation for Iwhere
I: GroundInterpretation,
Source§type Error = Infallible
type Error = Infallible
Error type.
Source§fn try_iri(
&self,
iri: &Iri,
) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>
fn try_iri( &self, iri: &Iri, ) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>
Interprets the given IRI, if possible.
Source§fn try_literal<'a>(
&self,
literal: impl Into<LiteralRef<'a>>,
) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>
fn try_literal<'a>( &self, literal: impl Into<LiteralRef<'a>>, ) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>
Interprets the given literal, if possible.
Source§fn try_ground_term<'a>(
&self,
term: impl Into<GroundTermRef<'a>>,
) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>
fn try_ground_term<'a>( &self, term: impl Into<GroundTermRef<'a>>, ) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>
Interprets the given ground term (an IRI or a literal), if possible.
Source§impl<I> TryGroundInterpretationMut for Iwhere
I: GroundInterpretationMut,
impl<I> TryGroundInterpretationMut for Iwhere
I: GroundInterpretationMut,
Source§fn try_insert_iri<'a>(
&mut self,
iri: impl Into<Cow<'a, Iri>>,
) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
fn try_insert_iri<'a>( &mut self, iri: impl Into<Cow<'a, Iri>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
Interprets the given IRI, inserting a fresh resource for it if none
exists yet.
Source§fn try_insert_literal<'a>(
&mut self,
literal: impl Into<CowLiteral<'a>>,
) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
fn try_insert_literal<'a>( &mut self, literal: impl Into<CowLiteral<'a>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
Interprets the given literal, inserting a fresh resource for it if
none exists yet.
Source§fn try_insert_ground_term<'a>(
&mut self,
term: impl Into<CowGroundTerm<'a>>,
) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
fn try_insert_ground_term<'a>( &mut self, term: impl Into<CowGroundTerm<'a>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
Interprets the given ground term, inserting a fresh resource for it
if none exists yet.
Source§impl<I> TryInterpretation for Iwhere
I: Interpretation,
impl<I> TryInterpretation for Iwhere
I: Interpretation,
Source§fn try_blank_id(
&self,
blank_id: &BlankId,
) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>
fn try_blank_id( &self, blank_id: &BlankId, ) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>
Interprets the given blank node identifier, if possible.
Source§impl<I> TryInterpretationMut for Iwhere
I: InterpretationMut,
impl<I> TryInterpretationMut for Iwhere
I: InterpretationMut,
Source§fn try_insert_blank_id<'a>(
&mut self,
blank_id: impl Into<Cow<'a, BlankId>>,
) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
fn try_insert_blank_id<'a>( &mut self, blank_id: impl Into<Cow<'a, BlankId>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
Interprets the given blank node identifier, inserting a fresh
resource for it if none exists yet.
Source§fn try_insert_term<'a>(
&mut self,
term: impl Into<CowTerm<'a>>,
) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
fn try_insert_term<'a>( &mut self, term: impl Into<CowTerm<'a>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
Interprets the given term, inserting a fresh resource for it if none
exists yet.
Source§fn try_insert_id<'a>(
&mut self,
term: impl Into<CowId<'a>>,
) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
fn try_insert_id<'a>( &mut self, term: impl Into<CowId<'a>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>
Interprets the given identifier, inserting a fresh resource for it
if none exists yet.
Source§impl<I> TryReverseGroundInterpretation for Iwhere
I: ReverseGroundInterpretation,
impl<I> TryReverseGroundInterpretation for Iwhere
I: ReverseGroundInterpretation,
Source§type TryIris<'a> = InfallibleIterator<MapIntoOwned<<I as ReverseGroundInterpretation>::Iris<'a>>>
where
I: 'a
type TryIris<'a> = InfallibleIterator<MapIntoOwned<<I as ReverseGroundInterpretation>::Iris<'a>>> where I: 'a
Iterator over the IRIs of a resource.
Source§type TryLiterals<'a> = InfallibleIterator<MapIntoOwned<<I as ReverseGroundInterpretation>::Literals<'a>>>
where
I: 'a
type TryLiterals<'a> = InfallibleIterator<MapIntoOwned<<I as ReverseGroundInterpretation>::Literals<'a>>> where I: 'a
Iterator over the literals of a resource.
Source§fn try_iris_of<'a>(
&'a self,
resource: &'a <I as Domain>::Resource,
) -> Result<<I as TryReverseGroundInterpretation>::TryIris<'a>, <I as TryGroundInterpretation>::Error>
fn try_iris_of<'a>( &'a self, resource: &'a <I as Domain>::Resource, ) -> Result<<I as TryReverseGroundInterpretation>::TryIris<'a>, <I as TryGroundInterpretation>::Error>
Returns an iterator over the IRIs of
resource.Source§fn try_literals_of<'a>(
&'a self,
resource: &'a <I as Domain>::Resource,
) -> Result<<I as TryReverseGroundInterpretation>::TryLiterals<'a>, <I as TryGroundInterpretation>::Error>
fn try_literals_of<'a>( &'a self, resource: &'a <I as Domain>::Resource, ) -> Result<<I as TryReverseGroundInterpretation>::TryLiterals<'a>, <I as TryGroundInterpretation>::Error>
Returns an iterator over the literals of
resource.Source§fn try_is_anonymous(
&self,
resource: &<I as Domain>::Resource,
) -> Result<bool, <I as TryGroundInterpretation>::Error>
fn try_is_anonymous( &self, resource: &<I as Domain>::Resource, ) -> Result<bool, <I as TryGroundInterpretation>::Error>
Checks whether
resource has no ground term lexical representation.Source§fn try_ground_terms_of<'a>(
&'a self,
resource: &'a Self::Resource,
) -> Result<TryGroundTermsOf<'a, Self>, Self::Error>
fn try_ground_terms_of<'a>( &'a self, resource: &'a Self::Resource, ) -> Result<TryGroundTermsOf<'a, Self>, Self::Error>
Returns an iterator over the ground terms (IRIs and literals) of
resource.Source§impl<I> TryReverseInterpretation for Iwhere
I: ReverseInterpretation,
impl<I> TryReverseInterpretation for Iwhere
I: ReverseInterpretation,
Source§type TryBlankIds<'a> = InfallibleIterator<MapIntoOwned<<I as ReverseInterpretation>::BlankIds<'a>>>
where
I: 'a
type TryBlankIds<'a> = InfallibleIterator<MapIntoOwned<<I as ReverseInterpretation>::BlankIds<'a>>> where I: 'a
Iterator over the blank node identifiers of a resource.
Source§fn try_blank_ids_of<'a>(
&'a self,
resource: &'a <I as Domain>::Resource,
) -> Result<<I as TryReverseInterpretation>::TryBlankIds<'a>, <I as TryGroundInterpretation>::Error>
fn try_blank_ids_of<'a>( &'a self, resource: &'a <I as Domain>::Resource, ) -> Result<<I as TryReverseInterpretation>::TryBlankIds<'a>, <I as TryGroundInterpretation>::Error>
Returns an iterator over the blank node identifiers of
resource.Source§fn try_terms_of<'a>(
&'a self,
resource: &'a Self::Resource,
) -> Result<TryTermsOf<'a, Self>, Self::Error>
fn try_terms_of<'a>( &'a self, resource: &'a Self::Resource, ) -> Result<TryTermsOf<'a, Self>, Self::Error>
Returns an iterator over the terms (ground terms and blank node
identifiers) of
resource.