Network Example: Sibling of Opposite Gender

From: Neo <neo55592_at_hotmail.com>
Date: 22 Dec 2006 09:16:20 -0800
Message-ID: <1166807780.910621.30040_at_f1g2000cwa.googlegroups.com>



Suppose Adam has children named John(male), Jack(male) and Mary(female) and we want to find John's sibling of opposite gender without refering to John's father (Adam) or John's gender (male) directly. Below is a solution using a network-type db. What RMDB schema/query implements the equivalent?

(new 'male 'gender)
(new 'female 'gender)

(new 'opposite 'verb)
(set male opposite female)
(set female opposite male)

(new 'adam 'person)

(new 'john 'person)
(set john gender male)

(new 'jack 'person)
(set jack gender male)

(new 'mary 'person)
(set mary gender female)

(set adam child john)
(set adam child jack)
(set adam child mary)

(; Get john's sibling of opposite gender

    by getting persons
    whose gender is opposite
    and is child of john's parent
    and that person is not himself)
(; Gets mary)
(!= (and (get person instance *)

            (get * gender (get (get john gender *) opposite *))
            (get (get * child john) child *))
     john)
Received on Fri Dec 22 2006 - 18:16:20 CET

Original text of this message