Re: vehicle to autoparts relationships

From: Vadim Tropashko <vadimtro_invalid_at_yahoo.com>
Date: 22 Nov 2006 14:50:04 -0800
Message-ID: <1164235802.585053.125380_at_b28g2000cwb.googlegroups.com>


Bob Badour wrote:
> Vadim Tropashko wrote:
>
> >>Anybody noticed an implicit hierarchy of nested sets yet?
> >
> >
> > Nested Sets
> > ^^^^^^^^^^^^^^
> > Another approach to a tree structure is modeling it as nested sets
> >
> > A
> > .|
> > ..---- B
> > .|......|
> > .|.......------ C
> > .|......|
> > .|.......------ D
> > .|
> > ..---- E
> >
> > Figure 5.2a: A tree.
> >
> > { { [C] [D] } { [E] } }
> >
> > Figure 5.2b: Nested sets structure for the tree at fig. 5.2a. Set
> > elements are boxes, and sets are the ovals including them. Every parent
> > set contains its children sets. (This is ASCII adaptation of the
> > figure, of course)
> >
> >
> > Clearly set containment can clearly accommodate any tree. Whenever we
> > need to grow a tree by adding a new child, we just nest one more set
> > into the appropriate parent set.
> >
> > A naive nested sets implementation would materialize a set of elements
> > at each node. Aside from the fact that the RDBMS of your choice have
> > has to be capable of operating on sets on the datatype level , this
> > implementation would be quite inefficient. Every time a node is
> > inserted into a tree, the chain of all the containing sets should be
> > expanded to include (at least) one more element.
> >
> > A more sophisticated variant of Nested Sets has been widely popularized
> > by Joe Celko. The main idea behind this encoding is representing nested
> > sets as intervals of integers...
>
> How does nested sets handle the part that is a part of multiple assemblies?

OK, parts A and B are in the assembly E and parts B and C are in the assembly F. Formally,

{A,B} = E
{B,C} = D

Admittedly, calling such sets "nested" is a stretch of terminology. Moreover, this would make it impossible to represent such parts as nested intervals (aka nested sets in Celko's terminology). Nested intervals work for trees only. Received on Wed Nov 22 2006 - 23:50:04 CET

Original text of this message