UKGovLD/registry-core

Deleting an ontology register causes other registers to appear empty

Opened this issue · 1 comments

Symptoms:

After deleting an ontology register, other registers which contained entries with a type defined in the deleted ontology were reported as empty. Attempting to reload entries into the apparently empty registers failed with an error report that an entry that was being reloaded already existed.

To reproduce (all operations via the UI):

  1. create a register test to contain two test registers
  2. within test create ontology register ont and load the attached ontology file ont.ttl
  3. within test create register entry and load the attached data file entries.ttl
  4. verify the entity entry register has one member entry/1
  5. use the SPARQL form to list the properties of the .../test/entry/_1 resource. Note it has a property reg:itemClass that is defined in the .../test/ont register.
  6. delete the register ont
  7. verify the entity register now shows up as empty in the UI
  8. use the SPARQL form to show that the reg:itemClass property has disappeared from .../test/entry/_1.

Investigation:

Exploration of the code finds the method listMembers in class StoreBaseImpl. This uses the query REGISTER_LIST_QUERY to find members of a register and this query requires register members to have a reg:itemClass property or it won't find them.

Hypothesis:

Deleting an ontology incorrectly deletes reg:itemClass triples in the triple store if they refer to classes defined in the deleted ontology.

registry version: 2.0

ont.ttl.txt
entries.ttl.txt

On deleting a registry item, all of the triples which have that item as their object are also deleted, so your hypothesis is correct. This is intentional, however every entity is expected to have a reg:itemClass value. It's not clear what the correct compromise should be, so waiting for @der to decide before acting on this issue.