Using OCL to map an association [message #235274] |
Fri, 03 July 2009 17:02  |
Eclipse User |
|
|
|
Hi,
I would like to know what is the best way to map my associations.
I have five Class on my metamodel that extends to my Entity Class, each
one can be associated to the other (but not with itself), to simplify my
metamodel I created a Class Association that have source and target typed
with my Entity Class. So in the diagram my source and target can be anyone
of my five Class.
The problem is that I need to set a diferent label for each kind of
Association.
For exemple:
A <-> B with Label = 'in'
B <-> C with Label = 'out'
A <-> C with Label = 'main'
So I created more five associations that extends to my Association Class.
Each one with it default label.
But when I'm on the mapping step I don't know how to differ one
association to the other.
I think I can use OCL but I don't even know how to ...
One solution that someone did before me, is to create two association for
each relation like this
association 1.1 : source(A) target(B) label = 'in'
association 1.2 : source(B) target(A) label = 'in'
But I think it's not a good solution
If someone have an ideia I would be glad.
Thanks
|
|
|
Re: Using OCL to map an association [message #235343 is a reply to message #235274] |
Mon, 06 July 2009 05:45  |
Eclipse User |
|
|
|
Hello Fabricio,
You can create single association (link mapping) and provide label text using
your custom (java-) ParserProvider + constraint this association to be able
to connect only instances of different metaclasses (A with B, B with C, ...)
using OCL/java constraint.
Or you can create a number of associations (link mappings) connecting different
source/target metaclasses and having different labels. As a result you'll
have a lot of link mappings in .gmfmap model, but you will save time on writing
java code + plugging it into GMF-generated editor.
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.02778 seconds