Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] execution order and UML profiles
[ATL] execution order and UML profiles [message #537185] Tue, 01 June 2010 14:56 Go to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
Hello,

I have a transformation that copies UML elements and adds stereotypes to some elements. In the do-block of the rule to copy uml::Model elements I apply the profile containing the stereotypes. Unfortunately some other rules (matched rules for elements contained in the uml::Model) are called before the profile gets applied. So I cannot apply stereotypes in the matched rules, because the profile is not applied yet. I tried to walk up the containment hierarchy (from the contained element up to the uml::Model) to apply the profile in the rule for the contained element, but it seems the container-attribute is not set at the time the do-block is executed.
So how can I ensure, a profile is applied BEFORE a subsequent matched rule is called? Or is that impossible?

Thanks in advance,
Max
Re: [ATL] execution order and UML profiles [message #537200 is a reply to message #537185] Tue, 01 June 2010 15:15 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You can use an entrypoint rule that is executed before the rest of the transformation and create the model in this rule in order to apply the profiles right there before all the other rules are executed.
Re: [ATL] execution order and UML profiles [message #537373 is a reply to message #537200] Wed, 02 June 2010 08:48 Go to previous messageGo to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
Thanks, now the profile actually gets applied before everything else is mapped. But still containment references are not set if do-blocks of matched rules are executed. So stereotypes are not applicable to model elements, because they are not contained in Packages/Models that have the Profile applied. At least at the point of time the do-block is reached. I could split the transformation up in two: The first one copies the model elements and applies profiles, the second one would be a refining transformation that applies the stereotypes, based on the original model. But that would be an inefficient and complicated way.
Re: [ATL] execution order and UML profiles [message #537383 is a reply to message #537373] Wed, 02 June 2010 09:18 Go to previous messageGo to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
Oops, I forgot that do blocks are not allowed in refinement transformations, so that solution doesn't work.
Re: [ATL] execution order and UML profiles [message #537389 is a reply to message #537185] Wed, 02 June 2010 09:44 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
To manage profiles and stereotypes, you can alternatively use the Ecore definition of profiles instead of the UML one.

To do this, you create a fake metamodel that makes the "sum" of UML2 and all your profiles. To do this you just create a fake EClass that inherits from one EClass of UML2 and one EClass of each profile.

You then use this metamodel as metamodel of the transformation. This will then allow you to apply stereotypes by creating instances of the stereotype metaclass :

t : UML2!MyStereotype(
base_Class <- u
)

Tagged Values are then attributes of the instances :

t : UML2!MyStereotype(
base_Class <- u,
myTaggedValue <- 'myValue'
)

I find that solution much clearer than the use of UML2 APIs in the transformation plus it might solve your problem.
Re: [ATL] execution order and UML profiles [message #537503 is a reply to message #537389] Wed, 02 June 2010 16:34 Go to previous messageGo to next message
wafaa is currently offline wafaaFriend
Messages: 163
Registered: January 2010
Location: Egypt
Senior Member
Sylvain EVEILLARD wrote on Wed, 02 June 2010 12:44
To manage profiles and stereotypes, you can alternatively use the Ecore definition of profiles instead of the UML one.

To do this, you create a fake metamodel that makes the "sum" of UML2 and all your profiles. To do this you just create a fake EClass that inherits from one EClass of UML2 and one EClass of each profile.

You then use this metamodel as metamodel of the transformation. This will then allow you to apply stereotypes by creating instances of the stereotype metaclass :

t : UML2!MyStereotype(
base_Class <- u
)

Tagged Values are then attributes of the instances :

t : UML2!MyStereotype(
base_Class <- u,
myTaggedValue <- 'myValue'
)

I find that solution much clearer than the use of UML2 APIs in the transformation plus it might solve your problem.


Hi all,
can you please explain your idea more, actually I hope to use my profile as metamodel with the UML metamodel
and this trick will escape many checks for stereotype and will use the stereotype as a type, which is the desired solution,

please Sylvain I need you help if you do not mind

[Updated on: Wed, 02 June 2010 16:36]

Report message to a moderator

Re: [ATL] execution order and UML profiles [message #546781 is a reply to message #537389] Wed, 14 July 2010 08:15 Go to previous message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
Sorry for my late anwer. I just wanted to let you know that the solution with stereotypes as meta classes worked just fine. Thank you very much!

@wafaa: every defined profile contains generated ECore classes for the stereotypes in the profile. I created a static profile, which results in a seperate ECore file. This is easier to handle. Check this on how to create them:
http://nyssen.blogspot.com/2009/09/defining-static-profiles- with-eclipse.html
Applied stereotypes are actually instances of this ECore classes and are stored in the UML2 file along with the stereotyped elements.
Previous Topic:[QVTr] QVTd Project - Errors in examples?
Next Topic:[ATL] is this case refinement or transformation
Goto Forum:
  


Current Time: Fri Dec 13 16:37:14 GMT 2024

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

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

Back to the top