pub struct ConstructExecutor<'a> { /* private fields */ }Expand description
Executor for SPARQL CONSTRUCT queries
Implementations§
Source§impl<'a> ConstructExecutor<'a>
impl<'a> ConstructExecutor<'a>
Sourcepub fn execute(&self, query: &str) -> Result<Vec<String>>
pub fn execute(&self, query: &str) -> Result<Vec<String>>
Execute a CONSTRUCT query and return the resulting triples as strings
§Arguments
query- SPARQL CONSTRUCT query string
§Returns
Ok(Vec<String>)- Resulting triples in N-Triples formatErr(Error)- Query execution error
§Example
use crate::graph::{Graph, ConstructExecutor};
let graph = Graph::new()?;
graph.insert_turtle(r#"
@prefix ex: <http://example.org/> .
ex:alice ex:knows ex:bob .
"#)?;
let executor = ConstructExecutor::new(&graph);
let triples = executor.execute(r#"
CONSTRUCT { ?s ?p ?o }
WHERE { ?s ?p ?o }
"#)?;Sourcepub fn execute_and_materialize(&self, query: &str) -> Result<usize>
pub fn execute_and_materialize(&self, query: &str) -> Result<usize>
Execute a CONSTRUCT query and insert the results back into the graph
This implements the “sequential materialization” pattern where each CONSTRUCT rule’s output is materialized before the next rule executes.
§Arguments
query- SPARQL CONSTRUCT query string
§Returns
Ok(usize)- Number of triples addedErr(Error)- Query or insert error
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ConstructExecutor<'a>
impl<'a> !UnwindSafe for ConstructExecutor<'a>
impl<'a> Freeze for ConstructExecutor<'a>
impl<'a> Send for ConstructExecutor<'a>
impl<'a> Sync for ConstructExecutor<'a>
impl<'a> Unpin for ConstructExecutor<'a>
impl<'a> UnsafeUnpin for ConstructExecutor<'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