[thelist] Nested Queries (long example code)

Joshua Olson joshua at waetech.com
Wed Aug 21 18:20:00 CDT 2002


----- Original Message -----
From: "Steve Lewis" <slewis at macrovista.net>
To: <thelist at lists.evolt.org>
Subject: Re: [thelist] Nested Queries (long example code)


> If you are solving a more complex problem of traversing a network/graph
> (where groups are many-to-many), rather than a tree (where groups are
> one-to-many) you need to find a way to avoid getting caught in loops...

This code does traverse the network/graph and it does avoid getting caught
in loops.  Any group that is processed gets thrown onto a
used_group stack.  This stack is added to as soon as a group is arrived
upon, but before the group is actually processed.  The used_group stack has
a special property that will cause it to only allow one copy of each group
to be added to it.  If a second identical group is added, an error is thrown
and the processing is skipped for that group.  Hence, the catch/try portion
of the code.

> object Table data
> 1 1 Group1 prop1 prop2 prop3 ... propx
> 2 2 Group2 prop1 prop2 prop3 ... propx
> 3 3 Group3 prop1 prop2 prop3 ... propx
> 4 4 Group4 prop1 prop2 prop3 ... propx
>
> membership Table data
> 1 3
> 2 1
> 3 2
> 4 2

Thanks for the astude intuition, though.  :-)

-joshua




More information about the thelist mailing list