Nested set model: Difference between revisions

Content deleted Content added
mNo edit summary
No edit summary
Line 3:
 
==Motivation==
The technique is an answer to the problem that the standard [[relational algebra]] and [[relational calculus]], and the [[SQL]] operations based on them, are unable to express all desirable operations on hierarchies directly. A hierarchy can be expressed in terms of a parent-child relation - Celko calls this the [[adjacency list model]] - but if it can have arbitrary depth, this does not allow the expression of operations such as comparing the contents of hierarchies of two elements, or determining whether an element is somewhere in the subhierarchy of another element. When the hierarchy is of fixed or bounded depth, the operations are possible, but expensive, due to the necessity of performing one [[Join (relational algebra)#Joins and join-like operators|relational join]] per level. This is often known as the [[bill of materials]] problem.{{citation needed|date=November 2011}}
 
Hierarchies may be expressed easily by switching to a [[graph database]]. Alternatively, several resolutions exist for the relational model and are available as a workaround in some [[relational database management system]]s:
Line 173:
*[http://troels.arvin.dk/db/rdbms/links/#hierarchical Troels' links to Hierarchical data in RDBMSs]
*[http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/ Managing hierarchical data in relational databases]
*[http://pear.php.net/package/DB_NestedSet PHP PEAR Implementation for Nested Sets] - by Daniel Khan
*[http://devmd.com/r/adjacency-list-to-nested-sets-mysql Transform any Adjacency List to Nested Sets using MySQL stored procedures]
*[https://github.com/previousnext/nested-set PHP Doctrine DBAL implementation for Nested Sets] - by PreviousNext
*[https://github.com/Vince0931/NestedSet R Nested Set] - Nested Set example in R
 
{{DEFAULTSORT:Nested Set Model}}