Re: About Entity Relation Diagram

From: Neo <neo55592_at_hotmail.com>
Date: 19 Dec 2004 15:32:30 -0800
Message-ID: <1103499150.533575.42920_at_z14g2000cwz.googlegroups.com>


> How can I organize the data so that the table remain as normalized > as possible.

The script below uses an experimental db to model the data in a fairly normalized manner, however it doesn't use tables. Sample query at end.

// Create classes and add to main directory

CREATE *person.item ~in = dir;
CREATE *member.item ~in = dir;
CREATE *perfect partner.item ~in = dir;
CREATE *age.item ~in = dir;
CREATE *weight.item ~in = dir;
CREATE *bodyType.item ~in = dir;
CREATE *color.item ~in = dir;
CREATE *interest.item ~in = dir;
CREATE *bodyPart.item ~in = dir;

// Create body parts

CREATE *eye.cls = bodyPart;
CREATE *hair.cls = bodyPart;

// Create adverbs

CREATE *middle.cls = adverb;
CREATE *min.cls = adverb;
CREATE *max.cls = adverb;

// Create a person named john smith

CREATE *;

CREATE it.name, first = +john;
CREATE it.name, last = +smith;
CREATE it.cls = person;
CREATE it.cls = member;
CREATE it.age = +30;
CREATE it.weight = +180;
CREATE it.bodyType = +average;
CREATE it.color,eye = +brown;
CREATE it.color,eye = +blue;
CREATE it.color,hair = +silver;
CREATE it.interest = +hiking;
CREATE it.interest = +golf;

// Create john's perfect partner

CREATE *;

CREATE it.cls = perfect partner;
CREATE it.age,min = +20;
CREATE it.age,max = +40;
CREATE it.weight,min = +120;
CREATE it.weight,max = +180;
CREATE it.bodyType = +thin;
CREATE it.bodyType = +average;
CREATE it.color,eye = +brown;
CREATE it.interest = +hiking;
CREATE it.interest = +cooking;
CREATE (%.name,first=john & %.name,last=smith).perfect partner = it;

// Find persons whose perfect partner is thin, has brown eyes,
// and is interest in hiking and cooking.
// Finds john smith.

SELECT %.cls=person & %.perfect partner=(%.bodyType=thin & %.color,eye=brown & %.interest=hiking & %.interest=cooking); Received on Mon Dec 20 2004 - 00:32:30 CET

Original text of this message