Connectables
Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: https://www.metacase.com/forums/forum_posts.asp?TID=157
Printed Date: 27.Mar.2026 at 02:14 Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com
Topic: Connectables
Posted By: freazer
Subject: Connectables
Date Posted: 14.Jul.2010 at 16:07
Hi,
I would like to explore all the connectables of my object in a Generator, but I can't find it in the list of the elements that can be used in a MERL script (Graph, Object, Port, Role,...). if you refer to the figure in this post http://www.metacase.com/forums/forum_posts.asp?TID=155 - http://www.metacase.com/forums/forum_posts.asp?TID=155 I would like to have this kind of output from the Generator: ----------------------- Slave 1 on Port 1 Slave 2 on Port 1 Slave 3 on Port 2 ------------------------
Thx
|
Replies:
Posted By: stevek
Date Posted: 16.Jul.2010 at 02:34
It's not connectables that you want to explore, it's Ports. Connectables are a representational thing, ports are the conceptual things, and MERL deals (primarily) with conceptual things.
So you want to go through all Masters, and for each one go through its MasterSlave relationships. Actually, we'll walk first just into the Master role, and from there go on an excursion to the Slave role and Slave ("Slave 1"), and then again on an excursion to the MyPort port:
foreach .Master {
do ~Master {
do ~Slave.Slave { id }
' on '
do #MyPort { id }
newline
}
}
It's generally best to navigate into roles rather than relationships. In this case it doesn't matter much, but if both roles were of the same type (e.g. Association End in UML), if you go to the relationship and look at the roles, they all look the same so it's hard to know which way you want to go next.
Similarly you never want to navigate on from a port. You can pop into one on an excursion, but asking for all the roles connected to "Port 1" is pretty meaningless: "Port 1" is defined in the metamodel, so every Master object has the identical same "Port 1", so you would then be following ALL roles connected to ANY Master object on Port 1.
|
|