Re: Charades [Was: RE: Define "flatten database" ?]

From: Neo <neo55592_at_hotmail.com>
Date: 1 Feb 2005 13:47:32 -0800
Message-ID: <1107294452.917262.110330_at_l41g2000cwc.googlegroups.com>


> [Neo's] complicated examples leave everyone without a clue...

Below is a relatively simple example (except for the query at end) that models the following in a normalized manner: John is a person and engineer. John is male. Mary is a person, doctor and dentist. Mary is female. Franny is a performer whose classification and gender are unknown. Franny likes John. John likes Mary. Note that each thing can have different number of classifications, attributes and values.

// Create items in directory to classify things.
(CREATE *person.item ~in = dir)
(CREATE *engineer.item ~in = dir)
(CREATE *doctor.item ~in = dir)
(CREATE *dentist.item ~in = dir)
(CREATE *performer.item ~in = dir)

// Create abbreviations
(CREATE *abbr.item ~in = dir)
(CREATE *M.cls = abbr)
(CREATE *F.cls = abbr)
(CREATE *fem.cls = abbr)

// Create male and female genders with abbreviation codes. // Note that female has two abbreviations: F and Fem.
(CREATE *gender.item ~in = dir)
(CREATE *male.cls = gender & it.abbr = +M)
(CREATE *female.cls = gender & it.abbr = F & it.abbr = fem)

// Create a person named John who is an engineer.
(CREATE *.name = +John

& it.gender = male
& it.cls = person
& it.cls = engineer)

// Create a person named Mary who is a doctor and dentist.
(CREATE *.name = +Mary

& it.gender = female
& it.cls = person
& it.cls = doctor
& it.cls = dentist)

// Create a performer named Franny, gender unknown.
(CREATE *.name = +Franny

& it.cls = performer)

// Create the verb 'like' to relate things.
(CREATE *like.cls = verb)

// Create relationships
(CREATE Franny.like = John)
(CREATE John.like = Mary)

// Find something that likes a engineer
// who likes a dentist
// where the dentist's gender's is abbreviated as fem.
// Finds Franny.

(SELECT *.like=(*.cls=engineer

& *.like=(*.cls=dentist & *.gender=(*.abbr=fem)))) Received on Tue Feb 01 2005 - 22:47:32 CET

Original text of this message