Skip to main content

apply_sparql_update

Function apply_sparql_update 

Source
pub fn apply_sparql_update(
    op: &UpdateOperation,
    ctx: &SparqlQueryContext,
    on_change: Option<&mut dyn FnMut(&[NQuin], &[NQuin]) -> Result<(), String>>,
) -> Result<UpdateOutcome, String>
Expand description

Apply a parsed SPARQL Update to the resident daemon graph.

The mutation is applied under a single write guard (copy → run UpdateExecutor → write back), then the graph revision is bumped so subscribers (e.g. WebSocket sessions) are notified.

on_change, if supplied, receives the (inserted, deleted) quin sets so the caller can sign and persist them to the WAL with a real key (see wal::commit_semantic_mutation); persisted is then true. If it is None, the change is applied in memory only (ephemeral) and persisted is false. A signature is never fabricated here — durable, signed mutation requires the caller to supply a real signer, so an irreversible delete can never be committed under a placeholder key.