Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

A retracted assertion is not a contradiction partner (#259)

Fabio Rovaic64de09b9e1f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b1b62a91..3e88744b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,40 @@ All notable changes to Open Ontologies are documented here.
## [Unreleased]
+### Fixed
+
+- **`onto_temporal_conflicts` no longer files a withdrawn assertion as a live
+ contradiction partner** (#128). The tool takes no `as_of` and read the
+ validity map after the lineage pass, so a retracted graph carried its
+ retractors, but the pair classification never looked at them: a graph a
+ `temporal:retracts` link had withdrawn was compared on its valid period
+ like any live one, and the disjointness pair it belonged to landed in
+ `contradictions` or in `non_overlapping`, history reported as news, while
+ `onto_temporal_snapshot` at any `as_of` from the retraction on filed the
+ same graph under `retracted`. Same shape as the two defects fixed before
+ it: an empty period was a contradiction partner before #118, and a
+ correction was one before #109. The rule those two applied applies here,
+ an asserted fact about standing pre-empts the period comparison. Such a
+ pair now lands in `retracted`, with `retracted_count`, present only when
+ non-empty like `corrections`; each row keeps the subject, types, periods
+ and graphs every bucket carries and names the withdrawn side, the graph
+ that retracts it and the `recordedAt` that was recorded, in the snapshot's
+ own row shape. The pair moves, it does not leave: dropping the retracted
+ graph from the comparison would make `contradiction_count` smaller for a
+ reason the output never states. Retraction is checked before supersession,
+ the snapshot's order, so a graph both superseded and retracted is retracted
+ in both tools. With no `as_of` no instant on the recorded axis is asked
+ about, so "retracted" here means a retraction is RECORDED, whenever it
+ was: one recorded after every period in the store withdraws, and an
+ undated retractor withdraws full stop, as it does at every `as_of` the
+ snapshot is given. That is a different question from the snapshot's, and
+ the `note` says so next to the count. Four tests pin the four decisions,
+ the first of them the issue's own example, which answered
+ `contradiction_count: 1` before this change. `semantics_version` stays
+ `temporal/2`: a store that writes no `retracts` link answers exactly as it
+ did. Found and analysed on #128 by nicolas-geysse, who also framed the four
+ decisions this takes.
+
## [2.0.0] - 2026-09-22
A major number because the engine now answers three questions it could not
diff --git a/CLAUDE.md b/CLAUDE.md
index dfada7c9..9aeaf53f 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -106,7 +106,7 @@ Claude dynamically decides the next tool call based on what the previous tool re
| `onto_unpack` | To load a pack, refusing it if the checksum does not match. `verify_only` inspects the manifest and evidence without loading |
| `onto_temporal_snapshot` | To see which named graphs are in scope at a point in time. Two independent clocks: `valid_at` asks what was TRUE then, `as_of` asks what was KNOWN then. Both intervals are half-open: `temporal:recordedUntil` closes the recorded one, so `as_of` answers what was believed then rather than everything recorded by then. Graphs without validity metadata are timeless and always in scope, so the vocabulary is additive to an existing store. Bounds on all four axes are read as instants on the UTC timeline from `xsd:date`, `xsd:dateTime`, `xsd:gYearMonth` or `xsd:gYear`: a less precise bound names the FIRST instant of its period, and a value with no timezone offset is UTC. A bound matching none of those, or two different instants on one axis, makes the graph `invalid`: reported with a reason, never in scope and never timeless |
| `onto_temporal_query` | To run a SPARQL graph pattern against only the graphs in temporal scope: what the graph said at a given valid time, as known at a given recorded time |
-| `onto_temporal_conflicts` | To separate genuine contradictions from pairs that never met and from asserted corrections. A pair where one graph `temporal:supersedes` the other, directly or through a chain, lands in `corrections` whatever its periods, lineage that is asserted and never inferred; otherwise a disjointness violation only counts when the two assertions claim OVERLAPPING validity, and everything else lands in `non_overlapping`, which proves only that the two share no instant, judged on their bounds read as instants on the UTC timeline so a timezone offset is honoured: not that one replaced the other, and it also holds pairs separated by a gap, which is missing coverage rather than history. A pair whose graph has temporal metadata that could not be read goes to `undecided`, in neither bucket, because an unreadable period is not an open one. `superseded` is the same set under its old name, deprecated and dropped at 2.0 |
+| `onto_temporal_conflicts` | To separate genuine contradictions from pairs that never met, from withdrawn assertions and from asserted corrections. A pair one side of which a `temporal:retracts` link has withdrawn lands in `retracted`, checked first as the snapshot does; the tool takes no `as_of`, so a recorded retraction counts whenever it was recorded, and the note says so. A pair where one graph `temporal:supersedes` the other, directly or through a chain, lands in `corrections` whatever its periods, lineage that is asserted and never inferred; otherwise a disjointness violation only counts when the two assertions claim OVERLAPPING validity, and everything else lands in `non_overlapping`, which proves only that the two share no instant, judged on their bounds read as instants on the UTC timeline so a timezone offset is honoured: not that one replaced the other, and it also holds pairs separated by a gap, which is missing coverage rather than history. A pair whose graph has temporal metadata that could not be read goes to `undecided`, in neither bucket, because an unreadable period is not an open one. `superseded` is the same set under its old name, deprecated and dropped at 2.0 |
| `onto_lineage` | To view the session's lineage trail (plan → enforce → apply → monitor → drift) |
| `onto_lint_feedback` | To accept/dismiss a lint issue — teaches lint to suppress repeatedly dismissed warnings |
| `onto_enforce_feedback` | To accept/dismiss an enforce violation — teaches enforce to suppress repeatedly dismissed violations |
diff --git a/src/server.rs b/src/server.rs
index 5617729e..c7319426 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -1110,7 +1110,7 @@ impl OpenOntologiesServer {
}
}
- #[tool(name = "onto_temporal_conflicts", description = "Disjointness violations that claim OVERLAPPING validity, separated from those that do not. Without valid time a correction reads as a contradiction: an entity recorded one way until May and another after trips every check. This reports genuine disagreement about the same period as contradictions, and everything else as non_overlapping: pairs with no instant in common, judged on their bounds read as instants on the UTC timeline, so a timezone offset is honoured. That is all that is checked -- it is not evidence that one assertion replaced another, and the bucket also holds pairs separated by a GAP, which is missing coverage rather than history, and pairs where one period holds at no instant (empty or inverted), which onto_temporal_snapshot reports once with a reason naming which. The `superseded` key carries the same set under a name that claimed more than was proven; it is deprecated and will be dropped at 2.0. A pair whose graph has temporal metadata that could not be read is in neither bucket: it goes to `undecided`, because an unreadable period is not an open one and treating it as timeless would make it overlap everything. The scans are capped: `complete` says whether they finished, and if the validity scan was cut a `warning` marks the classification unsound, because a pair compared without its periods can appear here as a contradiction when it is a correction. A pair where one graph asserts that it temporal:supersedes the other, directly or through a chain of supersedes links, lands in `corrections` (with `corrections_count`, present only when non-empty) before the overlap test is reached: lineage that is asserted and never inferred, and such a pair is never a contradiction whatever its periods. A retracted graph is not treated specially here.")]
+ #[tool(name = "onto_temporal_conflicts", description = "Disjointness violations that claim OVERLAPPING validity, separated from those that do not. Without valid time a correction reads as a contradiction: an entity recorded one way until May and another after trips every check. This reports genuine disagreement about the same period as contradictions, and everything else as non_overlapping: pairs with no instant in common, judged on their bounds read as instants on the UTC timeline, so a timezone offset is honoured. That is all that is checked -- it is not evidence that one assertion replaced another, and the bucket also holds pairs separated by a GAP, which is missing coverage rather than history, and pairs where one period holds at no instant (empty or inverted), which onto_temporal_snapshot reports once with a reason naming which. The `superseded` key carries the same set under a name that claimed more than was proven; it is deprecated and will be dropped at 2.0. A pair whose graph has temporal metadata that could not be read is in neither bucket: it goes to `undecided`, because an unreadable period is not an open one and treating it as timeless would make it overlap everything. The scans are capped: `complete` says whether they finished, and if the validity scan was cut a `warning` marks the classification unsound, because a pair compared without its periods can appear here as a contradiction when it is a correction. A pair where one graph asserts that it temporal:supersedes the other, directly or through a chain of supersedes links, lands in `corrections` (with `corrections_count`, present only when non-empty) before the overlap test is reached: lineage that is asserted and never inferred, and such a pair is never a contradiction whatever its periods. A pair one side of which a temporal:retracts link has withdrawn lands in `retracted` (with `retracted_count`, present only when non-empty), checked before corrections in the order onto_temporal_snapshot uses, and each row names the withdrawn side, the graph that retracts it and its recordedAt. This tool takes no as_of, so retracted here means a retraction is RECORDED, whenever it was: one recorded after every period in the store withdraws, and an undated retractor withdraws full stop. That is not the snapshot's question, where a retraction stands only from its recordedAt on, and the note says so next to the count.")]
async fn onto_temporal_conflicts(&self) -> String {
use crate::temporal::Temporal;
match Temporal::new(self.graph.clone()).conflicts() {
diff --git a/src/temporal.rs b/src/temporal.rs
index d08709b3..0c542cab 100644
--- a/src/temporal.rs
+++ b/src/temporal.rs
@@ -73,10 +73,14 @@
//! not consulted, for a retraction no more than for a `recordedUntil`, and
//! the graph takes the ordinary path: one rule for every recorded-time fact,
//! a closing bound asserted or derived and a withdrawal alike. In
-//! `conflicts` a disjointness
-//! pair where one graph supersedes the other, directly or through a chain, is
-//! a correction whatever its periods, and lands in `corrections` rather than
-//! `contradictions`. A successor recorded before its predecessor produces a
+//! `conflicts`, which takes no `as_of`, an asserted fact about standing
+//! pre-empts the period comparison: a disjointness pair one side of which a
+//! `retracts` link has withdrawn lands in `retracted`, and a pair where one
+//! graph supersedes the other, directly or through a chain, lands in
+//! `corrections`, retraction checked first as the snapshot does; neither is
+//! a contradiction whatever its periods. With no `as_of` "retracted" there
+//! means a retraction is recorded, whenever it was, and the note says so.
+//! A successor recorded before its predecessor produces a
//! transaction interval that closes before it opens: it is reported as
//! inverted and believed at no instant, never clamped.
//!
@@ -2519,6 +2523,7 @@ impl Temporal {
};
let mut conflicts = Vec::new();
+ let mut retracted = Vec::new();
let mut corrections = Vec::new();
let mut non_overlapping = Vec::new();
let mut undecided = Vec::new();
@@ -2551,9 +2556,43 @@ impl Temporal {
"periods": [va.shown.describe(), vb.shown.describe()],
"graphs": [&ga, &gb],
});
- // Asserted lineage first: a pair one side of which replaces the
- // other is a correction whatever the periods say, and the
- // overlap test is never reached for it.
+ // Asserted facts about standing first, and the overlap test is
+ // never reached for a pair one of them settles. Retraction before
+ // supersession, the snapshot's order: two tools disagreeing about
+ // precedence would be a defect of its own.
+ //
+ // A retracted side (#128). `retracted_by` holds the EFFECTIVE
+ // retractors `derive_lineage` kept, earliest recorded first and
+ // the undated ones last, so the first is the one to name. There
+ // is no `as_of` here, so no instant on the recorded axis is asked
+ // about, and "retracted" can only mean that a retraction is
+ // RECORDED, whenever it was: one recorded after every period in
+ // the store withdraws, and an undated one withdraws full stop,
+ // as it does at every `as_of` the snapshot is given. That is a
+ // different question from the snapshot's, which asks whether the
+ // retraction stood at `as_of`, and the note names the difference
+ // next to the count. The pair MOVES to a bucket of its own rather
+ // than leaving the answer: dropping the withdrawn graph from the
+ // comparison would make `contradiction_count` smaller for a
+ // reason the output never states.
+ let withdrawn: Vec<serde_json::Value> = [(&ga, va), (&gb, vb)]
+ .into_iter()
+ .filter_map(|(g, p)| {
+ let r = p.lineage.retracted_by.first()?;
+ Some(serde_json::json!({
+ "graph": g,
+ "retracted_by": r.graph.as_str(),
+ "retracted_at": r.recorded_lexical.as_deref(),
+ }))
+ })
+ .collect();
+ if !withdrawn.is_empty() {
+ entry["retracted"] = serde_json::Value::Array(withdrawn);
+ retracted.push(entry);
+ continue;
+ }
+ // Then a pair one side of which replaces the other: a correction
+ // whatever the periods say.
let link = if supersedes(&ga, &gb) {
Some([&ga, &gb])
} else if supersedes(&gb, &ga) {
@@ -2602,6 +2641,16 @@ impl Temporal {
other, directly or through a chain of supersedes links, lineage that is \
asserted and never inferred, and such a pair is never a contradiction \
whatever its periods. \
+ retracted are pairs where a retracts link has withdrawn one side, or \
+ both, checked before corrections and before the overlap test, in the \
+ order onto_temporal_snapshot uses; each row names the withdrawn side, \
+ the graph that retracts it and the recordedAt that was recorded, and \
+ such a pair is never a contradiction whatever its periods. This tool \
+ takes no as_of, so no instant on the recorded axis is asked about, and \
+ retracted here means that a retraction is recorded, whenever it was: \
+ one recorded after every period in the store withdraws, and an undated \
+ retractor withdraws full stop. That is not the snapshot's question, \
+ where a retraction stands only from its recordedAt on. \
superseded is the same set as non_overlapping under a name that claimed \
more than was proven; it is deprecated and will be dropped at 2.0.",
});
@@ -2616,9 +2665,9 @@ impl Temporal {
"validities",
"pairs whose validity rows fell past the limit were compared as timeless, and \
a timeless period overlaps everything: superseded corrections can appear here \
- as contradictions; a supersedes row that fell past the limit while its \
- asserter's bounds did not was never seen, so the pair it links was compared \
- on its periods and can appear here as a contradiction too",
+ as contradictions; a supersedes or retracts row that fell past the limit \
+ while its asserter's bounds did not was never seen, so the pair it links \
+ was compared on its periods and can appear here as a contradiction too",
),
scan.capped.report(
"conflict_pairs",
@@ -2630,6 +2679,10 @@ impl Temporal {
.flatten()
.collect();
+ if !retracted.is_empty() {
+ out["retracted"] = serde_json::Value::Array(retracted.clone());
+ out["retracted_count"] = serde_json::Value::from(retracted.len());
+ }
if !corrections.is_empty() {
out["corrections"] = serde_json::Value::Array(corrections.clone());
out["corrections_count"] = serde_json::Value::from(corrections.len());
@@ -2644,9 +2697,10 @@ impl Temporal {
if validity_scan.hit {
out["warning"] = serde_json::Value::String(
"UNSOUND CLASSIFICATION: the validity scan hit its row limit, so some pairs \
- were compared without their periods, or without the supersedes link that \
- would have pre-empted the comparison. A correction can be reported here as \
- a contradiction, which is the one thing this tool exists to prevent; \
+ were compared without their periods, or without the supersedes or retracts \
+ link that would have pre-empted the comparison. A correction or a withdrawn \
+ claim can be reported here as a contradiction, which is the one thing this \
+ tool exists to prevent; \
contradiction_count is an upper bound over the pairs that were examined, and \
says nothing about any pair the candidate scan did not reach. See truncated."
.to_string(),
@@ -3137,17 +3191,21 @@ ex:g1 { ex:X ex:p ex:one . }
);
assert_eq!(cut["truncated"][0]["scan"], "validities");
assert_eq!(cut["truncated"][0]["limit"], 1);
- // The supersedes rows share the cap with the bounds, so a link can be
- // cut while both periods survive: the pair is then compared on
- // periods the link was meant to pre-empt. Both texts say so, and
- // neither names a graph.
+ // The supersedes and retracts rows share the cap with the bounds, so
+ // a link can be cut while both periods survive: the pair is then
+ // compared on periods the link was meant to pre-empt. Both texts say
+ // so, name both links, and neither names a graph.
let consequence = cut["truncated"][0]["consequence"].as_str().unwrap();
assert!(
- consequence.contains("supersedes row") && consequence.contains("never seen"),
- "a cut link is a second way a correction reads as a contradiction: {consequence}"
+ consequence.contains("supersedes or retracts row") && consequence.contains("never seen"),
+ "a cut link is a second way a correction or a withdrawal reads as a \
+ contradiction: {consequence}"
);
let warning = cut["warning"].as_str().unwrap();
- assert!(warning.contains("without the supersedes link"), "{warning}");
+ assert!(
+ warning.contains("without the supersedes or retracts link"),
+ "{warning}"
+ );
assert!(
!consequence.contains("http") && !warning.contains("http"),
"{cut}"
diff --git a/tests/temporal_conformance_test.rs b/tests/temporal_conformance_test.rs
index 0423dcc9..169d4722 100644
--- a/tests/temporal_conformance_test.rs
+++ b/tests/temporal_conformance_test.rs
@@ -585,6 +585,12 @@ fn the_note_claims_only_what_the_code_checks() {
"and must say what puts a pair in corrections, which is an asserted link and \
nothing about its periods: {note}"
);
+ assert!(
+ note.contains("retracted") && note.contains("whenever it was"),
+ "and must say what puts a pair in retracted, and that with no as_of a recorded \
+ retraction counts whenever it was recorded, which is not the snapshot's \
+ question: {note}"
+ );
}
/// Two periods that DO share an hour, written with different timezone offsets.
@@ -2496,3 +2502,241 @@ fn a_link_the_lineage_pass_rejected_puts_no_pair_in_corrections() {
assert!(out.get("corrections_count").is_none(), "{out}");
assert_eq!(out["complete"], true, "{out}");
}
+
+// ---------------------------------------------------------------------------
+// Section six: a retracted assertion is not a contradiction partner (#128).
+//
+// `conflicts()` takes no `as_of`, and until this section it never read the
+// retractors the lineage pass had derived: a graph a `retracts` link had
+// withdrawn was compared on its valid period like any live one, and the
+// disjointness pair it belonged to landed in `contradictions` or in
+// `non_overlapping`, history reported as news, while the snapshot at any
+// `as_of` from the retraction on filed the same graph under `retracted`. The
+// rule that already puts a superseded pair in `corrections` applies here: an
+// asserted fact about standing pre-empts the period comparison. Four
+// decisions, taken on the issue. The pair MOVES to a bucket of its own rather
+// than leaving, because a count that shrinks for a reason the output never
+// states is the failure mode this module exists to prevent. With no `as_of`
+// "retracted" means a retraction is RECORDED, whenever it was, and the note
+// says so, since that is not the snapshot's question. An undated retractor
+// withdraws, full stop. And retraction is checked before supersession, the
+// snapshot's order, so the two tools cannot disagree about precedence.
+// ---------------------------------------------------------------------------
+
+/// Issue #128's own example: two overlapping disjoint assertions, the earlier
+/// one withdrawn a year later by a graph that puts nothing in its place.
+const ISSUE_128: &str = r#"
+@prefix ex: <http://example.org/> .
+@prefix owl: <http://www.w3.org/2002/07/owl#> .
+@prefix t: <https://open-ontologies.org/temporal#> .
+
+ex:g_a { ex:X a ex:Adherent . }
+ex:g_b { ex:X a ex:Suspension . }
+ex:r { ex:X ex:note "withdrawn" . }
+
+{
+ ex:Adherent owl:disjointWith ex:Suspension .
+ ex:g_a t:validFrom "2024-01-01" ; t:recordedAt "2024-01-05" .
+ ex:g_b t:validFrom "2024-01-01" ; t:recordedAt "2024-02-01" .
+ ex:r t:retracts ex:g_a ; t:recordedAt "2025-01-01" .
+}
+"#;
+
+/// The withdrawn sides named on one row of the `retracted` bucket.
+fn withdrawn(out: &serde_json::Value, row: usize) -> Vec<serde_json::Value> {
+ out["retracted"][row]["retracted"]
+ .as_array()
+ .unwrap_or_else(|| panic!("retracted row {row} names no withdrawn side: {out}"))
+ .clone()
+}
+
+#[test]
+fn a_retracted_side_moves_the_pair_out_of_contradictions_into_its_own_bucket() {
+ let t = temporal(ISSUE_128);
+ // The snapshot has said so since #109: from the retraction on, g_a is
+ // withdrawn and never in scope.
+ let snap = snapshot(&t, None, Some("2026-01-01"));
+ assert_eq!(
+ bucket_row(&snap, "retracted", "g_a")["reason"],
+ "retracted",
+ "{snap}"
+ );
+ assert!(!graphs(&snap, "in_scope").contains("g_a"), "{snap}");
+ assert!(graphs(&snap, "in_scope").contains("g_b"), "{snap}");
+ // The conflict check agrees. Before this it filed the pair as a live
+ // contradiction: two overlapping disjoint types, one of them withdrawn.
+ let out = conflicts(&t);
+ assert_eq!(
+ out["contradiction_count"], 0,
+ "a withdrawn claim is history reported as news here: {out}"
+ );
+ assert_eq!(out["non_overlapping_count"], 0, "{out}");
+ assert_eq!(out["retracted_count"], 1, "{out}");
+ assert_eq!(partners(&out, "retracted"), set(&["g_a", "g_b"]), "{out}");
+ // The row says WHICH side was withdrawn, by what, and when, in the shape
+ // of the snapshot's own retracted row, so the two answers read together.
+ let w = withdrawn(&out, 0);
+ assert_eq!(w.len(), 1, "{out}");
+ assert!(w[0]["graph"].as_str().unwrap().ends_with("/g_a"), "{out}");
+ assert!(
+ w[0]["retracted_by"].as_str().unwrap().ends_with("/r"),
+ "{out}"
+ );
+ assert_eq!(w[0]["retracted_at"], "2025-01-01", "{out}");
+ // The pair moved, it did not leave: the row keeps the subject, the types
+ // and the periods every other bucket carries, so nothing about it has to
+ // be looked up elsewhere to see what it would have been.
+ let row = &out["retracted"][0];
+ assert_eq!(row["subject"], "X", "{row}");
+ assert_eq!(row["types"].as_array().unwrap().len(), 2, "{row}");
+ assert_eq!(row["periods"].as_array().unwrap().len(), 2, "{row}");
+ assert_eq!(out["complete"], true, "{out}");
+ // A store with no retraction has no bucket at all, like corrections.
+ let plain = conflicts(&temporal(ISSUE_109));
+ assert!(plain.get("retracted").is_none(), "{plain}");
+ assert!(plain.get("retracted_count").is_none(), "{plain}");
+}
+
+/// Both periods closed, and the retraction recorded in a year neither of them
+/// reaches: the case that separates "a retraction is recorded" from "a
+/// retraction stands at as_of".
+const ISSUE_128_LATE_RETRACTION: &str = r#"
+@prefix ex: <http://example.org/> .
+@prefix owl: <http://www.w3.org/2002/07/owl#> .
+@prefix t: <https://open-ontologies.org/temporal#> .
+
+ex:g_a { ex:X a ex:Adherent . }
+ex:g_b { ex:X a ex:Suspension . }
+ex:r { ex:X ex:note "withdrawn" . }
+
+{
+ ex:Adherent owl:disjointWith ex:Suspension .
+ ex:g_a t:validFrom "2024-01-01" ; t:validTo "2025-01-01" ; t:recordedAt "2024-01-05" .
+ ex:g_b t:validFrom "2024-01-01" ; t:validTo "2026-01-01" ; t:recordedAt "2024-02-01" .
+ ex:r t:retracts ex:g_a ; t:recordedAt "2099-01-01" .
+}
+"#;
+
+#[test]
+fn with_no_as_of_a_recorded_retraction_withdraws_whenever_it_was_recorded_and_the_note_says_so() {
+ let t = temporal(ISSUE_128_LATE_RETRACTION);
+ // The snapshot asks whether the retraction STOOD at as_of, and in 2030 it
+ // did not: g_a takes the ordinary path there and is excluded on its
+ // bounds, not retracted.
+ let snap = snapshot(&t, None, Some("2030-01-01"));
+ assert!(snap.get("retracted").is_none(), "{snap}");
+ assert!(graphs(&snap, "in_scope").contains("g_a"), "{snap}");
+ // The conflict check has no as_of and asks a different question: is a
+ // retraction recorded, whenever it was. It is, so the pair is retracted
+ // here although at every instant either period holds the withdrawal had
+ // not yet been recorded.
+ let out = conflicts(&t);
+ assert_eq!(out["contradiction_count"], 0, "{out}");
+ assert_eq!(out["retracted_count"], 1, "{out}");
+ assert_eq!(withdrawn(&out, 0)[0]["retracted_at"], "2099-01-01", "{out}");
+ // Two notions under one word is exactly what has to be written down next
+ // to the count, in the tool's own words, or a reader infers the
+ // snapshot's meaning and gets a different answer from the two tools for
+ // reasons the output never states.
+ let note = out["note"].as_str().unwrap();
+ assert!(
+ note.contains("whenever it was"),
+ "the note must name the instant rule with no as_of: {note}"
+ );
+}
+
+/// A retractor that carries no `recordedAt`: the withdrawal cannot be dated.
+const ISSUE_128_UNDATED_RETRACTOR: &str = r#"
+@prefix ex: <http://example.org/> .
+@prefix owl: <http://www.w3.org/2002/07/owl#> .
+@prefix t: <https://open-ontologies.org/temporal#> .
+
+ex:g_a { ex:X a ex:Adherent . }
+ex:g_b { ex:X a ex:Suspension . }
+ex:r { ex:X ex:note "withdrawn" . }
+
+{
+ ex:Adherent owl:disjointWith ex:Suspension .
+ ex:g_a t:validFrom "2024-01-01" ; t:recordedAt "2024-01-05" .
+ ex:g_b t:validFrom "2024-01-01" ; t:recordedAt "2024-02-01" .
+ ex:r t:retracts ex:g_a .
+}
+"#;
+
+#[test]
+fn an_undated_retractor_withdraws_in_conflicts_full_stop() {
+ let t = temporal(ISSUE_128_UNDATED_RETRACTOR);
+ // Since #125 an undated retractor stands at every as_of asked about, and
+ // the snapshot reports that it could not be dated.
+ let snap = snapshot(&t, None, Some("2000-01-01"));
+ assert_eq!(
+ bucket_row(&snap, "retracted", "g_a")["reason"],
+ "retracted",
+ "{snap}"
+ );
+ assert!(
+ lineage_about(&snap, "g_a")
+ .iter()
+ .any(|r| r["reason"].as_str().unwrap().contains("no recordedAt")),
+ "{snap}"
+ );
+ // Here no instant is asked about at all, so it withdraws, full stop, and
+ // the row carries no instant because the data carries none. The
+ // consistency between the two tools is the only thing that makes them
+ // legible together, which is why it is pinned.
+ let out = conflicts(&t);
+ assert_eq!(out["contradiction_count"], 0, "{out}");
+ assert_eq!(out["retracted_count"], 1, "{out}");
+ let w = withdrawn(&out, 0);
+ assert!(
+ w[0]["retracted_by"].as_str().unwrap().ends_with("/r"),
+ "{out}"
+ );
+ assert!(w[0]["retracted_at"].is_null(), "{out}");
+}
+
+/// The successor supersedes the predecessor AND a third graph retracts the
+/// predecessor: two asserted facts about one graph's standing.
+const ISSUE_128_SUPERSEDED_AND_RETRACTED: &str = r#"
+@prefix ex: <http://example.org/> .
+@prefix owl: <http://www.w3.org/2002/07/owl#> .
+@prefix t: <https://open-ontologies.org/temporal#> .
+
+ex:g_a { ex:X a ex:Adherent . }
+ex:g_b { ex:X a ex:Suspension . }
+ex:r { ex:X ex:note "withdrawn" . }
+
+{
+ ex:Adherent owl:disjointWith ex:Suspension .
+ ex:g_a t:validFrom "2024-01-01" ; t:recordedAt "2024-01-05" .
+ ex:g_b t:validFrom "2024-01-01" ; t:recordedAt "2024-02-01" ; t:supersedes ex:g_a .
+ ex:r t:retracts ex:g_a ; t:recordedAt "2025-01-01" .
+}
+"#;
+
+#[test]
+fn superseded_and_retracted_at_once_is_retracted_first_as_in_the_snapshot() {
+ let t = temporal(ISSUE_128_SUPERSEDED_AND_RETRACTED);
+ // The snapshot checks retraction before the bounds, a derived closing
+ // bound included, so after both are recorded g_a is retracted and not
+ // excluded as superseded.
+ let snap = snapshot(&t, None, Some("2026-01-01"));
+ assert_eq!(
+ bucket_row(&snap, "retracted", "g_a")["reason"],
+ "retracted",
+ "{snap}"
+ );
+ assert!(!graphs(&snap, "excluded").contains("g_a"), "{snap}");
+ // The conflict check takes the same order. Two tools disagreeing about
+ // precedence between retraction and supersession would be a defect of
+ // its own, and the snapshot is the one a reader meets first.
+ let out = conflicts(&t);
+ assert_eq!(out["contradiction_count"], 0, "{out}");
+ assert_eq!(out["retracted_count"], 1, "{out}");
+ assert_eq!(partners(&out, "retracted"), set(&["g_a", "g_b"]), "{out}");
+ assert!(
+ out.get("corrections").is_none(),
+ "retracted is checked before corrections, so the pair is filed once: {out}"
+ );
+ assert!(out.get("corrections_count").is_none(), "{out}");
+}