Re: Multiple-Attribute Keys and 1NF

From: Neo <neo55592_at_hotmail.com>
Date: Thu, 30 Aug 2007 12:39:41 -0700
Message-ID: <1188502781.858317.98590_at_m37g2000prh.googlegroups.com>


> Some cows have black fur and white fur.
> Some cows have brown fur.
> Some cows have red fur.

Below dbd script models/queries above.

(new 'color)

(new 'cow1 'cow)
(set cow1 has (new 'hide1 'hide))
(set+ hide1 color 'black)
(set+ hide1 color 'white)

(new 'cow2 'cow)
(set cow2 has (new 'hide2 'hide))
(set+ hide2 color 'brown)

(new 'cow3 'cow)
(set cow3 has (new 'hide3 'hide))
(set+ hide3 color 'red)

(; Get cows that have black and white hide)
(; Gets cow1)
(& (get cow instance *)

    (get * has (& (get hide instance *)

                       (get * color black)
                       (get * color white))))

(; Get cows that have brown and red hide)
(; Gets nothing)
(get * has (& (get * color brown)

                   (get * color red)))
Received on Thu Aug 30 2007 - 21:39:41 CEST

Original text of this message