Re: Multiple-Attribute Keys and 1NF

From: Neo <neo55592_at_hotmail.com>
Date: Thu, 30 Aug 2007 14:42:57 -0700
Message-ID: <1188510177.946575.304760_at_m37g2000prh.googlegroups.com>


> Teacher Room    Time
> Jim     100     4:00pm
> Bob     100     3:00pm
> Bob     200     4:00pm
> Jim     200     3:00pm

Below dbd script models above. In addition, Jim, Bob and Brian teach in room 300 at 5:00 pm.

(new 'teacher)
(new 'room)

(new 'tuple1 'TeacherRoomTime)
(set+ (it) teacher 'jim)
(set+ (it) room '100)
(set+ (it) time '1600)

(new 'tuple2 'TeacherRoomTime)
(set+ (it) teacher 'bob)
(set+ (it) room '100)
(set+ (it) time '1500)

(new 'tuple3 'TeacherRoomTime)
(set+ (it) teacher 'bob)
(set+ (it) room '200)
(set+ (it) time '1600)

(new 'tuple4 'TeacherRoomTime)
(set+ (it) teacher 'jim)
(set+ (it) room '200)
(set+ (it) time '1500)

(new 'tuple5 'TeacherRoomTime)
(set+ (it) teacher 'jim)
(set+ (it) teacher 'bob)
(set+ (it) teacher 'brian)
(set+ (it) room '300)
(set+ (it) time '1700)

(; Get teachers for room 300 at time 1700)
(; Gets jim, bob and brian)
(get (& (get TeacherRoomTime instance *)

           (get * room 300)
           (get * time 1700))
       teacher *)
Received on Thu Aug 30 2007 - 23:42:57 CEST

Original text of this message