dbTalk Databases Forums  

Bi-Directional Transitive Closure (with dbd)

comp.databases.object comp.databases.object


Discuss Bi-Directional Transitive Closure (with dbd) in the comp.databases.object forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Neo
 
Posts: n/a

Default Bi-Directional Transitive Closure (with dbd) - 12-01-2006 , 12:11 PM






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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.