Re: Sixth normal form

From: Neo <neo55592_at_hotmail.com>
Date: Wed, 01 Aug 2007 17:39:49 -0000
Message-ID: <1185989989.431616.62240_at_w3g2000hsg.googlegroups.com>


> example - a table contains TeacherId, SkillId and CourseId as fields.
> These are related by the rule that teacher with certain skills can
> teach certain courses, however a teacher may possess skills required
> for a course, but he may not be teaching that course. Here there are 3
> join dependencies - (TeacherId, SkillId), (SkillId, CourseId) and
> (TeacherId, CourseId) which should be separate tables as per the 5th
> normal form.

Below script models above using dbd.

(; Create skills)
(new 'child_psychology 'skill)
(new 'english 'skill)
(new 'algebra 'skill)
(new 'logic 'skill)
(new 'judo 'skill)
(new 'sing 'skill)

(; Create courses)
(new 'history_101 'course)
(new 'physics_101 'course)
(new 'chemistry_101 'course)

(; Set course skill requirements)
(set history_101 skill english)

(set physics_101 skill english)
(set physics_101 skill logic)

(set chemistry_101 skill english)
(set chemistry_101 skill algebra)

(; Create teachers)
(new 'john 'teacher)
(new 'mary 'teacher)
(new 'sue 'teacher)

(; Create verb teach)
(new 'teach 'verb)

(; Set john's skills)
(set john skill child_psychology)
(set john skill english)
(set john skill algebra)
(set john skill logic)
(set john skill judo)

(; Set courses that john teaches)
(set john teach history_101)
(set john teach physics_101)

(; Set mary's skills)
(set mary skill child_psychology)
(set mary skill english)
(set mary skill algebra)
(set mary skill sing)

(; Set courses that mary teaches)
(set mary teach history_101)
(set mary teach chemistry_101)

(; Set sue's skills)
(set sue skill child_psychology)
(set sue skill sing)

(; Get all teachers who have skills for chemistry_101)
(; Gets john and mary)
(and (get teacher instance *)

     (getAll * skill (get chemistry_101 skill *)))

(; Get courses taught by teachers that can sing)
(; Gets history101 and chemistry101)
(and (get course instance *)

     (get (get * skill sing) teach * )) Received on Wed Aug 01 2007 - 19:39:49 CEST

Original text of this message