Welcome to dbForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Bi-Directional Transitive Closure (with dbd)

 
   Database Forums (Home) -> Object-Oriented RSS
Next:  Modelling Cars & Calculating Total Cost with ..  
Author Message
neo55592

External


Since: Dec 06, 2004
Posts: 480



(Msg. 1) Posted: Fri Dec 01, 2006 9:11 am
Post subject: Bi-Directional Transitive Closure (with dbd)
Archived from groups: comp>databases>object (more info?)

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 relationship)
(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

 >> Stay informed about: Bi-Directional Transitive Closure (with dbd) 
Back to top
Login to vote
neo55592

External


Since: Dec 06, 2004
Posts: 480



(Msg. 2) Posted: Fri Dec 01, 2006 9:11 am
Post subject: Bi-Directional Transitive Closure (with dbd)
Archived from groups: per prev. post (more info?)

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 relationship)
(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

 >> Stay informed about: Bi-Directional Transitive Closure (with dbd) 
Back to top
Login to vote
Display posts from previous:   
   Database Forums (Home) -> Object-Oriented All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]