pub struct Dataset { /* private fields */ }Expand description
An in-memory RDF Dataset
A dataset is a collection of named graphs plus a default graph. Each named graph is identified by an IRI or blank node.
Implementations§
Source§impl Dataset
impl Dataset
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new dataset with the specified capacity for named graphs
Sourcepub fn default_graph(&self) -> &Graph
pub fn default_graph(&self) -> &Graph
Returns a reference to the default graph
Sourcepub fn default_graph_mut(&mut self) -> &mut Graph
pub fn default_graph_mut(&mut self) -> &mut Graph
Returns a mutable reference to the default graph
Sourcepub fn named_graph(&self, name: &GraphName) -> Option<&Graph>
pub fn named_graph(&self, name: &GraphName) -> Option<&Graph>
Returns a reference to the named graph with the given name
Sourcepub fn named_graph_mut(&mut self, name: &GraphName) -> &mut Graph
pub fn named_graph_mut(&mut self, name: &GraphName) -> &mut Graph
Returns a mutable reference to the named graph with the given name
Creates the graph if it doesn’t exist.
Sourcepub fn insert(&mut self, quad: Quad) -> bool
pub fn insert(&mut self, quad: Quad) -> bool
Inserts a quad into the dataset
Returns true if the quad was not already present, false otherwise.
Sourcepub fn remove(&mut self, quad: &Quad) -> bool
pub fn remove(&mut self, quad: &Quad) -> bool
Removes a quad from the dataset
Returns true if the quad was present, false otherwise.
Sourcepub fn contains(&self, quad: &Quad) -> bool
pub fn contains(&self, quad: &Quad) -> bool
Returns true if the dataset contains the specified quad
Sourcepub fn named_graph_count(&self) -> usize
pub fn named_graph_count(&self) -> usize
Returns the number of named graphs (excluding default graph)
Sourcepub fn graph_names(&self) -> impl Iterator<Item = &GraphName>
pub fn graph_names(&self) -> impl Iterator<Item = &GraphName>
Returns an iterator over all graph names (excluding default graph)
Sourcepub fn named_graphs(&self) -> impl Iterator<Item = (&GraphName, &Graph)>
pub fn named_graphs(&self) -> impl Iterator<Item = (&GraphName, &Graph)>
Returns an iterator over all named graphs
Sourcepub fn remove_graph(&mut self, name: &GraphName) -> Option<Graph>
pub fn remove_graph(&mut self, name: &GraphName) -> Option<Graph>
Removes a named graph from the dataset
Returns the removed graph if it existed.
Sourcepub fn iter(&self) -> impl Iterator<Item = Quad> + '_
pub fn iter(&self) -> impl Iterator<Item = Quad> + '_
Returns an iterator over all quads in the dataset
Sourcepub fn iter_ref(&self) -> impl Iterator<Item = QuadRef<'_>> + '_
pub fn iter_ref(&self) -> impl Iterator<Item = QuadRef<'_>> + '_
Returns an iterator over all quads in the dataset as references
Sourcepub fn quads_for_pattern<'a>(
&'a self,
subject: Option<&'a Subject>,
predicate: Option<&'a Predicate>,
object: Option<&'a Object>,
graph_name: Option<&'a GraphName>,
) -> Box<dyn Iterator<Item = Quad> + 'a>
pub fn quads_for_pattern<'a>( &'a self, subject: Option<&'a Subject>, predicate: Option<&'a Predicate>, object: Option<&'a Object>, graph_name: Option<&'a GraphName>, ) -> Box<dyn Iterator<Item = Quad> + 'a>
Finds all quads matching the given pattern
None values in the pattern act as wildcards.
Sourcepub fn extend<I>(&mut self, quads: I)where
I: IntoIterator<Item = Quad>,
pub fn extend<I>(&mut self, quads: I)where
I: IntoIterator<Item = Quad>,
Extends the dataset with quads from an iterator
Trait Implementations§
Source§impl Extend<Quad> for Dataset
impl Extend<Quad> for Dataset
Source§fn extend<T: IntoIterator<Item = Quad>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Quad>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl FromIterator<Quad> for Dataset
impl FromIterator<Quad> for Dataset
Source§impl IntoIterator for Dataset
impl IntoIterator for Dataset
impl Eq for Dataset
impl StructuralPartialEq for Dataset
Auto Trait Implementations§
impl Freeze for Dataset
impl RefUnwindSafe for Dataset
impl Send for Dataset
impl Sync for Dataset
impl Unpin for Dataset
impl UnsafeUnpin for Dataset
impl UnwindSafe for Dataset
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more