![]() |
Constraint on objects' properties for relationship |
Post Reply
|
| Author | ||
zjf
Member
Joined: 10.Jul.2016 Points: 1 |
Post Options
Thanks(0)
Quote Reply
Topic: Constraint on objects' properties for relationshipPosted: 25.Jul.2016 at 18:42 |
|
|
I want to put a constraint on relationships so they check their objects' properties. I have two object types, Task and Team, and both have a property, Capability, which is a collection of objects. A Team can only have a relationship to a Task if the Team's Capability property contains all the items mentioned in the Task's Capability property. Otherwise
the relationship is wrong and an error message should be displayed. In OCL this constraint could be written like this:
Edited by stevek - 26.Jul.2016 at 11:06 |
||
![]() |
||
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
Posted: 25.Jul.2016 at 19:47 |
|
|
You can make a symbol for the relationship that uses a generator to display the missing Capabilities. There are several ways you could do this; I'll show two. Here's a way that only uses simple MERL commands. Note that the ;1 level number in .Team;1 and id;1 means "do this on the element one loop further out".
In the second way, to make it a little faster, you can avoid having to navigate N*M times to Team Capabilities. Instead, save them one per line in a variable $caps, then looking up each Task Capability in $caps using a =~ wildcard comparison.
|
||
![]() |
||
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 |