Re: Relational vs network vs hierarchic databases
Date: 9 Nov 2004 12:11:46 -0800
Message-ID: <4b45d3ad.0411091211.23910453_at_posting.google.com>
> > What are the advantages with network and hierarchic databases vs [RM]? > > It isn't until one begins to think in terms of sets of tuples that the power > and simplicity of relational operators like restrict, project, and join > start to really pay off.
While RM dbs do have an advantage in many common applications presently, to those who contend that RM covers all scopes better than the remaining, please show how to represent the below things without NULLs and redundancy; also the queries, especially the last few. The XDb2 script below creates a person named john with black skin and red-blue hair; and mary with smooth-white skin and red, silky-smooth hair. www.xdb2.com/example/ex005.asp shows the below things in a tree and table.
// Create person, skin, hair, color and texture classes
CREATE2 *person.cls = thing; CREATE2 *skin.cls = thing; CREATE2 *hair.cls = thing; CREATE2 *color.cls = thing; CREATE2 *texture.cls = thing;
// Create black skin
CREATE2 *;
CREATE2 it.cls = skin;
CREATE2 it.color = +black;
// Create smooth-white skin
CREATE2 *;
CREATE2 it.cls = skin; CREATE2 it.color = +white; CREATE2 it.texture = +smooth;
// Create red-blue hair
CREATE2 *;
CREATE2 it.cls = hair; CREATE2 it.color = +red; CREATE2 it.color = +blue;
// Create red, silky-smooth hair
CREATE2 *;
CREATE2 it.cls = hair; CREATE2 it.color = +red; CREATE2 it.texture = +silky; CREATE2 it.texture = +smooth;
// Create a person named john
// with black skin and red-blue hair
CREATE2 *john.cls = person; CREATE2 john.skin = (%.cls=skin & %.color=black); CREATE2 john.hair = (%.cls=hair & %.color=red & %.color=blue);
// Create a person named mary
// with smooth-white skin and red, silky-smooth hair
CREATE2 *mary.cls = person; CREATE2 mary.skin = (%.cls=skin & %.color=white & %.texture=smooth); CREATE2 mary.hair = (%.cls=hair & %.color=red & %.texture=silky &%.texture=smooth);
// Queries that find john
SELECT2 %.cls=person & %.hair=(%.color=blue); SELECT2 %.cls=person & %.hair=(%.color=red & %.color=blue); SELECT2 %.cls=person & %.skin=(%.color=black); SELECT2 %.cls=person & %.skin=(%.color=black) & %.hair=(%.color=red &%.color=blue);
// Queries that find mary:
SELECT2 %.cls=person & %.hair=(%.texture=silky); SELECT2 %.cls=person & %.hair=(%.color=red & %.texture=silky); SELECT2 %.cls=person & %.skin=(%.color=white & %.texture=smooth); SELECT2 %.cls=person & %.hair=(%.color=red & %.texture=silky &%.texture=smooth);
// Queries that find john and mary:
SELECT2 %.cls=person; // Any person SELECT2 %.skin; // Any thing with skin SELECT2 %.hair; // Any thing with hair SELECT2 %.hair=(%.color=red); // Any thing with red hairReceived on Tue Nov 09 2004 - 21:11:46 CET