Repository navigation
Open
Labels
P1Next up: wrong results, live user pain, unblocksarea:queryQuery execution, planning, fast paths, overlay, result formattingbugSomething isn't working as expected
Description
An annotation query whose FROM names two ledgers returns no rows on next. On main it returns the RDF merge of both ledgers' annotated edges.
SELECT ?s ?role FROM <ledger-a> FROM <ledger-b>
WHERE { ?s ex:worksFor ex:acme {| ex:role ?role |} }The case is pinned by it_union_annotation_chain, added to main in #2214 (1c756de51, "an annotated edge two graphs of a union hold is one solution"). It came to next with the merge of main and passes on main. On next the same-ledger cases of that test pass and the two-ledger cases are skipped until this is fixed.
This blocks merging next into main: the query works on main today.
Why it fails on next
mainstores an annotation as plain triples on a reifier (f:reifiesSubjectand so on). A cross-ledger query converts each member's subjects intoIriMatch(stamp_provenance), so the edge, the reifier and the annotation body join by IRI.nextstores it as an RDF 1.2 triple-term link (?r rdf:reifies <<( s p o )>>). The chain joins throughTermComponentsOperator, which finds candidate triple terms in one store's triple-term dictionary, the primary ledger's. The other ledger's terms are never candidates, and the IDs inside a triple-term value are never converted toIriMatch. Nothing joins, so the answer is empty.- Before the merge,
nextran a multi-source default graph one source at a time. That was wrong too: it returned an annotated edge both ledgers hold twice, and after indexing it paired roles with the wrong subjects ("bob Manager" twice, "carol Intern" once against "bob Manager" once and "carol Intern" twice). The merge broughtmain's build-once chain over a union, which works for graphs of one ledger and returns nothing across ledgers.
A possible fix
- Route an annotation chain over a dataset that spans ledgers to the per-source path in
DefaultGraphSourceOperator, so each ledger reads its own dictionary and its IDs agree. Graphs of one ledger keep the build-once path. - Deduplicate the per-source rows across ledgers on the chain's full row, the reifier included. An edge and annotation both ledgers hold is one solution, and two annotations of one edge stay two.
- Find and fix the mispairing the per-source path shows after indexing (cause not yet known).
The alternative, making TermComponentsOperator and the cross-ledger conversion understand triple terms across stores, looks larger.
Re-enable the two-ledger cases in fluree-db-api/tests/it_union_annotation_chain.rs when fixed.
Metadata
Metadata
Assignees
Labels
P1Next up: wrong results, live user pain, unblocksarea:queryQuery execution, planning, fast paths, overlay, result formattingbugSomething isn't working as expected
Activity
test: skip the two-ledger annotation cases on next until #2444