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 > Querying for Pi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 327 of 363
Post > Topic >>

Querying for Pilots Who Fly All Jets in dbd

by "Neo" <neo55592@[EMAIL PROTECTED] > Nov 17, 2006 at 12:19 PM

This dbd example models pilots who fly jets.
Queries with selectAll find pilots who fly all jets.
For details, see www.dbfordummies.com/example/ex042.asp

(new 'fly 'verb)

(new 'jet1 'jet)
(new 'jet2 'jet)

(new 'pilot1 'pilot)
(create pilot1 fly jet1)

(new 'pilot2 'pilot)
(create pilot2 fly jet1)
(create pilot2 fly jet2)

(; Find pilots who fly all jets)
(; Finds pilot2)
(and (select pilot instance *)
        (selectAll * fly (select jet instance *)))

(new 'jet3 'jet)
(new 'pilot3 'pilot)
(create pilot3 fly jet1)
(create pilot3 fly jet2)
(create pilot3 fly jet3)

(; Find pilots who fly all jets)
(; Finds pilot3)
(and (select pilot instance *)
        (selectAll * fly (select jet instance *)))

(new 'red 'color)
(create jet1 color red)

(new 'green 'color)
(create jet2 color green)

(new 'blue 'color)
(new 'purple 'color)
(create jet3 color blue)
(create jet3 color purple)

(; Find pilots who fly all jets that are red)
(; Finds pilot1, pilot2 and pilot3)
(and (select pilot instance *)
        (selectAll * fly (and (select jet instance *)
                                     (select * color red))))

(; Find pilots who fly all jets that are green)
(; Finds pilot2 and pilot3)
(and (select pilot instance *)
        (selectAll * fly (and (select jet instance *)
                                     (select * color green))))

(; Find pilots who fly all jets that are blue and purple)
(; Finds pilot3)
(and (select pilot instance *)
        (selectAll * fly (and (select jet instance *)
                                     (select * color blue)
                                     (select * color purple))))

(; Find pilots who fly all jets that are red or green)
(; Finds pilot2 and pilot3)
(and (select pilot instance *)
        (selectAll * fly (and (select jet instance *)
                                     (select * color (or red green)))))

(; Find pilots who fly all jets that are not red or green)
(; Finds pilot3)
(and (select pilot instance *)
        (selectAll * fly (and (select jet instance *)
                                     (select * color (not red green)))))
 




 1 Posts in Topic:
Querying for Pilots Who Fly All Jets in dbd
"Neo" <neo55  2006-11-17 12:19:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan13V112 Sun Jul 6 4:35:49 CDT 2008.