Skip to content

Unify the transactional TriG-star reifier bundle with reified_triple_bundle #1848

Closed

Description

@bplatz

Summary

TriG-star GRAPH blocks lower their reifier bundles through two separate constructions of the same f:reifies* shape:

  • Shared builder: fluree_db_transact::generate::flakes::reified_triple_bundle wraps EdgeKey::to_reifies_facts_jsonld_compatible. FlakeSink / ImportSink (Turtle) and import_trig_commit (TriG bulk import) use it.
  • Hand-built copy: fluree-db-api/src/tx.rs, convert_named_graphs_to_templates (the // TriG-star: one f:reifies* bundle per reifier attachment block). This is the transactional TriG path, used by upsert_turtle with GRAPH blocks. It pushes the f:reifiesGraph / Subject / Predicate / Lang / Object templates itself, in its own order and with its own rule for when f:reifiesLang is included.

If one copy changes and the other doesn't, the two paths drift apart. trig_star_in_graph_block_matches_jsonld_named_graph_annotation (fluree-db-api/tests/it_edge_annotations.rs) is the only test comparing the transactional bundle with JSON-LD @annotation flake by flake. Dropping the f:reifiesGraph push in tx.rs makes it fail, but a new field or a changed rule for leaving out f:reifiesDatatype only gets caught if that test's fixture happens to exercise it. The import path is covered separately by imported_trig_star_bundle_carries_its_graph_and_cascades (#1832).

Why the copy exists

The transactional path emits TripleTemplates, not Flakes. Its reifier, subject and object can still be unresolved blank nodes (TemplateTerm::BlankNode), which are skolemized at staging. reified_triple_bundle needs resolved Sids and a FlakeValue, so tx.rs can't call it.

Possible shape

Move the bundle layout into one place that works for either term type: a function that yields the ordered (reifies predicate, object, datatype constraint) rows for an edge, generic over its term type, or an equivalent EdgeKey-level description. to_reifies_facts_jsonld_compatible would build flakes from it and convert_named_graphs_to_templates would build templates from it. Both surfaces would then read the omission rules (f:reifiesDatatype omitted, f:reifiesLang only for language-tagged objects, f:reifiesGraph only for named graphs) from one definition.

Done when

Follow-up from #1832 review.

Activity

  1. added
    P3
    area:transact
    on Sep 15, 2026
  2. bplatz commented on Nov 20, 2026

    @bplatz
    ContributorAuthor

    Fixed on next by #2017 (merged 2026-10-06, a25d446), which removes both constructions of the f:reifies* bundle: annotations are now rdf:reifies links, and reified_triple_bundle no longer exists there. Ships in 5.0; main (4.2.x) keeps the old code. The PR's Fixes keyword didn't close this because its base was next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area:transact

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions