Re: why hierarchy?
Date: 31 Jul 2006 20:25:23 -0700
Message-ID: <1154402723.081820.13280_at_i42g2000cwa.googlegroups.com>
> So If I had three propositions:
> "John is friends with Frank at Work"
> "Bob is friends with Sam at Home"
> "Tommy is friends with Billy at School"
> and (ignoring the bidirectionality for clarity), they would generate:
>
> [ john ] -- [ [ friend ] --- [ at ] --> [ work ] ] --> [ frank ]
> [ bob ] -- [ [ friend ] --- [ at ] --> [ home ] ] --> [ sam ]
> [ tommy ] -- [ [ friend ] --- [ at ] --> [ school ] ] --> [ billy ]
>
> Now in an RDB I might have a corresponding Friendships relation:
>
> Person Friend Location
> ----------------------------------
> john frank work
> bob sam home
> tommy billy school
>
> For an RDB a simple question like "Which people have friends some place
> other than at home" requires a statement something of the order of:
>
> SELECT Person from Friendships WHERE Location != "home"
Currently dbd's select expression doesn't implement NOT EQUAL TO and would requires interfacing to the db via its API and looping thru things.
Following expression finds a person that has a friend at home that is a
person:
(and (select person instance *)
(select * (select friend at home) (select person instance *)))
Following expression finds a person that has a friend at home. The friend could be anything (ie dog, cat, etc). (and (select person instance*)
(select * (select friend at home)))
I can use this example to show how dbd is less impacted by new data requirements. Suppose the friend can be things other than people and each type requires different attributes. Or suppose the locations are of different types and require different tables. Or suppose we need to relate data to Person (not a person), Friend (not a friend), or Location (not a location). For example, that friend and enemy are opposites. Or suppose the verb can be "friend before work", "friend after work", "friend at gym", etc. Or suppose, John is friends with Bob between 1PM to 5PM. Allowing for such flexibility in RMDB will impact the schema severely, but has little to no impact in dbd. Received on Tue Aug 01 2006 - 05:25:23 CEST