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

Port Navigation

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


Joined: 12.Sep.2014
Location: Melbourne
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote jianliu Quote  Post ReplyReply Direct Link To This Post Topic: Port Navigation
    Posted: 31.May.2015 at 05:52
Hi,
I'm developing a DSL for SQL table creation. Tables can be master or slave, and slave tables have one or more foreigh keys for linking to master tables. The below diagram shows a master table table1 and a slave table table2, the field2 of slave table links to field1 of master through an associate rellationship.

I use a template to host table field objects, which are defined as collection property of a table (please refer to two diagrams for the design). What I'm trying to do is to find the table field object with foreign key first, then navigate from the port and role on slave table side to the role and port on master table side through a relationship, and finally identify the table field object of the master table. Unfortunately, this doesn't work.
Could you please suggest a solution for implementing this kind of dynamic port navigation?

Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (1) Thanks(1)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 31.May.2015 at 11:20
Did you check out the manual on navigating with ports?
Quote Please note that it is not possible to navigate to an object, relationship or role from a port instance. This is due to the fact that the same port instance is* used in each object instance, and thus it may be associated with several objects, relationships or roles. There is no way to make a distinction between them from within the generator, which only knows that it is 'in' a port in a certain graph. Navigating to a port thus forms a dead end for further navigation. Instead, navigate to the role, and from there query or generate the information you need from the port, then navigate to the object.
* The same static port is in each instance of its type; the same dynamic port may be used in several instances.

So you want something like this:
foreach .tablefield
{ 'From Table: ' id
   do ~ForeignKeyRole
   { ' FK port: ' do #() {id}
      do ~PrimaryKeyRole
      { ' to PK port: ' do #() {id}
        do .()
        { ' in Table: ' id newline
        }
      }
   }
}
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.040 seconds.