MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Kennels
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Kennels

 Post Reply Post Reply
Author
Message
jkouwer View Drop Down
Major Contributor
Major Contributor


Joined: 08.Mar.2010
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote jkouwer Quote  Post ReplyReply Direct Link To This Post Topic: Kennels
    Posted: 11.Jun.2010 at 15:54
Hello,

I'm in the works of making a language for kennels

I have one graph that allows me to create doghouses
I have one graph that allows me to define all things about dogs
I have one graph that allows me to allocate dogs to doghouses

Now I want to create a generator that, when looking at one particular doghouse, can show me which dogs are allocated to it.

How to approach this?

I have vague feeling that at this point decompositions and / or explosions are entering the picture, which would not be a bad thing in itself as I would really like to master these topics.

Regards,
Jeroen Kouwer

Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 11.Jun.2010 at 17:29
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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.039 seconds.