Network Example: Sibling of Opposite Gender



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)

.