Repository navigation
Description
On an indexed ledger, every string-dictionary datatype that isn't xsd:string or rdf:langString is flattened onto xsd:string when an object is decoded into a binding — so two literals with distinct datatypes compare equal, and a literal loses its own identity in a self-join.
No FILTER fold is involved. This is the decode lane itself.
Where
fluree-db-query/src/object_binding.rs:105-112 collapses the datatype for anything landing in the string dictionary. The mirror-image gap is in is_string_term_constraint (fluree-db-query/src/binding.rs:264-272), which recognises the flattened form and so can't distinguish the cases either.
What it looks like
With ex:p carrying both "abc"^^xsd:string and "abc"^^ex:custom, on a ledger with a published index:
FILTER(?x = ?y)reports the two equal, though they are distinct RDF terms and=is value equality, which for non-numeric literals requires matching datatypes.- A self-join on
ex:ploses the custom-typed literal's own identity row.
This is not limited to custom datatypes. xsd:anyURI, xsd:token, and xsd:normalizedString all decode through the string dictionary, so they flatten the same way — any two of them sharing a lexical form become indistinguishable.
Relationship to #1676 and #1723
#1676 (aaaa7d429) fixed exactly this class for plain and lang-tagged strings, making the join key term-exact for those. This is the un-migrated remainder of the same shape: the other string-dictionary datatypes still flatten.
It's also the reason #1723 was fixed by gating the sameTerm fold rather than by making the join term-exact. Two independent reasons that route is closed: this flattening is still live, and — more fundamentally — the join is deliberately lenient across numeric subtypes (1 ≡ "1"^^xsd:long ≡ 1.0), pinned as a product decision by it_literal_identity.rs:189 bare_numeric_literals_stay_lenient_across_subtypes and rooted in the index's normalized numeric key. So "the join implements term equality" is a premise the engine doesn't want to hold, and fixing this issue would not make it true. It would, though, remove a live wrong-results path.
Notes for whoever takes it
- Verified by reading both sites; the practical consequence was observed while building fix: make the equijoin-filter fold sound about term equality #1728's regression fixtures — its published-index test deliberately compares two measurements within one read lane rather than across the lane switch, precisely because of this.
- The lane matters: the divergence appears on the indexed read path. Check the novelty path separately rather than assuming it behaves the same.
- Whatever lands should pin at least one standard datatype (
xsd:anyURIorxsd:token) alongside a custom one, so the fix isn't quietly scoped to user-defined datatypes. - Per the surface-parity rule, check the JSON-LD surface for the same flattening.
Activity
fix(query): a read below the published index t cannot license the fold
test(query): pin the fold's target join by naming pairs, not counting…
fix(query): merge the unbound variable back on the grouped OPTIONAL l…
fix(query): build the nested-loop join's batched objects like every o…