aus-plant-phenomics-network / miappe_packaging

0 stars 0 forks source link

Handle registration of different LinkedDataClass instances with same id #3

Open dhobern opened 1 month ago

dhobern commented 1 month ago

Scenario 1 - identical information

Scenario 2 - complementary information

Scenario 3 - contradictory information

Scenario 4 - same id, different class

Expected behaviours

Scenario 1 is reasonable and efficient. Determining the identity of the two instances would be much more expensive than simply replacing the object. Any fix for scenario 2 would however require such a test.

Scenario 2 could be addressed by adding all values from the second dictionary to the first - this would also work for scenario 1, even if less efficiently.

Scenario 3 would require checks to compare all values. An exception could be raised if this case is discovered or a warning could be logged and the code could otherwise succeed. The latter may be a good way for us to explore how common the issue is.

Scenario 4 probably merits an appropriate check and throwing an exception. This would require an efficient way to check all ids already registered for any class. Such a dictionary could also optimise processing choices for scenarios 2 and 3.