Skip to content

No stable identity for locally authored nodes; every session mints new blank-node ids #166

Description

@ehennestad

Every locally authored node gets a fresh blank-node id ("_:" + uuid) when it is constructed, and a collection keeps those ids when it saves. Re-running the script that builds a dataset produces a new set of ids, so the same metadata written twice is two different graphs. Nothing in the library ties a node's identity to its content or to a user-chosen key.

The consequences land downstream: uploading a re-generated collection to the Knowledge Graph creates duplicates unless the KG layer has an existence query (fairgraph does, openminds-kg-sync does not, see ehennestad/openminds-kg-sync#7), and two exports of the same collection cannot be diffed without relabelling.

openMINDS_Python has the same behaviour (_:000000 counters per collection) and offers a Collection.generate_ids(id_generator) hook so a caller can assign real ids before upload. There is no equivalent here.

Proposal:

  • Accept an explicit id at construction for every type (the generated constructors already take id), and document that as the way to author stable metadata.
  • Offer a deterministic id strategy on Collection, for example an IRI derived from a user-supplied base plus the node's lookup label or content hash, applied before save.
  • Keep blank nodes as the default for scratch work, but make the choice visible in the tutorial, since users hit the duplication only after they have uploaded twice.

🤖 Generated with Claude Code

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions