|
Let's call your graph types Doghouses, Dogs, and Allocation. Obviously the answer comes from the Allocation graph. The thing you don't say is where you are starting from; I'll assume it's from a Doghouse in a Doghouses graph (e.g. a generator in a Doghouse symbol there).
The simplest answer is simply to go through all Allocation graphs, finding that Doghouse:
do graphs where type = 'Allocation'
{ foreach .Doghouse; where oid = oid;2
{ do .Dog
{ id newline } } }
The oid;2 is the oid two levels out, i.e. the Doghouse back in the Doghouses graph.
This works fine for a simple example. As things grow, you may find that you need more precision. You may have an Allocation for 2009 and one for 2010, and you're only interested in this year. Or that you want to have several possible Allocations for the same year and compare them. In that case you'll need to specify the limits of your search, and indeed of your world, by building some kind of top-level project graph that can point to the set of Dogs, Doghouses and Allocation graphs that are to be considered together.
Rather than going through every graph with do graphs, you'll follow links from the top-level graph. If you start having top-level graphs that share subgraphs, you'll quickly notice that you can no longer say in a Doghouse graph, which dogs are in that Doghouse - the answer to that question varies depending on the context given by the top-level graph. That's probably what you want, given that even in your post you've structured your graphs to be as independent from each other as possible.
If you don't need that independence, and don't see a clear need for it in the future, simply stick the doghouses and dogs into one graph type. The properties of the objects will tell you about the things themselves, and the relationships between them will tell you about the allocation.
|