Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.
Rust ai-nativedescription-logicsformal-verificationinfrastructure-as-codeisabelle-languageknowledge-graphleanlean4mcpmcp-serverontologyowlowl2reasoningrustshaclsparqltheorem-proving
The store gives a literal back as it was written, so sh:value carries "4.0" and not "4" (#335)
FABIOTESS4f0869657125
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0e9178c1..77db8573 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -150,6 +150,32 @@ All notable changes to Open Ontologies are documented here.and it no longer claims that the ceiling "cannot" fire, since that wasarithmetic about the tableaux and not about the run.+- **The store gives a literal back as it was written** (#335; the store fix+ is oxigraph/oxigraph#2010 by Fabio Rovai, backported onto the pinned fork+ as rev 6409fa1c). Oxigraph 0.5.9 stored every literal of an XSD datatype it+ could value-encode by value and gave it back in canonical form:+ `"4.0"^^xsd:decimal` came back as `"4"`, `"1"^^xsd:boolean` as `"true"`,+ `"5"^^xsd:int` as `"5"^^xsd:integer`, and `"4.0"` and `"4"` loaded as one+ triple. The pinned store value-encodes a literal only when decoding gives it+ back as written. So `sh:value` and a literal focus node now carry the term as+ written (W3C `core/node/maxExclusive-001` and `minExclusive-001` match their+ expected reports: report match 49 to 51 of 56; gated column 61 and full-tuple+ column 53 unchanged, baseline byte-identical), a load-then-serialise round+ trip no longer rewrites literals, and `asserted.tsv` carries literals as+ written. NOT fixed, because the SPARQL evaluator (`spareval`) is unpatched:+ inside a query `STR("4.0"^^xsd:decimal)` is still `"4"` and+ `DATATYPE("5"^^xsd:int)` still `xsd:integer`, so `sh:pattern "\.0$"` still+ reports `"4.0"^^xsd:decimal`, and `sh:datatype` naming one of the twelve+ integer-derived types or `xsd:dateTimeStamp` is still recorded as not+ evaluated (measured over every XSD datatype; pinned in+ `tests/datatype_preservation_test.rs` and+ `inside_a_query_a_known_datatype_literal_is_still_read_by_value`).+- **A projection-entailment goal written with a literal is asked as written**+ (consequence of #335). Goals are still round-tripped through a store, but the+ store no longer respells `"01"^^xsd:integer` as `"1"`, so a goal `"01"` asked+ of a source that says `"1"` is `ungrounded_in_source`, where it used to come+ back `preserved_asserted`. One value, two terms, which is what the checker+ has always done.- **A datatype the store cannot tell apart is refused inside `sh:or`,`sh:not` and `sh:qualifiedValueShape`, as it already was on its own.** Thestore widens xsd:int, xsd:nonNegativeInteger and the other integer-deriveddiff --git a/Cargo.lock b/Cargo.lockindex 5e13e852..fa3b8eef 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2850,7 +2850,7 @@ dependencies = [[[package]]name = "oxigraph"version = "0.5.9"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["dashmap","getrandom 0.3.4",@@ -2887,7 +2887,7 @@ checksum = "54b4ed3a7192fa19f5f48f99871f2755047fabefd7f222f12a1df1773796a102"[[package]]name = "oxjsonld"version = "0.2.5"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["json-event-parser","oxiri",@@ -2899,7 +2899,7 @@ dependencies = [[[package]]name = "oxrdf"version = "0.3.3"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["hex","oxilangtag",@@ -2913,7 +2913,7 @@ dependencies = [[[package]]name = "oxrdfio"version = "0.2.5"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["oxjsonld","oxrdf",@@ -2925,7 +2925,7 @@ dependencies = [[[package]]name = "oxrdfxml"version = "0.2.3"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["oxilangtag","oxiri",@@ -2937,7 +2937,7 @@ dependencies = [[[package]]name = "oxrocksdb-sys"version = "0.5.9"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["bindgen","cc",@@ -2946,7 +2946,7 @@ dependencies = [[[package]]name = "oxsdatatypes"version = "0.2.2"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["thiserror",]@@ -2954,7 +2954,7 @@ dependencies = [[[package]]name = "oxttl"version = "0.2.3"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["memchr","oxilangtag",@@ -4053,7 +4053,7 @@ dependencies = [[[package]]name = "sparesults"version = "0.3.3"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["json-event-parser","memchr",@@ -4065,7 +4065,7 @@ dependencies = [[[package]]name = "spareval"version = "0.2.6"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["hex","json-event-parser",@@ -4087,7 +4087,7 @@ dependencies = [[[package]]name = "spargebra"version = "0.4.6"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["oxilangtag","oxiri",@@ -4100,7 +4100,7 @@ dependencies = [[[package]]name = "sparopt"version = "0.3.6"-source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=abf36ef22b61f9c4d810b94b647d500c05ee791c#abf36ef22b61f9c4d810b94b647d500c05ee791c"+source = "git+https://github.com/fabio-rovai/oxigraph.git?rev=6409fa1c8ad5880399d0ca69b38e43cbb2052ad7#6409fa1c8ad5880399d0ca69b38e43cbb2052ad7"dependencies = ["oxrdf","rand 0.9.4",diff --git a/Cargo.toml b/Cargo.tomlindex 6d49e5d3..d69e1f0c 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -119,18 +119,26 @@ toml = "0.8"# not grow by a single crate.proptest = "1"-# A patched Oxigraph, pinned by revision.+# A patched Oxigraph, pinned by revision. Two changes over 0.5.9, on branch+# `oo/lexical-forms-0.5.9` of the fork.#-# `Store::snapshot` is not in Oxigraph 0.5.9. It is a read view pinned to one-# state that takes no lock, and decision 0010 explains at length why neither-# thing the unpatched crate offers will do: a transaction pins the state but-# stops every writer for the length of a reasoning run on the memory backend,-# and copying the graph costs about 221 bytes a triple. The patch is a public-# wrapper over `Storage::snapshot`, which `Store::len` and-# `Store::quads_for_pattern` already call internally on every read.+# 1. `Store::snapshot`, not in Oxigraph 0.5.9. It is a read view pinned to one+# state that takes no lock, and decision 0010 explains at length why neither+# thing the unpatched crate offers will do: a transaction pins the state but+# stops every writer for the length of a reasoning run on the memory backend,+# and copying the graph costs about 221 bytes a triple. The patch is a public+# wrapper over `Storage::snapshot`, which `Store::len` and+# `Store::quads_for_pattern` already call internally on every read.+# 2. A literal is kept as written (oxigraph/oxigraph#2010, fixing #1989; here+# #335). 0.5.9 stored every literal of an XSD datatype with a value encoding+# by value and gave it back in the canonical form of the primitive type, so+# "4.0"^^xsd:decimal came back as "4", "1"^^xsd:boolean as "true",+# "5"^^xsd:int as "5"^^xsd:integer, and "4.0" and "4" loaded as one triple.+# A literal is now value-encoded only when decoding gives back the same+# datatype and lexical form; any other takes the generic typed-literal path.## Pinned by REVISION and not by branch, so that what CI builds is what was-# reviewed. Upstream at oxigraph/oxigraph; when it lands this stanza goes and+# reviewed. Upstream at oxigraph/oxigraph; when both land this stanza goes and# the version bound below is all that remains.[patch.crates-io]-oxigraph = { git = "https://github.com/fabio-rovai/oxigraph.git", rev = "abf36ef22b61f9c4d810b94b647d500c05ee791c" }+oxigraph = { git = "https://github.com/fabio-rovai/oxigraph.git", rev = "6409fa1c8ad5880399d0ca69b38e43cbb2052ad7" }diff --git a/docs/UPSTREAM_ISSUES.md b/docs/UPSTREAM_ISSUES.mdindex d915aa32..e7b1a3f5 100644--- a/docs/UPSTREAM_ISSUES.md+++ b/docs/UPSTREAM_ISSUES.md@@ -8,6 +8,17 @@ send.## 1. Twelve XSD integer-derived datatypes, and `xsd:dateTimeStamp`, are not preserved+**Status, 28 Oct 2026.** 1a is fixed in the pinned fork and filed upstream as+oxigraph/oxigraph#2010 (issue #1989): the store value-encodes a literal only+when decoding gives it back as written, so these datatypes, and non-canonical+lexical forms such as `"4.0"^^xsd:decimal`, now survive a load (here #335,+`tests/datatype_preservation_test.rs::the_store_keeps_every_declared_datatype`).+1b is NOT fixed: measured on the new pin, `DATATYPE()` still answers+`xsd:integer` for the twelve and `xsd:dateTime` for `xsd:dateTimeStamp`, and+`STR()` of a known-datatype literal is still its canonical form, inside any+query, whether the literal is stored or written in the query text. So the+workaround below stays.+**Two independent defects, in two crates.** They were first reported here as one,blamed on storage. That was wrong, and the correction matters for anyone actingon it: fixing the storage encoder alone leaves `DATATYPE()` still returning the@@ -113,9 +124,11 @@ up here rather than attempted blind.### Our workaround`datatype_is_indistinguishable_in_store` in `src/shacl.rs` records a-`sh:datatype` constraint naming one of these as unevaluated rather than answering-it wrongly. `tests/datatype_preservation_test.rs` pins the exact affected set and-fails in both directions, so the workaround is removed when this is fixed.+`sh:datatype` constraint (and, since the #333 follow-ups, an `sh:or`, `sh:not`,+qualified or `sh:node` member) naming one of these as unevaluated rather than+answering it wrongly. With 1a fixed it rests on 1b alone.+`tests/datatype_preservation_test.rs` pins the exact set `DATATYPE()` misreports+and fails in both directions, so the workaround is removed when 1b is fixed.---diff --git a/docs/decisions/0007-a-slice-preserves-a-conclusion-or-it-does-not.md b/docs/decisions/0007-a-slice-preserves-a-conclusion-or-it-does-not.mdindex bdf02b75..c1c85f18 100644--- a/docs/decisions/0007-a-slice-preserves-a-conclusion-or-it-does-not.md+++ b/docs/decisions/0007-a-slice-preserves-a-conclusion-or-it-does-not.md@@ -215,6 +215,10 @@ test fails if the gate is disarmed on more than half the corpus.certificate and is reported LOST, which is a false loss with a green-looking pipeline round it. Goals arenow round-tripped through a real `GraphStore`, one triple per named graph so a set cannot collapseduplicates or shift the caller's pairing, and both `as_written` and `goal` are printed.+ *Superseded in part by #335 (28 Oct 2026):* the pinned store no longer canonicalises, so the+ round trip leaves `"01"` as `"01"`, and a goal `"01"` asked of a source holding `"1"` is+ ungrounded rather than preserved. The round trip stays so that goal and store are spelled by the+ same code.4. **`GraphStore::canonicalize_blank_nodes` is the wrong tool and is now pinned as such.** RDFC-1.0labels are a function of the WHOLE graph. Measured on `pizza-reference.owl`, taking a genuinediff --git a/docs/lean-certificates.md b/docs/lean-certificates.mdindex cd521408..4f072d6b 100644--- a/docs/lean-certificates.md+++ b/docs/lean-certificates.md@@ -922,8 +922,9 @@ Stated rather than discovered later.exactly their own rule once. No rule in the table is unreachable, so the seven were a gap in thecorpus and not a defect in the engine.- **`asserted.tsv` is the store, not your file.** Quads are flattened, so a triple present in two- named graphs appears on two lines. Literals are in the store's post-parse canonical spelling, so- `"01"^^xsd:integer` is written `"1"^^xsd:integer`. The guarantee is relative to that file.+ named graphs appears on two lines. Literals are as the store gives them back, which since #335+ is as they were written: `"01"^^xsd:integer` stays `"01"` (under Oxigraph 0.5.9 it was written+ `"1"^^xsd:integer`). The guarantee is relative to that file.- **`asserted.tsv` is the store the run SELECTED, and the checker cannot see the selection.** Bydefault that is every graph. Over a store that keeps several versions of an entity in severalnamed graphs, the union of every version is a state that held at no instant, and a certificatediff --git a/docs/projection-entailment.md b/docs/projection-entailment.mdindex 72c56eee..3fb18f92 100644--- a/docs/projection-entailment.md+++ b/docs/projection-entailment.md@@ -48,9 +48,11 @@ EOF````--goals` is a Turtle document in which every triple is a claim. It is parsed by the SAME parser the-store uses and round-tripped through a store, which is the only thing that makes a caller's spelling-of a term comparable with the interner's: `"01"^^xsd:integer` is stored as `"1"^^xsd:integer`, and a-goal that skipped the store would match nothing and be reported lost. A TSV works too, with+store uses and round-tripped through a store, so a caller's spelling of a term is the interner's. A+literal is asked as written: since #335 the store keeps `"01"^^xsd:integer` as `"01"`, so the goal+matches a source that says `"01"` and not one that says `"1"`. One value, two terms; nothing here+compares literals by value. (Under Oxigraph 0.5.9 the store respelled both as `"1"`, and the two+matched.) A TSV works too, with`--goals-skip-columns 1` so `derivations.tsv` from `reason --certificate` pipes straight in.Over MCP, `graph_projection_entailment_check` takes `goals_ttl` and either `projected_ttl` ordiff --git a/src/graph.rs b/src/graph.rsindex 6615780a..9cdcb50c 100644--- a/src/graph.rs+++ b/src/graph.rs@@ -1392,13 +1392,14 @@ impl GraphStore {/// Round-trip triples through a STORE, in order, keeping duplicates.////// Parsing alone is not enough, and this is measured rather than assumed:- /// oxigraph's parser preserves a literal's lexical form, and it is the- /// STORE that normalises it. `"01"^^xsd:integer` comes back from- /// [`parse_triples_ordered`](Self::parse_triples_ordered) exactly as- /// written and out of [`all_triples`](Self::all_triples) as- /// `"1"^^xsd:integer`. A caller that compares its own spelling of a term- /// against what a certificate holds therefore has to push the term through- /// a store first, or it matches nothing and the miss looks like data loss.+ /// A caller that compares its own spelling of a term against what a+ /// certificate holds pushes the term through a store first, so the two are+ /// spelled by the same code. Until #335 that was what made them match:+ /// Oxigraph 0.5.9's parser kept `"01"^^xsd:integer` and its store gave it+ /// back as `"1"^^xsd:integer`. The pinned store keeps literals as written,+ /// so the round trip no longer respells a literal, and `"01"` and `"1"`+ /// are two terms on both sides; it still refuses what no serialiser can+ /// write, and it keeps the comparison honest if the store changes again.////// Each triple gets its own named graph, because a store is a SET: two/// identical inputs would otherwise collapse to one and the caller'sdiff --git a/src/ofn_writer.rs b/src/ofn_writer.rsindex b52fdc97..b37e302f 100644--- a/src/ofn_writer.rs+++ b/src/ofn_writer.rs@@ -231,9 +231,13 @@ pub fn is_ofn_format(name: &str) -> bool {/// cannot disagree about what was left out.////// The document's triples are handed over as parsed, without passing through-/// a store: Oxigraph's store re-types an `xsd:nonNegativeInteger` literal as-/// `xsd:integer` (measured on `owl:minCardinality 2`), and every cardinality-/// that had happened to would be refused as outside Table 1.+/// a store, so nothing between the file and the writer can respell a term.+/// That was first done because Oxigraph 0.5.9's store re-typed an+/// `xsd:nonNegativeInteger` literal as `xsd:integer` (measured on+/// `owl:minCardinality 2`), and every such cardinality would have been refused+/// as outside Table 1. The pinned store keeps literals as written since #335+/// (`tests/datatype_preservation_test.rs`); reading without one is kept+/// because it is the shorter path, not because a store would now be wrong.pub fn convert_file(path: &str) -> anyhow::Result<OfnOutput> {let (quads, prefixes) = crate::graph::GraphStore::read_file_with_prefixes(path)?;let triples: Vec<Triple> = quads.into_iter().map(Triple::from).collect();diff --git a/src/projection_entailment.rs b/src/projection_entailment.rsindex 559df5d5..fbd524c7 100644--- a/src/projection_entailment.rs+++ b/src/projection_entailment.rs@@ -275,11 +275,12 @@ fn accept(idx: usize, as_written: String, t: Spelled) -> Goal {/// Parse a Turtle document in which every triple is a goal.///-/// Prefix resolution and literal canonicalisation come from the same parser the-/// store uses, which is the ONLY way a goal's spelling can match the-/// interner's. A hand-typed goal that skipped the parser matches nothing and is-/// reported lost, which is a false loss with a green-looking pipeline around-/// it.+/// Prefix resolution comes from the same parser the store uses, and each goal+/// is spelled by a store round trip, so a goal's spelling is the interner's.+/// A literal is asked as written: since #335 the store keeps+/// `"01"^^xsd:integer` as `"01"`, so it matches a certificate holding `"01"`+/// and not one holding `"1"`. Those are one value and two terms, and no rule+/// or checker here compares literals by value.pub fn parse_goals_turtle(goals_ttl: &str) -> anyhow::Result<(Vec<Goal>, Vec<RefusedGoal>)> {let parsed = match GraphStore::parse_triples_ordered(goals_ttl, "turtle") {Ok(v) => v,@@ -301,8 +302,9 @@ pub fn parse_goals_turtle(goals_ttl: &str) -> anyhow::Result<(Vec<Goal>, Vec<Ref}};// The parser's rendering is `as_written`; the STORE's is what is asked.- // They differ: oxigraph's parser keeps a literal's lexical form and the- // store normalises it, so a goal that skipped the store matches nothing.+ // Until #335 they differed (the store normalised a literal's lexical+ // form); the pinned store keeps it, and the round trip stays so that the+ // two are spelled by the same code whatever the store does.let raw: Vec<(String, Spelled)> = parsed.into_iter().map(|t| (format!("{} {} {}", t.0, t.1, t.2), t))@@ -366,11 +368,12 @@ pub fn goals_from_bindings(/// Round-trip every candidate through a STORE in ONE pass, in document order,/// keeping the pairing between what was written and what came back.///-/// The store, not just the parser: `"01"^^xsd:integer` survives-/// `RdfParser` unchanged and comes out of a store as `"1"^^xsd:integer`, so a-/// goal canonicalised only by the parser matches nothing in a certificate and-/// is reported LOST. That is a false loss with a green-looking pipeline round-/// it, and it is the reason `as_written` and `goal` are both printed.+/// The store, not just the parser, because a certificate holds what the store+/// gave back. Under Oxigraph 0.5.9 `"01"^^xsd:integer` survived `RdfParser`+/// and came out of a store as `"1"^^xsd:integer`, so a goal spelled only by+/// the parser matched nothing and was reported LOST. The pinned store keeps+/// the spelling (#335), so the two now agree; `as_written` and `goal` are+/// both still printed.fn canonicalise_batch(raw: Vec<(String, Spelled)>,mut refused: Vec<RefusedGoal>,diff --git a/tests/datatype_preservation_test.rs b/tests/datatype_preservation_test.rsindex b3c604d9..21f70634 100644--- a/tests/datatype_preservation_test.rs+++ b/tests/datatype_preservation_test.rs@@ -11,8 +11,17 @@//! 2. Anything written back out carries the widened type, so a published file//! no longer says what its author said.//!-//! These tests separate the two places the loss could happen — the parser or the-//! store — because the fix is in a different codebase depending on the answer.+//! These tests separate the three places the loss could happen (the parser,+//! the store, the SPARQL evaluator) because the fix is in a different place+//! depending on the answer.+//!+//! Since #335 the store keeps every datatype IRI and lexical form as written:+//! the pinned oxigraph value-encodes a literal only when decoding gives it back+//! (oxigraph/oxigraph#2010). The evaluator, `spareval`, is unpatched and still+//! reads the twelve integer-derived types as `xsd:integer` and+//! `xsd:dateTimeStamp` as `xsd:dateTime` before `DATATYPE()` sees them. Point 2+//! above is therefore fixed and point 1 is not: `DATATYPE()` is what the SHACL+//! engine tests with.use open_ontologies::graph::GraphStore;use oxigraph::io::{RdfFormat, RdfParser};@@ -45,7 +54,8 @@ ex:sex:decimal "5.5"^^xsd:decimal ;ex:token "abc"^^xsd:token ;ex:anyURI "http://x.example/"^^xsd:anyURI ;- ex:date "2026-01-01"^^xsd:date .+ ex:date "2026-01-01"^^xsd:date ;+ ex:dateTimeStamp "2026-01-01T00:00:00Z"^^xsd:dateTimeStamp ."#;/// The predicate local name is the datatype local name, so a mismatch names itself.@@ -103,21 +113,58 @@ fn datatypes_after_insert(store: &Store) -> Vec<String> {wrong}-/// The exact set of datatypes oxigraph 0.5 does not preserve.+/// The exact set of datatypes `DATATYPE()` misreports over the pinned oxigraph.////// This is a characterisation test, not an aspiration: it pins current upstream/// behaviour so the guard in `shacl.rs` can be trusted to cover exactly the right-/// IRIs and no others. It fails in both directions on purpose. If oxigraph starts-/// preserving these, it fails and the guard should be removed. If it starts losing-/// something new, it fails and the guard is missing a case.-const COLLAPSES_TO_INTEGER: [&str; 12] = [+/// IRIs and no others. It fails in both directions on purpose. If the evaluator+/// starts reporting these, it fails and the guard should be removed. If it starts+/// losing something new, it fails and the guard is missing a case. The twelve+/// collapse to `xsd:integer` and `dateTimeStamp` to `xsd:dateTime`, which are+/// the thirteen `datatype_is_indistinguishable_in_store` names.+const COLLAPSES: [&str; 13] = ["byte", "short", "int", "long","unsignedByte", "unsignedShort", "unsignedInt", "unsignedLong","positiveInteger", "negativeInteger", "nonPositiveInteger", "nonNegativeInteger",+ "dateTimeStamp",];+/// #335: the store gives every literal back with the datatype IRI and the+/// lexical form it was given. Read as TERMS, through the store API and through+/// a projected SPARQL variable, neither of which passes the literal through an+/// expression. Under Oxigraph 0.5.9 the thirteen above came back retyped, and+/// this test failed on exactly them.+#[test]+fn the_store_keeps_every_declared_datatype() {+ let store = Store::new().unwrap();+ let parser = RdfParser::from_format(RdfFormat::Turtle);+ let mut parsed = Vec::new();+ for quad in parser.for_reader(Cursor::new(DOC.as_bytes())) {+ let quad = quad.unwrap();+ parsed.push(quad.object.to_string());+ store.insert(quad.as_ref()).unwrap();+ }+ let mut back: Vec<String> = store.iter().map(|q| q.unwrap().object.to_string()).collect();+ parsed.sort();+ back.sort();+ assert_eq!(back, parsed, "the store respelled or retyped a literal");++ let graph = Arc::new(GraphStore::new());+ graph.load_turtle(DOC, None).unwrap();+ let json = graph.sparql_select("SELECT ?v WHERE { ?s ?p ?v }").unwrap();+ let rows: serde_json::Value = serde_json::from_str(&json).unwrap();+ let mut projected: Vec<String> = rows["results"]+ .as_array()+ .unwrap()+ .iter()+ .map(|r| r["v"].as_str().unwrap().to_string())+ .collect();+ projected.sort();+ assert_eq!(projected, parsed, "a projected variable respelled or retyped a literal");+}+#[test]-fn the_store_loses_exactly_the_known_datatypes_and_no_others() {+fn datatype_over_stored_literals_misreports_exactly_the_known_set() {let store = Store::new().unwrap();let parser = RdfParser::from_format(RdfFormat::Turtle);for quad in parser.for_reader(Cursor::new(DOC.as_bytes())) {@@ -128,11 +175,11 @@ fn the_store_loses_exactly_the_known_datatypes_and_no_others() {.filter_map(|line| line.split(" stored as ").next().map(str::to_string)).collect();lost.sort();- let mut want: Vec<String> = COLLAPSES_TO_INTEGER.iter().map(|s| s.to_string()).collect();+ let mut want: Vec<String> = COLLAPSES.iter().map(|s| s.to_string()).collect();want.sort();assert_eq!(lost, want,- "the set of datatypes oxigraph drops has changed. If it shrank, remove the \+ "the set of datatypes DATATYPE() misreports has changed. If it shrank, remove the \matching arm from datatype_is_indistinguishable_in_store. If it grew, add one.");}@@ -140,7 +187,7 @@ fn the_store_loses_exactly_the_known_datatypes_and_no_others() {/// The same set, through the path the tools actually take, so a regression is/// attributed to the right layer rather than to whichever test runs first.#[test]-fn graph_store_load_loses_exactly_the_same_set() {+fn datatype_after_graph_store_load_misreports_exactly_the_same_set() {let graph = Arc::new(GraphStore::new());graph.load_turtle(DOC, None).unwrap();let json = graph@@ -157,7 +204,7 @@ fn graph_store_load_loses_exactly_the_same_set() {}}lost.sort();- let mut want: Vec<String> = COLLAPSES_TO_INTEGER.iter().map(|s| s.to_string()).collect();+ let mut want: Vec<String> = COLLAPSES.iter().map(|s| s.to_string()).collect();want.sort();assert_eq!(lost, want, "the loss through load_turtle no longer matches the raw store");}@@ -165,8 +212,8 @@ fn graph_store_load_loses_exactly_the_same_set() {/// The evaluator collapses the same set, independently of storage.////// A literal typed in the query text is never stored, so this isolates-/// `spareval` from `oxigraph`'s encoder. It is why the SHACL guard cannot be-/// lifted by fixing storage alone: `DATATYPE()` would still answer wrongly.+/// `spareval` from `oxigraph`'s encoder. It is why the SHACL guard was not+/// lifted when #335 fixed storage: `DATATYPE()` still answers wrongly.////// `xsd:token` is checked alongside as a control. It is a derived type too, and/// it survives, so the behaviour is specific to this set rather than a generaldiff --git a/tests/gate_demonstration_test.rs b/tests/gate_demonstration_test.rsindex 8cb56c98..9f819367 100644--- a/tests/gate_demonstration_test.rs+++ b/tests/gate_demonstration_test.rs@@ -293,8 +293,11 @@ fn every_gate_fires_on_its_own_broken_input() {}// ── 10 ───────────────────────────────────────────────────────────────- banner(10, "the raw literal spelling matches nothing", "the goal `\"01\"^^xsd:integer` asked WITHOUT the store's canonicalisation");+ banner(10, "one value in two spellings is two terms", "the goal `\"01\"^^xsd:integer` asked of a source that says `\"1\"^^xsd:integer`");{+ // Until #335 the store respelled "01" as "1" on both sides and this+ // goal came back preserved. The pinned store keeps literals as+ // written, so the goal is not in the source, and the gate says so.let ttl = "@prefix : <http://ex.org/> .\n\@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\:a :n \"1\"^^xsd:integer .\n";@@ -316,8 +319,8 @@ fn every_gate_fires_on_its_own_broken_input() {" SAID: as_written={} -> goal={} verdict={:?}",r.per_goal[0].as_written, r.per_goal[0].goal, r.per_goal[0].verdict);- eprintln!(" AND the raw spelling asked directly: {:?}", cert.membership(&raw));- assert_eq!(r.per_goal[0].verdict, GoalVerdict::PreservedAsserted);+ eprintln!(" AND the spelling asked directly: {:?}", cert.membership(&raw));+ assert_eq!(r.per_goal[0].verdict, GoalVerdict::UngroundedInSource);assert_eq!(cert.membership(&raw), pe::Membership::NotDerivable);}diff --git a/tests/lean_projection_entailment_test.rs b/tests/lean_projection_entailment_test.rsindex e42582ab..d4c60a6f 100644--- a/tests/lean_projection_entailment_test.rs+++ b/tests/lean_projection_entailment_test.rs@@ -825,28 +825,26 @@ fn the_differential_can_fire() {// 5. Goals: what is asked, and what is refused// ═══════════════════════════════════════════════════════════════════════════-/// The store rewrites `"01"^^xsd:integer` to `"1"^^xsd:integer` on the way in.-/// A goal typed in the original spelling and NOT routed through the same parser-/// matches nothing and is reported lost, which is a false loss with a-/// green-looking pipeline around it.+/// A literal is asked in the spelling it was written in, and two spellings of+/// one value are two terms.///-/// Measured here rather than taken from the docs: the assertion on the-/// canonicaliser is inline, so if oxigraph ever stops canonicalising, this-/// fails loudly instead of quietly protecting nothing.+/// Until #335 the store rewrote `"01"^^xsd:integer` to `"1"^^xsd:integer` on+/// the way in, and goals were round-tripped through a store so that a goal+/// written `"01"` matched data written `"1"`. The pinned store keeps literals+/// as written, so that equivalence is gone from both sides: the goal stays+/// `"01"`, it is preserved where the source says `"01"`, and where the source+/// says `"1"` it is not in the source at all. That is RDF term identity, and it+/// is what the checker does (docs/lean-certificates.md: no rule compares+/// literals by value). This test was the pin of the old rewrite and failed,+/// by design, when the store stopped making it.#[test]-fn a_literal_spelling_is_canonicalised_before_asking() {+fn a_literal_goal_is_asked_as_written_and_one_value_is_two_terms() {let _serial = serial();if skip() {return;}checker();- let ttl = "@prefix : <http://ex.org/> .\n\- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\- :a :n \"1\"^^xsd:integer .\n";- let g = loaded(ttl);-- // The canonicaliser, asserted inline.- let raw = (+ let written = ("<http://ex.org/a>".to_string(),"<http://ex.org/n>".to_string(),"\"01\"^^<http://www.w3.org/2001/XMLSchema#integer>".to_string(),@@ -857,34 +855,32 @@ fn a_literal_spelling_is_canonicalised_before_asking() {:a :n \"01\"^^xsd:integer .\n",).unwrap();- assert_ne!(- goals[0].triple, raw,- "the parser must canonicalise the literal; if it does not, this whole guard is dead"- );- assert_eq!(goals[0].triple.2, "\"1\"^^<http://www.w3.org/2001/XMLSchema#integer>");+ assert_eq!(goals[0].triple, written, "the store round trip must not respell the literal");- // Routed through the parser: preserved.- let o = opts("literal", &[]);- let r = pe::check_entailment_preservation(- &g,- Projection::Turtle(ttl),- &goals,- &[],- &o,- )- .unwrap();+ // The source spells it the same way: preserved, and asserted.+ let same = "@prefix : <http://ex.org/> .\n\+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\+ :a :n \"01\"^^xsd:integer .\n";+ let o = opts("literal-same", &[]);+ let r = pe::check_entailment_preservation(&loaded(same), Projection::Turtle(same), &goals, &[], &o)+ .unwrap();assert_eq!(r.per_goal[0].verdict, GoalVerdict::PreservedAsserted, "{}", r.headline);+ let cert = pe::CertificateIndex::read(&o.work_dir.join("projection")).unwrap();+ assert_eq!(cert.membership(&written), Membership::Asserted);- // The broken variant: the caller's raw spelling asked directly of the- // certificate is NOT derivable, which is what a tool that skipped the- // parser would have reported as a loss.+ // The source spells the same value "1": a different term, so the goal is+ // not grounded in it, and the certificate holds "1" and not "01".+ let other = "@prefix : <http://ex.org/> .\n\+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\+ :a :n \"1\"^^xsd:integer .\n";+ let o = opts("literal-other", &[]);+ let r = pe::check_entailment_preservation(&loaded(other), Projection::Turtle(other), &goals, &[], &o)+ .unwrap();+ assert_eq!(r.per_goal[0].verdict, GoalVerdict::UngroundedInSource, "{}", r.headline);let cert = pe::CertificateIndex::read(&o.work_dir.join("projection")).unwrap();- assert_eq!(- cert.membership(&raw),- Membership::NotDerivable,- "the raw spelling matches nothing, which is exactly the false loss"- );- assert_eq!(cert.membership(&goals[0].triple), Membership::Asserted);+ assert_eq!(cert.membership(&written), Membership::NotDerivable);+ let canonical = (written.0.clone(), written.1.clone(), "\"1\"^^<http://www.w3.org/2001/XMLSchema#integer>".to_string());+ assert_eq!(cert.membership(&canonical), Membership::Asserted);}#[test]diff --git a/tests/ofn_reader_test.rs b/tests/ofn_reader_test.rsindex 472a9080..35b6198b 100644--- a/tests/ofn_reader_test.rs+++ b/tests/ofn_reader_test.rs@@ -174,10 +174,10 @@ fn object_cardinalities_qualified_unqualified_and_qualified_by_thing() {#[test]fn cardinalities_are_typed_non_negative_integer_before_any_store_sees_them() {- // The store is not a witness for this: Oxigraph's value encoding writes+ // The parser's own output is the witness. Oxigraph 0.5.9's store wrote// every integer-derived literal back as xsd:integer, so a store round- // trip cannot tell nonNegativeInteger from integer. The parser's own- // output can.+ // trip could not tell nonNegativeInteger from integer; the pinned store+ // keeps it since #335, but this asks the parser, which is what is meant.let triples = ofn::parse(&document("SubClassOf(:A ObjectMinCardinality(007 :r))")).unwrap();let card = triples.iter()diff --git a/tests/shacl_core_verified_test.rs b/tests/shacl_core_verified_test.rsindex feacac1f..0ef35e3f 100644--- a/tests/shacl_core_verified_test.rs+++ b/tests/shacl_core_verified_test.rs@@ -564,6 +564,11 @@ fn read_entry(store: &Store, manifest: &Path, entry: &str) -> anyhow::Result<Tes/// that round-trips a graph through the store and then compares terms, SHACL/// validation included, inherits that.///+/// Since #335 the pinned store keeps literals as written (oxigraph/oxigraph#2010),+/// so that round trip is now term-preserving for literals; measured in+/// `tests/shacl_validation_report_test.rs`. This harness keeps the direct path+/// because it needs no store and dedupes and sorts explicitly.+////// Parsing is still Oxigraph's, so base and prefix resolution are unchanged./// Triples are deduplicated and sorted here because the store used to do both, and/// the compiler in `lean/Shacl/Compile.lean` reads `sh:path` as "exactly onediff --git a/tests/shacl_validation_report_test.rs b/tests/shacl_validation_report_test.rsindex cc2ae4bd..578b67ca 100644--- a/tests/shacl_validation_report_test.rs+++ b/tests/shacl_validation_report_test.rs@@ -319,54 +319,44 @@ ex:S a sh:NodeShape ; sh:targetClass ex:Person ; {severity}}}-/// #335, MEASURED AND NOT FIXED IN THIS REPOSITORY. This test pins the loss-/// so that it cannot be mistaken for a report-writer bug, and so that it fails,-/// by name, on the day the store starts keeping lexical forms.+/// #335, fixed in the store. W3C `core/node/maxExclusive-001` and+/// `minExclusive-001` expect `sh:focusNode 4.0 ; sh:value 4.0`, i.e.+/// `"4.0"^^xsd:decimal`, and the report said `"4"^^xsd:decimal`, a different+/// RDF term. Oxigraph 0.5.9 encoded a literal of a datatype it knew by value+/// at insert and decoded it canonically, in the data store and in the shapes+/// store alike, so "4.0" and "4" loaded as ONE triple and no code here could+/// say which one a result was about. The pinned fork (oxigraph/oxigraph#2010)+/// value-encodes a literal only when decoding gives it back as written, and+/// stores any other as a generic typed literal.///-/// W3C `core/node/maxExclusive-001` and `minExclusive-001` expect-/// `sh:focusNode 4.0 ; sh:value 4.0`, i.e. `"4.0"^^xsd:decimal`, and the-/// report says `"4"^^xsd:decimal`, a different RDF term. The cause is the-/// store, not the validator or the writer: oxigraph 0.5.9 (the pinned fork at-/// abf36ef adds only `Store::snapshot`) encodes a literal of a datatype it-/// knows by VALUE (`storage/numeric_encoder.rs`: `parse_decimal_str` ->-/// `EncodedTerm::DecimalLiteral`, and likewise for integer, boolean, double,-/// float, dateTime and the rest) and decodes it in canonical form-/// (`Literal::from(Decimal)`). The lexical form is gone at insert, for the-/// data graph AND for the shapes graph, which `ShaclValidator` parses into a-/// store of its own, so `sh:targetNode 4.0` already names `"4"` when the-/// first query runs.-///-/// Nothing in this repository can recover the original term. Two distinct-/// RDF terms, `"4.0"^^xsd:decimal` and `"4"^^xsd:decimal`, become ONE triple-/// on load (first block below), so no side table keyed by the stored term can-/// say which one a result was about. The repair belongs in the store's-/// literal encoding. The same loss reaches verdicts, not only the report: a-/// lexical constraint judges the canonical string, so `sh:pattern "\\.0$"`-/// reports `"4.0"^^xsd:decimal`, whose lexical form matches (last block).-///-/// When this test fails because the store kept a lexical form: remove-/// `maxExclusive-001` and `minExclusive-001` from `KNOWN_DIFFERENCES` in-/// `tests/shacl_validation_report_w3c_test.rs`, raise its floor, close #335,-/// and turn these assertions round.+/// This test was the pin of the loss (it asserted one triple, `"4"` in+/// `sh:value` and in the focus node); it now asserts the terms as written.#[test]-fn a_non_canonical_literal_is_canonicalised_by_the_store_before_validation_sees_it() {- const LOST: &str = "the store kept a lexical form it used to canonicalise: #335 may now be \- fixable, see this test's doc comment";+fn a_non_canonical_literal_is_kept_as_written_and_reported_as_written() {let decimal = |lex: &str| format!("\"{lex}\"^^<http://www.w3.org/2001/XMLSchema#decimal>");- // The store: two distinct terms, one triple, written canonically.+ // The store: two distinct terms are two triples, each written as given.let g = Arc::new(GraphStore::new());let added = g.load_turtle(r#"@prefix ex: <http://ex.org/> .@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .- ex:a ex:p "4.0"^^xsd:decimal , "4"^^xsd:decimal ."#,+ ex:a ex:p "4.0"^^xsd:decimal , "4"^^xsd:decimal .+ ex:b ex:p "04"^^xsd:integer , "1"^^xsd:boolean , "1.0E0"^^xsd:double ."#,None,).unwrap();- assert_eq!(added, 1, "{LOST}");+ assert_eq!(added, 5, "\"4.0\" and \"4\" are two RDF terms and must be two triples");let nt = g.serialize("ntriples").unwrap();- assert!(nt.contains(&decimal("4")) && !nt.contains(&decimal("4.0")), "{LOST}:\n{nt}");+ for written in [+ decimal("4.0"),+ decimal("4"),+ "\"04\"^^<http://www.w3.org/2001/XMLSchema#integer>".to_string(),+ "\"1\"^^<http://www.w3.org/2001/XMLSchema#boolean>".to_string(),+ "\"1.0E0\"^^<http://www.w3.org/2001/XMLSchema#double>".to_string(),+ ] {+ assert!(nt.contains(&written), "{written} must come back as written:\n{nt}");+ }// sh:value of a data-graph value written "4.0".let data = r#"@prefix ex: <http://ex.org/> .@@ -378,24 +368,56 @@ fn a_non_canonical_literal_is_canonicalised_by_the_store_before_validation_sees_ex:S a sh:NodeShape ; sh:targetClass ex:Person ;sh:property [ sh:path ex:age ; sh:datatype xsd:integer ] ."#;let j = json_report(data, datatype);- assert_eq!(value_for(&j, "datatype"), Some(decimal("4")), "{LOST}: {j}");+ assert_eq!(value_for(&j, "datatype"), Some(decimal("4.0")), "{j}");+ let s = parsed(&rdf_report(data, datatype, ReportFormat::Turtle), RdfFormat::Turtle);+ assert!(ask(&s, r#"?x sh:value ?v . FILTER(sameTerm(?v, "4.0"^^xsd:decimal))"#), "the RDF report too");// A focus node written "4.0" in the shapes graph, handed in as text.let target = r#"@prefix sh: <http://www.w3.org/ns/shacl#> .@prefix ex: <http://ex.org/> .ex:S a sh:NodeShape ; sh:targetNode 4.0 ; sh:maxExclusive 4 ."#;let j = json_report("@prefix ex: <http://ex.org/> . ex:x ex:y ex:z .", target);- assert_eq!(j["violations"][0]["focus_node"], decimal("4"), "{LOST}: {j}");- assert_eq!(j["violations"][0]["value"], decimal("4"), "{LOST}: {j}");+ assert_eq!(j["violations"][0]["focus_node"], decimal("4.0"), "{j}");+ assert_eq!(j["violations"][0]["value"], decimal("4.0"), "{j}");+}++/// What #335's store fix does NOT reach, measured on the same pin. The SPARQL+/// evaluator (`spareval`, unpatched in the fork) still turns a literal of a+/// datatype it knows into its value before any function sees it, so inside a+/// query `STR("4.0"^^xsd:decimal)` is `"4"` and `DATATYPE("5"^^xsd:int)` is+/// `xsd:integer`, whether the literal came from the store or the query text.+/// Two consequences stay in this engine:+///+/// * a lexical constraint judges the canonical string, so `sh:pattern "\\.0$"`+/// reports a lone `"4.0"^^xsd:decimal`, whose lexical form matches;+/// * `DATATYPE()` cannot tell the twelve integer-derived types or+/// `xsd:dateTimeStamp` from their base type, so+/// `datatype_is_indistinguishable_in_store` keeps refusing them+/// (`tests/datatype_preservation_test.rs` pins that set).+///+/// When this fails, the evaluator keeps lexical forms: turn the `sh:pattern`+/// assertion round and re-measure that set.+#[test]+fn inside_a_query_a_known_datatype_literal_is_still_read_by_value() {+ const FIXED: &str = "the SPARQL evaluator now keeps the lexical form: see this test's doc comment";+ let data = r#"@prefix ex: <http://ex.org/> .+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .+ ex:a a ex:Person ; ex:age "4.0"^^xsd:decimal ; ex:n "5"^^xsd:int ."#;+ let g = store(data);+ let json = g+ .sparql_select("SELECT (STR(?a) AS ?s) (DATATYPE(?n) AS ?d) WHERE { ?x <http://ex.org/age> ?a ; <http://ex.org/n> ?n }")+ .unwrap();+ let row = &serde_json::from_str::<Value>(&json).unwrap()["results"][0];+ assert_eq!(row["s"], "\"4\"", "{FIXED}: {json}");+ assert_eq!(row["d"], "<http://www.w3.org/2001/XMLSchema#integer>", "{FIXED}: {json}");- // The verdict consequence. SHACL: STR("4.0"^^xsd:decimal) is "4.0", which- // matches, so this conforms. The engine sees "4" and reports it.let pattern = r#"@prefix sh: <http://www.w3.org/ns/shacl#> .@prefix ex: <http://ex.org/> .ex:S a sh:NodeShape ; sh:targetClass ex:Person ;sh:property [ sh:path ex:age ; sh:pattern "\\.0$" ] ."#;let j = json_report(data, pattern);- assert_eq!(j["violation_count"], 1, "{LOST}: {j}");+ assert_eq!(j["violation_count"], 1, "{FIXED}: {j}");+ assert_eq!(value_for(&j, "pattern"), Some("\"4.0\"^^<http://www.w3.org/2001/XMLSchema#decimal>".into()), "{j}");}// ─────────────────────────────────────────────────────────────────────────────diff --git a/tests/shacl_validation_report_w3c_test.rs b/tests/shacl_validation_report_w3c_test.rsindex 35066bba..2d3c32f7 100644--- a/tests/shacl_validation_report_w3c_test.rs+++ b/tests/shacl_validation_report_w3c_test.rs@@ -49,15 +49,18 @@ use std::sync::Arc;/// conformance baseline records as PASS produce a report that matches the/// expected one on every compared predicate. 49 since #333 (28 Oct 2026, same/// suite commit), when `core/property/or-datatypes-001` started reporting all-/// three of its `sh:or` violations. The other seven are named below.-const MATCHED_FLOOR: usize = 49;+/// three of its `sh:or` violations. 51 since #335 (28 Oct 2026, same suite+/// commit), when the oxigraph pin started keeping `"4.0"^^xsd:decimal` as+/// written and `core/node/maxExclusive-001` and `minExclusive-001` matched.+/// The other five are named below.+const MATCHED_FLOOR: usize = 51;/// The PASS cases whose full report differs, each with the measured cause./// None is a defect of the report writer: each graph says what the JSON/// already said. They are the gaps the set comparison in/// `w3c_shacl_conformance_test.rs` cannot see, which is why this file exists./// A case not listed here that stops matching fails by name.-const KNOWN_DIFFERENCES: [(&str, &str); 7] = [+const KNOWN_DIFFERENCES: [(&str, &str); 5] = [("core/node/class-003","ex:John is selected by sh:targetClass AND sh:targetNode and reported once per target \@@ -68,16 +71,6 @@ const KNOWN_DIFFERENCES: [(&str, &str); 7] = ["same cause: InvalidInstance1 is selected by sh:targetClass and sh:targetSubjectsOf and \reported twice, 3 results for 2",),- (- "core/node/maxExclusive-001",- "#335, measured: oxigraph encodes a known-datatype literal by value at insert \- (numeric_encoder.rs, parse_decimal_str) and decodes it canonically, in the shapes \- store as in the data store, so sh:targetNode 4.0 is \"4\"^^xsd:decimal before the \- first query runs. Not recoverable here: \"4.0\" and \"4\" load as one triple. Pinned \- by a_non_canonical_literal_is_canonicalised_by_the_store_before_validation_sees_it \- in tests/shacl_validation_report_test.rs",- ),- ("core/node/minExclusive-001", "same cause as maxExclusive-001"),("core/property/lessThan-001","the query selects DISTINCT ?focus, so results carry no sh:value; projecting it changes \diff --git a/tests/w3c_shacl_conformance_test.rs b/tests/w3c_shacl_conformance_test.rsindex 69e9821a..3a37c3d8 100644--- a/tests/w3c_shacl_conformance_test.rs+++ b/tests/w3c_shacl_conformance_test.rs@@ -69,14 +69,17 @@//! namespace whole, `severity-002` passes, and the column scores PASS 53//! (measured 2026-10-28, same suite commit). No test now differs in severity.//!-//! One gap this column cannot see by construction (#335). The expected report-//! is read through `load_graph`, an oxigraph `Store`, which encodes a literal-//! of a known XSD datatype by value and gives it back canonically, exactly as-//! the engine's own stores do. So `maxExclusive-001`'s expected-//! `sh:value 4.0` is read as `"4"^^xsd:decimal`, agrees with the engine's-//! equally canonicalised answer, and scores PASS here, while-//! `tests/shacl_validation_report_w3c_test.rs`, which parses the expected-//! report without a store, holds it as a difference.+//! Until #335 this column could not see one gap, by construction. It reads+//! the expected report through `load_graph`, an oxigraph `Store`, and the+//! store used to encode a literal of a known XSD datatype by value and give it+//! back canonically, exactly as the engine's own stores did. So+//! `maxExclusive-001`'s expected `sh:value 4.0` was read as+//! `"4"^^xsd:decimal`, agreed with the engine's equally canonicalised answer,+//! and scored PASS here while `tests/shacl_validation_report_w3c_test.rs`,+//! which parses without a store, held it as a difference. The pinned store+//! now keeps literals as written (oxigraph/oxigraph#2010), both sides carry+//! `"4.0"`, and the two files agree (measured 2026-10-28: this column+//! unchanged at 53, the report match up from 49 to 51 of 56).//!//! Severity is in the full-tuple column and NOT in the gated one, by//! measurement rather than by principle. The old reason for leaving it out