pub struct GraphUpdate<'a> { /* private fields */ }Expand description
GraphUpdate provides SPARQL Update operations.
SPARQL Update allows modifying RDF graphs using declarative update operations.
§Examples
§Insert data
use crate::graph::{Graph, GraphUpdate};
let graph = Graph::new()?;
let update = GraphUpdate::new(&graph);
// Insert new triples (without INSERT DATA wrapper)
update.insert("<http://example.org/alice> <http://example.org/name> \"Alice\"")?;§Delete data
use crate::graph::{Graph, GraphUpdate};
let graph = Graph::new()?;
let update = GraphUpdate::new(&graph);
// Delete triples matching a pattern (without DELETE DATA wrapper)
update.delete("<http://example.org/alice> <http://example.org/name> \"Alice\"")?;§Update with WHERE clause
use ggen_core::graph::{Graph, GraphUpdate};
let graph = Graph::new()?;
let update = GraphUpdate::new(&graph);
// Delete and insert in one operation (DELETE / INSERT / WHERE patterns)
update.update(
"?s <http://example.org/old> ?o",
"?s <http://example.org/new> ?o",
"?s <http://example.org/old> ?o",
)?;Implementations§
Source§impl<'a> GraphUpdate<'a>
impl<'a> GraphUpdate<'a>
Sourcepub fn delete_where(&self, pattern: &str) -> Result<()>
pub fn delete_where(&self, pattern: &str) -> Result<()>
Sourcepub fn update(
&self,
delete_pattern: &str,
insert_pattern: &str,
where_pattern: &str,
) -> Result<()>
pub fn update( &self, delete_pattern: &str, insert_pattern: &str, where_pattern: &str, ) -> Result<()>
Update data (DELETE + INSERT with WHERE).
Shorthand for DELETE { ... } INSERT { ... } WHERE { ... }.
§Arguments
delete_pattern- Pattern to deleteinsert_pattern- Pattern to insertwhere_pattern- WHERE clause pattern
Sourcepub fn clear(&self) -> Result<()>
pub fn clear(&self) -> Result<()>
Clear the default graph.
Removes all triples from the default graph.
Sourcepub fn clear_graph(&self, graph_iri: &str) -> Result<()>
pub fn clear_graph(&self, graph_iri: &str) -> Result<()>
Sourcepub fn load_into(&self, url: &str, graph_iri: &str) -> Result<()>
pub fn load_into(&self, url: &str, graph_iri: &str) -> Result<()>
Load data from a URL into a named graph.
§Arguments
url- URL to load RDF data fromgraph_iri- IRI of the target graph
Sourcepub fn copy(&self, source: &str, destination: &str) -> Result<()>
pub fn copy(&self, source: &str, destination: &str) -> Result<()>
Copy all data from source graph to destination graph.
§Arguments
source- Source graph IRIdestination- Destination graph IRI
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for GraphUpdate<'a>
impl<'a> !UnwindSafe for GraphUpdate<'a>
impl<'a> Freeze for GraphUpdate<'a>
impl<'a> Send for GraphUpdate<'a>
impl<'a> Sync for GraphUpdate<'a>
impl<'a> Unpin for GraphUpdate<'a>
impl<'a> UnsafeUnpin for GraphUpdate<'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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> EvidenceKind for T
impl<T> EvidenceKind for T
default fn kind_label(&self) -> &'static str
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> ⓘ
Converts
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> ⓘ
Converts
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