Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » ATL :mapping between Enum
ATL :mapping between Enum [message #107918] Mon, 06 July 2009 09:53 Go to next message
Eclipse UserFriend
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 01:55 Go to previous messageGo to next message
Eclipse UserFriend
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 11:43 Go to previous messageGo to next message
Eclipse UserFriend
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 04:05 Go to previous message
Eclipse UserFriend
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: Fri Jul 04 23:56:29 EDT 2025

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

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

Back to the top