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 > Bi-Directional ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 332 of 365
Post > Topic >>

Bi-Directional Transitive Closure (with dbd)

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

Following is a demo of bi-directional transitive closure on a
muti-rooted tree using dbd. It represents the following boss/employee
hierarchy:

john
   bob
     jack
     bill

mary
   sue
     jack
     bill

(new 'john 'person)
(new 'mary 'person)
(new 'bob 'person)
(new 'sue 'person)
(new 'jack 'person)
(new 'bill 'person)

(new 'boss 'verb)
(new 'employee 'verb)

(set boss leads up)
(set employee leads down)

(set boss reciprocal employee)
(set employee reciprocal boss)

(; Note setWRR automatically creates reciprocal relation****p)
(setWRR john employee bob)
(setWRR bob employee jack)
(setWRR bob employee bill)

(setWRR mary employee sue)
(setWRR sue employee jack)
(setWRR sue employee bill)

(; Get john's employees recursively)
(; Gets bob, jack, bill)
(getRel john employee *)

(; Get mary's employees recursively)
(; Gets sue, jack, bill)
(getRel mary employee *)

(; Get jack's bosses recursively)
(; Gets bob, john, sue, mary)
(getRel jack boss *)

(; Get bill's bosses recursively)
(; Gets bob, john, sue, mary)
(getRel bill boss *)


For more examples, see www.dbfordummies.com
 




 1 Posts in Topic:
Bi-Directional Transitive Closure (with dbd)
"Neo" <neo55  2006-12-01 09:11:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan13V112 Thu Jul 24 2:49:26 CDT 2008.