MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Question about Graph Tool constraints
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Question about Graph Tool constraints

 Post Reply Post Reply
Author
Message
mvilleta View Drop Down
Contributor
Contributor
Avatar

Joined: 26.Jun.2014
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mvilleta Quote  Post ReplyReply Direct Link To This Post Topic: Question about Graph Tool constraints
    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
Back to Top
janne View Drop Down
MetaCase
MetaCase
Avatar

Joined: 25.Mar.2008
Points: 58
Post Options Post Options   Thanks (0) Thanks(0)   Quote janne Quote  Post ReplyReply Direct Link To This Post Posted: 26.Jun.2014 at 12:49
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
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 641
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 26.Jun.2014 at 13:15
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:
if ~role1; then 'ok' endif
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
Back to Top
mvilleta View Drop Down
Contributor
Contributor
Avatar

Joined: 26.Jun.2014
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mvilleta Quote  Post ReplyReply Direct Link To This Post Posted: 26.Jun.2014 at 13:50
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
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.063 seconds.