[ATL] Problem when transforming a model stored in a .uml file into another model [message #548350] |
Wed, 21 July 2010 10:39  |
Eclipse User |
|
|
|
I've just written a toy transformation between UML models that use profiles. Using the UML Editor I developed two profiles (profileA and profileB), each one extending the UML2 Class meta-class with the corresponding stereotype (AClass and BClass, respectively) defining two new tagged values (payload and tag). Then, I used UML Editor to create a source model that instantiated the stereotyped defined by profileA.
I wrote this simple .atl file:
module AClass2BClass;
create OUT: profileB from IN: profileA;
helper context profileA!AClass def: translate() : String =
if self.payload > 0 then
'Greater than zero'
else
'Equal to zero'
endif;
rule main {
from
s: profileA!AClass
to
-- payload is an Integer in AClass
-- payload is a String in BClass
t: profileB!BClass (
payload <- s.translate()
)
}
The inputs to run this code I indicated to ATL Configuration were the two profiles (profileA.profile.uml and profileB.profile.uml), the source model (aclass_model.uml) and I indicated that ATL should generate the output model bclass_model.uml.
When I opened the generated output (bclass_model.uml) using the UML Editor I realized that the information about the profile was in the file, whereas the information about the transformed model element (the instance of the BClass meta-class) was not. When I open the bclass_model.uml file using a text editor I see XMI code that sets the payload tagged value as indicated by the transformation.
My questions are: is ATL able to transform .uml files properly? Do you see anything wrong in my procedure that prevents ATL from generating a proper .uml file?
Thanks a lot for your help.
[Updated on: Wed, 21 July 2010 10:47] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
Re: [ATL] Problem when transforming a model stored in a .uml file into another model [message #642800 is a reply to message #642780] |
Thu, 02 December 2010 13:08   |
Eclipse User |
|
|
|
These are my two cents:
1. I replicated this excercise using the eclipse plugin for Papyrus. I managed to create the .uml files using this tool, but the problem I had was that the .atl file in this poject was not compiled into the internal representation (.asm file) used by ATL's VM. I had to run the ATL rules from a similar file in another project. Weird stuff, do not know what happened here yet.
On the other hand, I tried to use Enterprise Architect as my first option, but had problems with importing. My little experience indicates that this inter-tool importing/exporting mechanisms for UML/XMI do not really work for most of the cases.
2. My understanding is that the developer wants to transform a model that has been extended as a result of the application of a profile; that is, the developer wants to build a complete model, that includes profile applications, before performing the transformation process. That is why I applied the profile to a model before running the transformation rules, instead of the transformation rules to apply the profile. My guess is that this is the correct procedure.
3. The target model produced by the transformation rules does not contain an instance of the ProfileApplication meta-meta-class; thus, it can not be seen as a model that has a profile (profileB) applied to it. Is this what you intended to do? In this case, we could not "de-apply" profileB from the target model produced by the rules I wrote because there is no such appication (instance of ProfileApplication), that is for sure. I would like to know the opinion of an expert on this, the specific question is:
If we have a source model to which we have applied a profile (profileA), and thus contains an instance of ProfileApplication, does our transformation have to generate a target model that also contains an instance of ProfileApplication?
Sylvian, what is your opinion on that?
Kindest regards.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05743 seconds