Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » ATL :mapping between Enum
ATL :mapping between Enum [message #107918] Mon, 06 July 2009 13:53 Go to next message
venkatesh  is currently offline venkatesh Friend
Messages: 41
Registered: July 2009
Member
Hi

I'm a beginner to ATL .

I have a mapping between to Enum to Enum.

this is Source Model

Eclass A
|___________attributeA:Relation (Relation is an Enum )

Relation
parent=0
child=1

Target Model

Eclass B
|___________attributeB:Relation (Relation is an Enum )
Relation
parent=0
child=1

now i want to create a rule which will map

A-----B
attributeA-----attributeB



Thanks in Advance
lakshmi
Re: ATL :mapping between Enum [message #108019 is a reply to message #107918] Wed, 08 July 2009 05:55 Go to previous messageGo to next message
venkatesh  is currently offline venkatesh Friend
Messages: 41
Registered: July 2009
Member
Anybody knows how to write a rule to map Enum to Enum

Thanks,
lakshmi
Re: ATL :mapping between Enum [message #509616 is a reply to message #108019] Sat, 23 January 2010 16:43 Go to previous messageGo to next message
Martin Baez is currently offline Martin BaezFriend
Messages: 12
Registered: July 2009
Junior Member
It seems that nobody knows how to work with enum types in ATL. I am a
beginner with ATL but I transformed the enum types with a helper in this
way:

helper def : getNewEnumValue(pType: amds!EnumType1):
myModel!EnumType2=#SOME_VALUE;

I've written the helper in this way just to be clear, but you should
process the parameter pType to conclude what literal value must be
returned. In this case I returned #SOME_VALUE, and it is supossed to
be an EnumType2's valid literal value.

It would be great If someone could just spend 2 minutes to ansuwer this
simple questions.

lakshmi I suggest trying qvto!



lakshmi wrote:
> Anybody knows how to write a rule to map Enum to Enum
>
> Thanks,
> lakshmi
>
Re: ATL :mapping between Enum [message #509733 is a reply to message #107918] Mon, 25 January 2010 09:05 Go to previous message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
The best solution imho is to use a map linking source enum value to target enum value :

helper def : enumMap : Map(OclAny,OclAny) = Map{(#sourceEnum1,#targetEnum1),(#sourceEnum2,#targetEnum2)} ;

Then in your binding you just have to write :

targetEnum <- thisModule.enumMap.get(s.sourceEnum)

The advantage is that you can also easily map the case where the sourceEnum isn't set by adding (OclUndefined,#someValue) in the map.
Previous Topic:[ATL] tarnsform a GMF based diagram
Next Topic:Declarative QVT Execution
Goto Forum:
  


Current Time: Thu Apr 25 06:01:15 GMT 2024

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

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

Back to the top