Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Using OCL to map an association
Using OCL to map an association [message #235274] Fri, 03 July 2009 21:02 Go to next message
Fabricio Pellegrini is currently offline Fabricio PellegriniFriend
Messages: 36
Registered: July 2009
Member
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 09:45 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
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
Previous Topic:LayoutService.layout() in LayoutEditPolicy
Next Topic:New Project Action
Goto Forum:
  


Current Time: Thu Apr 02 23:44:37 GMT 2020

Powered by FUDForum. Page generated in 0.02069 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top