pub struct GraphViewMut<'a> { /* private fields */ }
Expand description
A read/write view on an RDF graph contained in a Dataset
.
It is built using the Dataset::graph_mut
method.
Usage example:
use oxrdf::*;
let mut dataset = Dataset::default();
let ex = NamedNodeRef::new("http://example.com")?;
// We edit and query the dataset http://example.com graph
{
let mut graph = dataset.graph_mut(ex);
graph.insert(TripleRef::new(ex, ex, ex));
let results: Vec<_> = graph.iter().collect();
assert_eq!(vec![TripleRef::new(ex, ex, ex)], results);
}
// We have also changes the dataset itself
let results: Vec<_> = dataset.iter().collect();
assert_eq!(vec![QuadRef::new(ex, ex, ex, ex)], results);
Implementations§
Source§impl<'a> GraphViewMut<'a>
impl<'a> GraphViewMut<'a>
Sourcepub fn insert<'b>(&mut self, triple: impl Into<TripleRef<'b>>) -> bool
pub fn insert<'b>(&mut self, triple: impl Into<TripleRef<'b>>) -> bool
Adds a triple to the graph.
Sourcepub fn remove<'b>(&mut self, triple: impl Into<TripleRef<'b>>) -> bool
pub fn remove<'b>(&mut self, triple: impl Into<TripleRef<'b>>) -> bool
Removes a concrete triple from the graph.
Sourcepub fn iter(&'a self) -> GraphViewIter<'a> ⓘ
pub fn iter(&'a self) -> GraphViewIter<'a> ⓘ
Returns all the triples contained by the graph
pub fn triples_for_subject<'b>( &'a self, subject: impl Into<SubjectRef<'b>>, ) -> impl Iterator<Item = TripleRef<'a>> + 'a
pub fn objects_for_subject_predicate<'b>( &'a self, subject: impl Into<SubjectRef<'b>>, predicate: impl Into<NamedNodeRef<'b>>, ) -> impl Iterator<Item = TermRef<'a>> + 'a
pub fn object_for_subject_predicate<'b>( &'a self, subject: impl Into<SubjectRef<'b>>, predicate: impl Into<NamedNodeRef<'b>>, ) -> Option<TermRef<'a>>
pub fn predicates_for_subject_object<'b>( &'a self, subject: impl Into<SubjectRef<'b>>, object: impl Into<TermRef<'b>>, ) -> impl Iterator<Item = NamedNodeRef<'a>> + 'a
pub fn triples_for_predicate<'b>( &'a self, predicate: impl Into<NamedNodeRef<'b>>, ) -> impl Iterator<Item = TripleRef<'a>> + 'a
pub fn subjects_for_predicate_object<'b>( &'a self, predicate: impl Into<NamedNodeRef<'b>>, object: impl Into<TermRef<'b>>, ) -> impl Iterator<Item = SubjectRef<'a>> + 'a
pub fn subject_for_predicate_object<'b>( &'a self, predicate: impl Into<NamedNodeRef<'b>>, object: impl Into<TermRef<'b>>, ) -> Option<SubjectRef<'a>>
pub fn triples_for_object<'b>( &'a self, object: TermRef<'b>, ) -> impl Iterator<Item = TripleRef<'a>> + 'a
Trait Implementations§
Source§impl<'a> Debug for GraphViewMut<'a>
impl<'a> Debug for GraphViewMut<'a>
Source§impl Display for GraphViewMut<'_>
impl Display for GraphViewMut<'_>
Source§impl<'b, T: Into<TripleRef<'b>>> Extend<T> for GraphViewMut<'_>
impl<'b, T: Into<TripleRef<'b>>> Extend<T> for GraphViewMut<'_>
Source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl Extend<Triple> for GraphViewMut<'_>
impl Extend<Triple> for GraphViewMut<'_>
Source§fn extend<I: IntoIterator<Item = Triple>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Triple>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a> IntoIterator for &'a GraphViewMut<'a>
impl<'a> IntoIterator for &'a GraphViewMut<'a>
Auto Trait Implementations§
impl<'a> Freeze for GraphViewMut<'a>
impl<'a> RefUnwindSafe for GraphViewMut<'a>
impl<'a> Send for GraphViewMut<'a>
impl<'a> Sync for GraphViewMut<'a>
impl<'a> Unpin for GraphViewMut<'a>
impl<'a> !UnwindSafe for GraphViewMut<'a>
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