Closed ehennestad closed 1 year ago
It depends what you mean by the "same instance". If you add two instances with the same @id, the second one overwrites the first in the collection.
If you have two independent instances with identical properties, but with no @id defined, then these will be treated as different.
fairgraph avoids the latter situation by defining certain properties as collectively defining identity (e.g. "givenName" and "familyName" for Person). This is something we've discussed adding to the openMINDS schemas, but I don't think we reached a conclusion on whether this should be in openMINDS, or left up to the policies of individual graph databases like the EBRAINS KG.
Do instances automatically get an id? Otherwise, if you are using blank node identifiers by default then the same instance, i.e same python object, could get added multiple times?
Regarding the multiple instances with identical properties, I see your point. Seems like this requires a lot of work for many instances to define what should be the defining identities.
Do instances automatically get an id
yes, if they don't have one, they get a blank node identifier when they're added to the collection. In this case, the Python object now has a value for the "id" attribute, and so if it is added again, it won't be duplicated.
I see, thanks for the clarification!
As far as I can se from the current code, it is possible to add an instance multiple times. Should there be a check against that? (Or am I missing something?)