Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Object > Finding Brother...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 333 of 363
Post > Topic >>

Finding Brothers & Sisters (with dbd)

by "Neo" <neo55592@[EMAIL PROTECTED] > Dec 4, 2006 at 09:14 AM

The following dbd example models Adam who has children named
John(male), Jack(male) and Mary(female). Queries find John's siblings,
brothers and sisters.

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

(new 'adam 'person)

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

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

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

(new 'child 'verb)
(set adam child john)
(set adam child jack)
(set adam child mary)

(; Get john's siblings
    by getting persons
    who is a child of john's father
    and that person is not himself)
(; Gets jack and mary)
(!= (and (get person instance *)
            (get (get * child john) child *))
     john)

(; Get john's brothers
    by getting persons
    whose gender is male
    and is child of john's father
    and that person is not himself)
(; Gets jack)
(!= (and (get person instance *)
            (get * gender male)
            (get (get * child john) child *))
     john)

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

For more examples, see www.dbfordummies.com
 




 3 Posts in Topic:
Finding Brothers & Sisters (with dbd)
"Neo" <neo55  2006-12-04 09:14:55 
Re: Finding Brothers & Sisters (with dbd)
"Neo" <neo55  2006-12-22 09:09:22 
Re: Finding Brothers & Sisters (with dbd)
"Neo" <neo55  2006-12-23 11:48:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Wed Jul 9 1:03:18 CDT 2008.