pub struct DeterministicGraph { /* private fields */ }Expand description
A deterministic, thread-safe RDF graph wrapper around Oxigraph’s Store.
Ensures deterministic sorting of quads and reproducible state hashing.
Implementations§
Source§impl DeterministicGraph
impl DeterministicGraph
Sourcepub fn new() -> Result<Self, GraphError>
pub fn new() -> Result<Self, GraphError>
Create a new empty deterministic graph.
§Errors
Returns GraphError if the underlying Oxigraph store cannot be initialized.
Sourcepub fn insert_quad(&self, quad: &Quad) -> Result<(), GraphError>
pub fn insert_quad(&self, quad: &Quad) -> Result<(), GraphError>
Sourcepub fn remove_quad(&self, quad: &Quad) -> Result<(), GraphError>
pub fn remove_quad(&self, quad: &Quad) -> Result<(), GraphError>
Sourcepub fn contains_quad(&self, quad: &Quad) -> Result<bool, GraphError>
pub fn contains_quad(&self, quad: &Quad) -> Result<bool, GraphError>
Sourcepub fn query(&self, query_str: &str) -> Result<QueryResults<'_>, GraphError>
pub fn query(&self, query_str: &str) -> Result<QueryResults<'_>, GraphError>
Evaluate a SPARQL query against the graph.
§Errors
Returns GraphError if query parsing or evaluation fails.
Sourcepub fn parse_nquad(nquad: &str) -> Result<Quad, GraphError>
pub fn parse_nquad(nquad: &str) -> Result<Quad, GraphError>
Parses an N-Quad string into an Oxigraph Quad.
§Errors
Returns GraphError::Serialization if parsing fails.
Sourcepub fn state_hash(&self) -> Result<[u8; 32], GraphError>
pub fn state_hash(&self) -> Result<[u8; 32], GraphError>
Computes a deterministic blake3 hash of the entire graph state.
§Errors
Returns GraphError if reading quads fails.
Sourcepub fn apply_delta(
&self,
delta: &RdfDelta,
hooks: &[KnowledgeHook],
) -> Result<TransitionReceipt, GraphError>
pub fn apply_delta( &self, delta: &RdfDelta, hooks: &[KnowledgeHook], ) -> Result<TransitionReceipt, GraphError>
Applies an RdfDelta to the graph, runs validation hooks, and returns a TransitionReceipt.
If any validation hook fails, the changes are rolled back to preserve consistency.
§Errors
Returns GraphError if application, validation, or rollback fails.
Trait Implementations§
Source§impl Clone for DeterministicGraph
impl Clone for DeterministicGraph
Source§fn clone(&self) -> DeterministicGraph
fn clone(&self) -> DeterministicGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more