To Retrieve Tree
Referential integrity of tree structure columns are not guaranteed in the conventional models. Even in the most concise table design "adjacency list model", there is a possibility of inconsistencies by circulated parent-child relationship.
FF model, is no exception in this regard. However, FF model has feature to create query to find damaged records by SQL. This feature is superior overwhelmingly than other models.
Damage possible of the referential integrity in Fertile Forest model
Damage in the tree structure data in the FF model is limited to the following two cases.
- Duplicated QUEUE
- When deleted internal node, there is un-affiliated (= no parent) node.
In above two cases, can find the point of damage records by SQL. It makes possible to be displayed side by side in a row using a scripting language such as PHP or Ruby, and can check the corrupted data visually.
TODO: I will write processing for specifying the failure location later.
To restore DEPTH integrity
In the FF model, can create UPDATE statement to restore the referential integrity of the DEPTH. It needs to obtain the damage status of all DEPTH each node by issuing a pre-SELECT statement. And then, can modify all damage DEPTH by UPDATE statement at once. When compare to traditional models, it is overwhelming simplicity.
TODO: I will write for information about how to build an UPDATE statement to restore DEPTH at once later. If you want to know immediately, please refer to my libraries for CakePHP or Ruby on Rails.