Question about Graph Tool constraints |
Post Reply |
Author | |
mvilleta
Contributor Joined: 26.Jun.2014 Points: 15 |
Post Options
Thanks(0)
Posted: 26.Jun.2014 at 11:49 |
Hi! I've a question related with the constraints definition in the Graph Tool in Metaedit+ Workbench 5.0. I will explain my question with an example: I want to define a binding between to objects (Object1 and Object2) vía one relationship (Relation) and two roles (Role1 and Role2). I need to define two constraints: 1. The Object1 may be in at most 2 roles of type role1 (that is, object1 can be connected at most 2 times with object2). I can define this constraint correctly 2. The Object1 must be connected in at least 1 role of type role1 (that is, the object1 can't be in a model without a connection with object2). My question it's related with this kind of constraints, how can I define it?, I didn't figured out a way from define minimum ocurrences of relationships or roles in a binding. Thanks in advance Regards
|
|
janne
MetaCase Joined: 25.Mar.2008 Points: 58 |
Post Options
Thanks(0)
|
One workaround: define a MERL generator to check whether the Object1 has 1-2 legal role1's. This MERL generator could be named as '__LiveCheck' so the end user will see the result of this validation immediately in the diagram bottom pane. Or you may have own "Check" or "Validate" button available in the toolbar (by naming the generator !Check etc.), which would validate the model according to some rules, when end-user presses this button.There is no Graph Constraint to create rule2, one reason is the fact that you always have to create Object1 first in the diagram, before you can connect any roles to it. This creation of new Object1 would be disallowed if the graph constraint would not allow any object to exist without the connection.
Edited by stevek - 26.Jun.2014 at 13:23 |
|
stevek
MetaCase Joined: 11.Mar.2008 Points: 641 |
Post Options
Thanks(0)
|
Another possibility for rule 2 is to add a conditional element to the symbol for Object1, e.g. to display a message "connect a role1" if there are no role1's. The message could be a text element, and the condition would then be a generator:
which would be compared to the empty string - i.e. show the message if the generator does not output 'ok'. Edited by stevek - 26.Jun.2014 at 13:18 |
|
mvilleta
Contributor Joined: 26.Jun.2014 Points: 15 |
Post Options
Thanks(0)
|
Ok!! Both are a really good solutions. I think that Janne's answer it's better for my case. Looking in the forum I found a stevek's post in which it's very well explained the __LiveCheck generator solution: Thanks a lot for the answers! Regards Edited by stevek - 26.Jun.2014 at 13:52 |
|
Post Reply | |
Tweet |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |