Shape-Aware Three-Way Merge for RDF Knowledge Graphs: The schema defines the conflict: an implementation and evaluation
Abstract
Merging RDF serializations creates ordering conflicts and misses semantic ones. We describe and evaluate a three-way merge in which the schema defines a conflict: set algebra combines canonical triples, and a slot is contended only where a SHACL shape bounds its cardinality and both sides' changes cannot stand within that bound. Unbounded predicates union; contended slots go to a person. The same shapes graph validates the result. We do not claim the first three-way merge for RDF. Our contribution is an implementation in a production multi-agent store and an evaluation against a reimplementation of Quit Store's Context Merge overlap rule, which it extends rather than replaces, and six other strategies. Across five synthetic seeds, the shape-aware operator raised 33 conflicts, all true positives as judged by the same shapes that define them, with no triples lost or fabricated and no SHACL violations admitted. The context-overlap baseline, counted per slot, detected the same 33 conflicts but asked 845 questions. A replay built from recorded production incidents covers 105 human alias repairs (93 after excluding 12 chained pairs) and 939 duplicate-value incidents. It reproduces a triple-level limit: different names for one entity remain invisible (0 of 93 alias repairs detected, matching 0 of 21 synthetic cases). In a study of evolving shape contracts, merging shape declarations first handles the tested cardinality changes, while datatype evolution exposes a detector blind spot caught by post-merge validation. An oracle that reads no shapes agrees with the shipped operator on the facts and history of all 23 reachable single-slot cases. Under wrong shapes, a missing bound loses data silently and a spurious one only adds questions. The supported claim is fewer human decisions with nothing silently lost, for cardinality conflicts in one deployment, not general merge correctness.
Figures & tables
| arm | decisions | precision | recall | SHACL | lost | spurious |
|---|---|---|---|---|---|---|
| git-turtle-reserialized | 681–794 | 0.006–0.011 | 0.36–0.80 | 0–1 | 266–299 | 62–71 |
| git-turtle-stable | 41–59 | 0.049–0.119 | 0.20–0.70 | 0–3 | 39–57 | 12–24 |
| git-canonical | 106–144 | 0.028–0.057 | 0.30–0.70 | 0–3 | 95–128 | 18–31 |
| union | 0 | — | 0.00 | 53–72 | 2–7 | 112–136 |
| lww-theirs | 0 | — | 0.00 | 0–1 | 7–16 | 4–10 |
| triple-3way | 0 | — | 0.00 | 3–6 | 2–7 | 7–17 |
| seed | oracle | alias-mint | triple-visible | context-merge decisions | shape-aware decisions |
|---|---|---|---|---|---|
| 1 | 14 | 7 | 7 | 159 | 7 |
| 7 | 8 | 4 | 4 | 163 | 4 |
| 42 | 12 | 4 | 8 | 173 | 8 |
| 99 | 10 | 4 | 6 | 168 | 6 |
| 2026 | 10 | 2 | 8 | 182 | 8 |
| total | 54 | 21 | 33 | 845 | 33 |
| arm | alias-mint | card. overflow | delete/modify | functional div. |
|---|---|---|---|---|
| git-turtle-reserialized | 0/21 | 8/10 | 9/10 | 13/13 |
| git-turtle-stable | 0/21 | 0/10 | 10/10 | 13/13 |
| git-canonical | 0/21 | 1/10 | 10/10 | 13/13 |
| union , lww-theirs , triple-3way | 0/21 | 0/10 | 0/10 | 0/13 |
| context-merge | 0/21 | 10/10 | 10/10 | 13/13 |
| shape-aware | 0/21 | 10/10 | 10/10 | 13/13 |
| shape-aware | unified-core | |||||
|---|---|---|---|---|---|---|
| operator’s shapes | P | R | viol. | P | R | viol. |
| as published | 1.000 | 0.611 | 0 | 1.000 | 0.593 | 1 |
| tag unbounded | 1.000 | 0.426 | 10 | 1.000 | 0.426 | 10 |
| label , status unbounded | 1.000 | 0.389 | 8 | 1.000 | 0.370 | 9 |
| tag at most 2 | 0.106 | 0.611 | 0 | 0.696 | 0.593 | 1 |
| note at most 1 | 0.194 | 0.611 | 0 | 0.842 | 0.593 | 1 |
| scenario | decisions | historical | outcome |
|---|---|---|---|
| alias-id-form | 0 | 46 | merged — false negative |
| alias-semantic | 0 | 47 | merged — false negative |
| comment-double | 939 | 0 | conflicts — raised as decisions |
| sameas-repair | 0 | 20 | merged — repair survives (wanted) |
| Stratum | Method | Recall, original | Recall, eligible | False proposals |
|---|---|---|---|---|
| id-form | Jev | |||
| id-form | Label | |||
| id-form | Cosine | |||
| id-form | Union | |||
| id-form | Commit-ID | |||
| semantic | Jev |
| Case | TP | FP | FN | Merge | Context | Lost | Extra | SHACL |
|---|---|---|---|---|---|---|---|---|
| tighten | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 |
| loosen | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| property-added | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 |
| datatype | 0 | 0 | 1 | 0 | 1 | 0 | 2 | 1 |
| removed | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| share merge | fork promote | |
| facts, history and trace agree | 19 | 22 |
| facts and history agree, trace differs | 4 | 0 |
| facts or history disagree | 0 | 0 |
| case not reachable through the path | 1 | 2 |
| conflict report agrees (of cases with one) | 10/10 | 10/10 |
Knowledge Graphs
Knowledge graphs represent entities and relationships as structured, queryable networks for integrating data and supporting reasoning.
See all 259 papers