Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise an error, warning, or ignore duplicate ID's? #165

Closed
kinow opened this issue Oct 9, 2023 · 2 comments · Fixed by #166
Closed

Raise an error, warning, or ignore duplicate ID's? #165

kinow opened this issue Oct 9, 2023 · 2 comments · Fixed by #166

Comments

@kinow
Copy link
Member

kinow commented Oct 9, 2023

Hi, I just noticed I had a duplicate ID in my crate, is that valid for RO-Crate?

I thought about checking something like if File(data).id in crate.data_entities, but I think what identifies uniquely data in the crate are ID + JSON-LD data. As I have the date that the entity was created in the JSON-LD data, whenever I create two entities they are never identical.

@simleo
Copy link
Collaborator

simleo commented Oct 13, 2023

The spec says: "the RO-Crate Metadata JSON @graph MUST NOT list multiple entities with the same @id; behaviour of consumers of an RO-Crate encountering multiple entities with the same @id is undefined". In ro-crate-py, if you add an entity with the same @id of an entity that's already in the crate, the old one is overwritten. The problem is that, for historical reasons, the default_entities, data_entities and contextual_entities attributes were independent from the internal dictionary that actually stores entities (__entity_map), so duplicates were possible. I fixed that in #166.

@kinow
Copy link
Member Author

kinow commented Oct 13, 2023

Thank you @simleo !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants