You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
STRDT and str-dt build an XSD-typed string, not the value, so sameTerm misses a stored integer or dateTime #2450
While working on #2430 (the rdf:JSON term-identity fix), we found that the same gap exists for XSD datatypes, and #2430 deliberately left it alone.
What happens.STRDT (and JSON-LD's str-dt) builds its result as a string typed with the datatype, not as the datatype's value. For rdf:JSON, #2430 now builds the canonical JSON value, but for XSD datatypes the string form remains, so it isn't the same term as the value a write stores:
(sameTerm ?v (str-dt "42" xsd:integer)) against a stored 42 counted 0 of the 10 write paths in it_ill_typed_literals::a_valid_typed_literal_is_one_term_on_every_write_path's setup. Only = matches, because it coerces the string.
(= ?v (str-dt "2026-10-28T12:00:00Z" xsd:dateTime)) against the stored dateTime counted 0 of 10 too.
That was measured on the JSON-LD surface on #2430's branch. SPARQL's STRDT goes through the same eval_str_dt, so I'd expect the same answers there, but I haven't measured it separately.
Why it wasn't fixed in #2430. Building the value for every datatype a write coerces would change what STR of the result reads, e.g. STR(STRDT("01", xsd:integer)) would read "1" rather than "01". That's arguably right (it's what STR of the stored value reads, given #1696's canonicalization at ingest), but it's a visible behaviour change worth agreeing on first rather than slipping into a main fix.
Suggested direction. Have eval_str_dt build the coerced value for datatypes with a value space (numeric, boolean, temporal), as it now does for rdf:JSON, falling back to the typed string when the lexical form doesn't parse, and pin both surfaces with the same one-term test #2227 uses. A constant str-dt could also be folded once at JSON-LD lowering, as SPARQL's typed literal now is.
Claude helped investigate this while working on #2430.
Activity