Skip to content

Merge fix/bnode-identity-in-triples-update into main: triples_update must accept asymmetric add/remove #7

Description

@EHoffm

What to do

Merge fix/bnode-identity-in-triples-update into main, and include it in the next release.

The branch currently lives only on the SAWeindel/graph_db_interface fork, at e659da1. It is
3 commits ahead of main and 0 behind, so the merge is a fast-forward and conflict-free:

Commit
34dac9e Fix IRI validator rejecting URLs with ports
65157c5 Generalize triples_update to atomic add/remove/replace (unequal lengths)
e659da1 Keep blank-node identity across triples_update

Why it matters downstream

kapps_ogm's OGM.commit feeds the output of Node.diff straight to triples_update. A diff is a
set difference, so the removed and added lists are almost never the same length — but published
2.0.1 still enforces:

if len(old_triples) != len(new_triples):
    raise InvalidInputError("Old and new triples lists must have the same length.")

So on a clean install from kapps_ogm's manifest, every commit that adds and removes a
different number of triples fails with Exception: Failed to update instance in database.
Reproduced with scripts/demo_from_data.py, which exercises a simple-attribute update, a
complex-attribute replacement and a complex-attribute addition in one commit:

Diff for before_update: <empty>          <- create + fetch round-trips fine
InvalidInputError: Old and new triples lists must have the same length.

With this branch installed instead, the same demo completes and both diffs are empty.

e659da1 is also requirement R11 of docs/prd/kapps-ogm-anonymous-node-identity.md in
EHoffm/kapps_semantic_middleware: triples_update must build one blank-node-to-variable map
shared across the DELETE and INSERT patterns, so a BNode appearing on both sides renders as the
same variable rather than being re-minted.

Interim state

kapps_ogm has pinned its dependency directly at this branch so development can continue
(SAWeindel/kapps_ogm#23 tracks reverting that pin once a release exists). That pin is a
stopgap — it makes kapps_ogm unpublishable and non-reproducible while it stands.

The next release is expected to carry further revisions beyond this branch; this ticket asks only
that these three commits are part of whatever that release turns out to be, not that a release be
cut immediately.

Acceptance criteria

  • fix/bnode-identity-in-triples-update is merged into main.
  • A test pins an asymmetric triples_update — more triples added than removed, and the reverse —
    so the equal-length constraint cannot silently return.
  • A test pins that a BNode present on both the old and the new side renders as one variable.
  • The next published release includes these commits, with a version bump reflecting that
    triples_update widens rather than breaks its contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions