VIEW THIS AS

Auto mode follows the Route Engine until you choose a viewpoint.

YOU ARE HERE

ROUTE CHECK

CONNECTED TO

WHAT NEXT

Use the canonical route for this room, or HELP if you are unsure.

The Gold Standard of Information | SPARQL Update Transaction Isolation, Write Skew, Phantom Matches, Lost Updates, Serialisable Histories and Anomaly Witnesses

Library search computer terminal inside the National Library Building in Singapore.

THE GOLD STANDARD OF INFORMATION · SPECIALIST STUDY

Prove what concurrent updates are allowed to mean before trusting the final graph

A SPARQL Update request can be atomic and still participate in a non-serialisable history. Two requests may each complete successfully, preserve their own local conditions and jointly violate the rule that motivated both. The central task is therefore not to ask whether the server returned success, but to reconstruct what each transaction read, what it wrote, which conflicts were detected, and whether the committed history is equivalent to a defensible serial order.

This guide belongs to the Information subject root, the Gold Standard of Education, and the How X Works hub. It begins with a concrete decision, then tests whether the method still holds when the context changes.

The whole problem at a glance

QuestionEvidence neededUnsafe shortcut
Was one request all-or-nothing?Request boundary, commit result and post-stateAssuming atomic means isolated
Could two successful requests form one serial order?Read sets, write sets, predicates and commit orderLooking only at the final triple count
Was a repeated match stable?Snapshot boundary and predicate-range evidenceTreating each query result as the same database moment
Can the incident be reproduced?Initial graph, two requests and controlled interleavingKeeping only application logs
The evidence chain for concurrent SPARQL Update

Atomicity, isolation and serialisability answer different questions. A good incident record names the property being tested.

CHAPTER 1 OF 13 · Build the concurrency model

1. Separate request atomicity from transaction isolation

The SPARQL Update recommendation says an update request should be treated atomically: its sequence of operations should have complete effect or no effect. That protects the boundary of one request. It does not specify how two independent requests interleave, what snapshot either reads, or which concurrency anomalies an implementation prevents.

Write the contract in three rows: request atomicity, visibility rule and commit rule. For each row, cite the service or repository behaviour actually configured. If the implementation documents only request atomicity, leave isolation unknown rather than upgrading a SHOULD into a promise about concurrent histories.

A success response proves that the service accepted the request under its rules. It does not prove that a business invariant survived another request that read the same earlier state. Treat protocol success as one observation, not as a global correctness certificate.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Move the same request from a single-node repository to a clustered service whose transaction layer differs; the SPARQL text can remain identical while its concurrency meaning changes. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 1 check · what should survive an audit
  • Name the exact atomic unit.
  • Record the configured isolation level or state that it is unknown.
  • Do not infer serialisability from HTTP success.

Contents · Next chapter

CHAPTER 2 OF 13 · Build the concurrency model

2. Represent a transaction by reads, writes and predicates

A triple-by-triple diff is not enough when the decision depended on a query predicate. DELETE/INSERT WHERE first matches a solution set, then instantiates deletions and insertions. The logical read may therefore be “all active reservations for room R,” not only the triples ultimately changed.

Record three sets for every test transaction: explicit resources read, predicates or graph patterns matched, and triples or graphs written. Predicate reads expose phantoms and write skew that a simple overlap test misses. They also show why two disjoint write sets can still be logically coupled.

Include graph identity and dataset clauses. WITH, USING and USING NAMED can change which graphs supply matches and which graph receives writes. A concurrency witness that omits the active dataset can appear reproducible while exercising a different operation.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Change a default-graph request into a named-graph request; re-derive the read predicate and target graph instead of assuming the original conflict map still applies. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 2 check · what should survive an audit
  • Capture the active RDF dataset.
  • Record predicate reads as well as concrete triples.
  • Separate matched solutions from instantiated writes.

Contents · Previous chapter · Next chapter

CHAPTER 3 OF 13 · Build the concurrency model

3. Define serialisability with an observable history

A committed history is serialisable when its externally relevant effects are equivalent to some serial execution of the same transactions. The question is not whether operations literally ran one after another, but whether a serial order can explain every read and final effect that matters.

Create a history table with begin, read, write, validation and commit events. Then try both serial orders. If transaction B read a state that would be impossible after A, and A read a state impossible after B, neither order explains the history. The cycle is the anomaly witness.

State the observation boundary. Entailment, inference refresh, asynchronous indexing or replicas can change what a later query sees. If those layers are outside the transactional guarantee, include them as named components rather than folding them into one vague database state.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Run the same history with reasoning enabled after commit; distinguish transaction serialisability from the timing of derived-statement visibility. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 3 check · what should survive an audit
  • Show the candidate serial orders.
  • Identify the dependency cycle when none works.
  • Name asynchronous visibility outside the transaction boundary.

Contents · Previous chapter · Next chapter

CHAPTER 4 OF 13 · Recognise the anomalies

4. Detect lost updates rather than merely noticing a changed value

A lost update occurs when two actors read an earlier value, compute replacements, and the later write removes the effect of the earlier one. In RDF this can arise through graph replacement, delete-and-insert of a value, or application-side read-modify-write.

Use a counter or status example. Both clients read :case :score 5. One adds two and writes 7; the other adds three from the same base and writes 8. The intended combined result may be 10, yet the final graph contains only 8. A final-value check cannot reveal whose work disappeared without versions or receipts.

Protect the state with a compare-and-set condition, an entity version triple, ETag where the relevant protocol supports it, or a serializable repository transaction. Verify that a stale writer fails visibly and that retry recomputes from fresh state rather than replaying an obsolete replacement.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Replace the scalar score with a whole named graph; the conflict surface grows, but the need to bind the write to the version that was read remains. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 4 check · what should survive an audit
  • Reconstruct both base reads.
  • Show which committed effect vanished.
  • Test stale-write rejection and fresh recomputation.

Contents · Previous chapter · Next chapter

CHAPTER 5 OF 13 · Recognise the anomalies

5. Expose write skew across disjoint triples

Write skew appears when transactions read a shared invariant and write different resources, allowing both commits because there is no direct write-write collision. The classic shape is “at least one reviewer remains” or “no more than one active reservation exists.”

Model two reviewers who each see the other as on duty, then independently mark themselves off duty. The writes touch different reviewer resources. Snapshot isolation can keep each transaction’s reads internally consistent while still allowing the joint invariant to fail.

Materialise an invariant guard only when it truthfully represents the protected decision. A shared :reviewRoster :version value can force a conflict, but it must be updated by every operation that could affect the invariant. Otherwise the guard becomes reassuring theatre.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Change the rule from a fixed pair of reviewers to a SPARQL pattern over any qualified reviewer; the conflict now concerns a predicate range, not a hard-coded list. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 5 check · what should survive an audit
  • Write the invariant as a sentence and a query.
  • Show why the write sets are disjoint.
  • Prove every invariant-changing path touches the guard.

Contents · Previous chapter · Next chapter

Worked history: two curators reserve the last review slot

StepTransaction ATransaction BShared meaning
1Reads zero active reservationsReads zero active reservationsBoth see the rule as satisfied
2Inserts reservation :aInserts reservation :bWrites touch different triples
3CommitsCommitsNo direct write-write conflict is required
4——Two reservations now violate the one-slot invariant
A write-skew witness over a predicate, not one triple

Each request can be internally consistent. The anomaly is the committed history across both requests.

CHAPTER 6 OF 13 · Recognise the anomalies

6. Catch phantom matches and unstable solution sets

A phantom occurs when repeating a predicate query returns a new or missing match because another transaction inserted or removed a qualifying resource. A stable snapshot can prevent phantoms within one transaction, while separate autocommit requests usually cannot.

Suppose a moderation process first asks for all unreviewed items, prepares decisions, then deletes the matched marker triples. If another writer inserts an item between the two requests, the second match may include work that was never assessed or exclude work the process believed it owned.

Bind the decision to an explicit snapshot, batch identifier or versioned membership graph. If the service cannot hold the needed snapshot across the workflow, narrow the unit of work and validate membership at commit.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Move from a small explicit list to a federated SERVICE pattern; the remote endpoint can introduce an additional visibility boundary and may weaken atomicity. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 6 check · what should survive an audit
  • Identify the predicate range that can gain a phantom.
  • Record whether matching and writing share one transaction.
  • Test insertion and deletion between repeated matches.

Contents · Previous chapter · Next chapter

CHAPTER 7 OF 13 · Work and witness a history

7. Build a minimal anomaly witness

A useful witness is smaller than the production incident. Create an initial graph containing only the triples required by the invariant, two complete update requests, and an orchestrated interleaving. Keep client timestamps, transaction identifiers, isolation settings and commit outcomes.

For the review-slot case, start with no active reservation and capacity one. Pause both transactions after their qualifying reads, allow each to stage a distinct reservation, then release both commits. Query the invariant after each commit and preserve the exact result set.

Repeat the witness enough times to distinguish a permitted anomaly from a race that merely happens rarely. A negative run is not proof of safety unless the control guarantees exclusion and the test exercises the conflict path.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Change the scheduler so one transaction commits before the other reads; the invariant should survive, demonstrating that the witness depends on the interleaving rather than the update text alone. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 7 check · what should survive an audit
  • Publish the smallest initial graph.
  • Control the interleaving explicitly.
  • Retain both positive and negative schedules.

Contents · Previous chapter · Next chapter

CHAPTER 8 OF 13 · Work and witness a history

8. Draw the dependency graph and test serial orders

Represent each transaction as a node. Add a dependency when one reads a value another later overwrites, one overwrites a value another read, or two writes conflict. Predicate-read dependencies must include inserted or deleted qualifying triples.

In write skew, A reads the absence of B’s reservation before B inserts it, while B reads the absence of A’s reservation before A inserts it. Those anti-dependencies point in opposite directions and form a cycle. The cycle explains why neither A-before-B nor B-before-A matches the observed reads.

Keep the dependency graph beside the SPARQL and graph snapshots. It is a compact explanation that reviewers can challenge. If an edge depends on an inferred triple or an asynchronous index, label that layer and its visibility rule.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Add a third transaction that only reads; determine whether it observes a serial prefix, a committed snapshot or a replica-specific state. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 8 check · what should survive an audit
  • Give every edge an observed read or write.
  • Include predicate and inference dependencies.
  • Attempt every relevant serial order.

Contents · Previous chapter · Next chapter

CHAPTER 9 OF 13 · Choose controls and tests

9. Choose isolation by invariant, not by label prestige

Serializable isolation is appropriate when concurrent transactions may otherwise violate invariants, but it can introduce aborts, retries and contention. Weaker isolation may be sufficient for independent appends or idempotent writes. The choice should follow the conflict shape and consequence.

Document the minimum guarantee: consistent query snapshot, repeatable transaction snapshot, lost-update detection, predicate protection or full serialisability. Product names vary, so map the service’s documented level to observable tests rather than assuming identical semantics across repositories.

Test the configured behaviour after upgrades. A repository may support several levels but default to another. Client libraries can also open autocommit operations when the application believed it held one transaction. Capture configuration and client boundaries in the evidence record.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Move the workflow to a repository whose SERIALIZABLE setting uses optimistic validation; preserve retry evidence because correctness now includes how aborts are handled. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 9 check · what should survive an audit
  • Tie each isolation need to an invariant.
  • Verify the actual default and requested level.
  • Include retry behaviour in the correctness case.

Contents · Previous chapter · Next chapter

Control selection table

ControlPrevents wellDoes not guarantee
Conditional version checkLost replacement of a versioned resourcePredicate invariants outside the token
Snapshot transactionMid-query changes and fractured readsSerialisability under write skew
Serializable executionHistories without an equivalent serial orderCorrect application rules or truthful data
Invariant materialisationConflicts on an explicit guard resourceCoverage of unmaterialised rules
Controls must match the conflict being protected

The smallest effective control is the one that turns the real invariant into a detected conflict without pretending broader guarantees.

CHAPTER 10 OF 13 · Choose controls and tests

10. Make conflict detection cover the real invariant

Optimistic validation works only if the system notices every dependency that matters. Triple-level write conflicts may stop lost updates but miss write skew over a predicate. Coarse graph locks may prevent more anomalies while reducing concurrency.

Where the repository cannot protect predicate reads, redesign the data so invariant changes contend on an explicit resource. A capacity token, roster version or lease can turn a logical conflict into a concrete write conflict. The redesign must be complete and auditable.

Avoid accidental global locks as the only safety argument. They may disappear during scaling or migration. Name the lock scope, owner, timeout, fencing token and failure behaviour, then test crash recovery and stale-owner rejection.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Shard one graph into many tenant graphs; revisit whether the old guard remains shared across all resources governed by the invariant. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 10 check · what should survive an audit
  • Show the conflict granularity.
  • Prove all mutation paths participate.
  • Test crash, timeout and stale-owner cases.

Contents · Previous chapter · Next chapter

CHAPTER 11 OF 13 · Choose controls and tests

11. Test histories, not only final answers

A concurrency test suite should assert reads, aborts and intermediate commitments as well as final graphs. Different anomalous histories can converge on the same final triples, while a correct history can produce a different but valid serial outcome.

Use a harness that can pause clients at controlled barriers. Generate histories around invariants, not random load alone. Store the initial dataset, request bodies, dataset clauses, isolation configuration, results and commit events as one test artefact.

Add metamorphic checks: when the same transactions run serially in either order, the concurrent result should match an allowed serial outcome under a serialisable contract. When the order changes, the permitted answer set may change but the invariant must remain.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Increase from two to many concurrent writers; retain the minimal two-transaction witness so scale does not obscure the underlying anomaly. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 11 check · what should survive an audit
  • Assert observed reads and aborts.
  • Compare with allowed serial outcomes.
  • Keep a minimal deterministic regression case.

Contents · Previous chapter · Next chapter

CHAPTER 12 OF 13 · Transfer, recover and govern

12. Design retries that do not create a second anomaly

An optimistic transaction may abort correctly and still be retried incorrectly. Replaying a precomputed DELETE/INSERT can apply a decision based on stale matches. A safe retry restarts the transaction, repeats the reads and re-evaluates the invariant.

Use idempotency keys to distinguish an uncertain network response from a deliberate new request, but do not confuse duplicate suppression with fresh-state recomputation. The audit receipt should record both the logical operation and each physical attempt.

Bound retries and surface persistent contention. Endless automatic retry can starve one actor or hide a hot invariant. Escalate with the witness and conflict metrics when abort rates cross a documented threshold.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Change the failure from an explicit serialization abort to a timeout after commit; first determine whether the original attempt succeeded before issuing any new mutation. The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 12 check · what should survive an audit
  • Restart reads on serialization failure.
  • Separate logical operations from physical attempts.
  • Bound retries and investigate hot conflicts.

Contents · Previous chapter · Next chapter

CHAPTER 13 OF 13 · Transfer, recover and govern

13. Publish an isolation contract and anomaly runbook

Clients need a concise contract: atomic request boundary, supported isolation levels, default level, transaction API, graph and predicate conflict behaviour, retry signals, and known exceptions such as remote SERVICE calls. Without it, each application invents a different safety story.

The incident runbook should freeze writes only as broadly as necessary, preserve the initial and final graphs, collect request and transaction identifiers, construct a minimal witness, test serial orders, repair violated invariants and add a regression. Do not repair first and erase the history.

Review the contract when the repository, inference engine, cluster topology, client library or data model changes. A green application test cannot substitute for a concurrency witness if the underlying visibility rule moved.

Evidence discipline: record the observation, version or time boundary that supports this chapter’s conclusion. Preserve the rejected alternative as well as the selected action. That makes a later review able to distinguish a changed world from an undocumented change of mind.

Changed-context transfer: Introduce a read replica for reporting; publish whether it offers monotonic, read-your-writes or bounded-staleness behaviour rather than calling it simply “consistent.” The method transfers only if the decision question and measurement meaning survive the change. If either changes, rebuild the comparison rather than copying the earlier threshold or weight.

Chapter 13 check · what should survive an audit
  • Give clients an observable isolation contract.
  • Preserve evidence before repair.
  • Re-run witnesses after architectural change.

Contents · Previous chapter · Return to the Information guide

Verification lab: work the decision twice

Initial graph: room R has capacity one and no active reservation. Transaction A and B each query for active reservations and, if count is below one, insert a different reservation. Under a controlled interleaving both read zero before either commits. If both commit, record the two anti-dependencies and show why no serial order permits both reads.

Run the same requests with a shared capacity-version triple that both transactions update under a serializable repository transaction. One should commit; the other should abort or re-read the changed guard. Verify that its retry sees one reservation and performs no second insert.

Change the rule to capacity two and start from one reservation. The same witness shape still applies. The arithmetic changes, but the protected predicate and need for fresh retry do not. Then move one insert to a named graph excluded from the counting dataset: the control fails because the invariant definition and write scope no longer align.

Limits and misconceptions

Atomic does not mean serialisable

Atomicity protects the effect of one request. Serialisability constrains the combined history of concurrent transactions.

A final graph is not a complete witness

It may omit the reads that justified each write and can hide a lost or phantom decision.

A version triple is not magic

It protects only operations that reliably read and update it under a conflict-detecting transaction.

Implementation behaviour is part of the contract

SPARQL specifies update semantics but leaves concurrency architecture to implementations, so repository documentation and tests matter.

Questions readers ask

Does one SPARQL Update request run atomically?
  • The specification says a service should treat a request atomically, but implementation and remote SERVICE details matter. That statement does not define isolation between separate requests.
Can snapshot isolation allow write skew?
  • Yes. Each transaction can read a consistent snapshot and write a different resource, allowing a shared invariant to fail without a direct write-write conflict.
Is a lost update the same as write skew?
  • No. A lost update overwrites or removes another committed effect. Write skew preserves both writes but violates an invariant derived from shared reads.
What is a phantom match?
  • It is a qualifying match that appears or disappears between predicate reads because another transaction changed the matched range.
Should every workflow use serializable isolation?
  • No. Use the weakest verified guarantee that protects the actual invariant and operational consequence, while accounting for retries and contention.
What should an anomaly witness contain?
  • The initial graph, complete requests, dataset clauses, isolation configuration, controlled interleaving, reads, writes, commit outcomes and the violated invariant.

Practise, verify and continue

Create a two-client test for a one-active-approval rule. Record the graph pattern each client reads, the triples it writes, the barriers that establish the interleaving, and the serial orders you tried. Then implement one guard-resource design and demonstrate why every rule-changing operation must touch it.

Move the test to a workflow that calls a remote SERVICE endpoint in the WHERE clause. State which part of the decision can no longer share the local atomic boundary, and redesign the operation so remote evidence is versioned or treated as an input rather than an invisible concurrent read.

Practical evidence check

Before implementation, write a one-page evidence map with the decision, unit of analysis, version or time boundary, inputs, outcomes, uncertainty, authority and stop rule. Attach one worked case that passes and one that fails. A reviewer should be able to reproduce the reasoning without relying on the memory of the person who built the system.

Run one changed-context rehearsal before approval. Alter a mechanism rather than a cosmetic detail, then identify which calculation, safeguard or governance gate must change. Record any conclusion that does not transfer. This short rehearsal is often the fastest way to expose a hidden assumption before it becomes an operational dependency.

Related eduKate reading

SPARQL Graph Store Protocol, conditional requests and concurrency conflicts
SPARQL Update replay safety and uncertain completion
SPARQL Update preflight, validation and rollback plans
SPARQL Update audit trails and historical reconstruction
SPARQL pagination and snapshot consistency

Authoritative sources and scope

W3C SPARQL 1.2 Update specification
W3C SPARQL 1.1 Protocol recommendation
Eclipse RDF4J Repository API transaction and isolation documentation
Berenson and colleagues on isolation-level phenomena

The standards define request and protocol semantics; repository documentation defines implementation-specific isolation behaviour. The reservation histories are original teaching examples. This guide does not claim that every RDF store exposes the same levels or prevents the same anomalies.

Back to contents · Return to the Information guide