Action How To Delete Objects

Assigned
ABR+TSH+BAM

Prev assigned

Tasks adressed
["TaskA.5"]

Time estimated
1md

Time used
0md

Priority
1

Status
Description needs review

Iteration
14

Notes

Problem

Deleting objects while maintaining referential integrity is a complex task. The action should provide a general algorithm for how to implement deletions, so that the DOMS will not be left in an inconsistent state, no matter how they are performed.

Consider the Reeltape object. Such an object has relations to a collection, a license, and a number of sides and recordings. Deleting this object will leave the sides and recordings isolated. Deleting everything it references will destroy the collection and licenses. Only deleting the objects in the view will work, but then deletions are subject to a specific view, which might still leave unwanted objects dangling just because they are not part of the view.

A system that address all these issues should be devised.

Progress

We agreed to the following formulation: When deleting an object, you must delete all the objects in this objects view, but only if no object in the view is referenced from outside the view, except from a list of approved objects. Then purge the relations referencing objects in the view from all objects in the approved list

Given: Object d (to be deleted). Objectlist approved (the approved objects)

The formal algorithm to do this is:

  1. Find the view 'v' of object d.
  2. Find the list of objects 'e' that reference an object from 'v'
  3. Remove from the list 'e' all objects in approved, and all objects in 'v'
  4. If 'e' is not empty, the delete fails, and the user is notified about the contents of 'e'
  5. If 'e' is empty, mark all objects in 'v' as deleted
  6. For all objects in approved, delete any relation they have to an object in 'v'

This system could still potentially leave dangling objects, if they are not in the view. This is unwanted.

Checklist For Working On An Action

The Life Cycle of an Action:

Please make sure that you address the below issues, when working on an action: