Re: Database which allows object to be "child" of any other object

From: David BL <davidbl_at_iinet.net.au>
Date: Thu, 9 Apr 2009 18:01:23 -0700 (PDT)
Message-ID: <1d37b20e-f7e1-4e35-a380-7e0c4bbbf0de_at_p11g2000yqe.googlegroups.com>


On Apr 10, 1:54 am, Bob Badour <bbad..._at_pei.sympatico.ca> wrote:
> kuronekoy..._at_gmail.com wrote:
> > I'm working on a database-driven project and I'm trying to do some re-
> > architecting of the system.
>
> > I would like to cut down on the number of strictly-defined complex
> > object types, instead forming them from a composition of attached
> > atomic metadata objects. A user could have an attached phone number,
> > an attached address, an attached photo; but furthermore, an address
> > could have an attached photo or phone number.
>
> > This means that in the DB, my relationship cannot be simply from the
> > "PhoneNumber" table to the "User" table. It must allow relationships
> > from each metadata table to, potentially, every other metadata table.
> > This **could** be done using n^2 association tables for each parent/
> > child combination of metadata tables, but that would suck major donkey
> > balls. It could also be done by having a generalized association
> > table which specifies both the table *and* the key of the parent and
> > child in the relationship, but I can think of no way to set up
> > automatic referential integrity checking when doing this.
>
> > My questions are:
>
> > * Is this a viable approach? Has it been done before, is there a
> > common name for it?
>
> If I am not mistaken, a name used for it before was "universal
> relation", but I could be wrong.

That doesn't seem right to me. The UR that Ullman championed would require a distinct attribute name for each distinct role, so therefore for example, a photo attached to an address has a different role from a photo attached to a user. Therefore this approach would lead to a quadratic order proliferation of attribute names. Received on Fri Apr 10 2009 - 03:01:23 CEST

Original text of this message