Demo: Db For Dummies
From: Neo <neo55592_at_hotmail.com>
Date: 9 Nov 2004 19:31:33 -0800
Message-ID: <4b45d3ad.0411091931.9faa461_at_posting.google.com>
The XDb2 script below creates/queries a person named john with black skin and red-blue hair; and a person named mary with smooth-white skin and red, silky-smooth hair. A similar RM implementation might use T_Person, T_Skin, T_Hair, T_Color and T_Texture. See www.xdb2.com/example/ex005.asp for more details.
Date: 9 Nov 2004 19:31:33 -0800
Message-ID: <4b45d3ad.0411091931.9faa461_at_posting.google.com>
The XDb2 script below creates/queries a person named john with black skin and red-blue hair; and a person named mary with smooth-white skin and red, silky-smooth hair. A similar RM implementation might use T_Person, T_Skin, T_Hair, T_Color and T_Texture. See www.xdb2.com/example/ex005.asp for more details.
// 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 Wed Nov 10 2004 - 04:31:33 CET