Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Applying stereotypes in refinement mode
[ATL] Applying stereotypes in refinement mode [message #534779] Thu, 20 May 2010 10:22 Go to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
Hello,

is it possible to apply UML profiles to packages and stereotypes to newly created model elements in refining mode? It seems that the refining mode doesn't support do-blocks.

Regards,
Max
Re: [ATL] Applying stereotypes in refinement mode [message #534780 is a reply to message #534779] Thu, 20 May 2010 10:26 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Maybe you could try to use the profile as metamodel and then instantiate stereotypes. Let's say you wan't to apply the stereotype Entity on a Class.

rule ClassRefining {
from s : Profile!Class
to t : Profile!Class(),
str : Profile!Entity(base_Class <- t)
}

The UML2 Profile references UML2 so ATL "sums" the metamodels and that's what allows to use Profile!Class.
Re: [ATL] Applying stereotypes in refinement mode [message #534823 is a reply to message #534780] Thu, 20 May 2010 13:08 Go to previous messageGo to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
Thanks, this is a nice idea. Unfortunately it doesn't work.
If I define the transformation as you suggested, the UML Elements are copied, but my rules are ignored. The regular VM complains, that Profile!Class cannot be found.
If I define the transformation like this:
module MyModule;
create OUT : Profile refining IN : UML;
rule ClassRefining {
	from s : UML!Class
	to t : Profile!Class(),
	str : Profile!Entity(base_Class <- t)
}

only the stereotype elements are created and no UML elements.

The next difficulty: I want to transform from a heavyweight UML extension (Metaclasses, that extend the ones from UML) to UML with stereotypes. Is that kind of transformation even possible using the refining mode? I thought since the extension is a superset of the UML that it might be possible.
Re: [ATL] Applying stereotypes in refinement mode [message #534829 is a reply to message #534779] Thu, 20 May 2010 13:13 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
IN conforms to Profile too
Re: [ATL] Applying stereotypes in refinement mode [message #535124 is a reply to message #534829] Fri, 21 May 2010 11:25 Go to previous messageGo to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
Allright, I got that working with the generated classes from the static profile. Thank you very much!
I've got another question regarding refinement-mode:
If I write a rule like that:

rule NoModel {
    from s : UML!Model
    to t : UML!Package (
       -- field copies omitted
    )
}

where Model inherits from Package, there is still a UML!Model element in the output model. It seems that the refinement mode looks, if the from-type is assignable to the the to-type and if so, just keeps the from-instance and modifies it. If this is the case, how can a model element of a subtype be transformed to an element of a supertype?

Thanks in advance,
Max
Re: [ATL] Applying stereotypes in refinement mode [message #535151 is a reply to message #534779] Fri, 21 May 2010 12:44 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
There are no delete possible in refining mode. When you transform a model into a package, you delete the model, then create the package. So it's impossible atm in refining mode.

Actually, the type of the first "to" element of a refining rule is not even taken into consideration.

To achieve that you can either use a normal transformation with an entire copy of UML2 or in refining :

rule NoModel {
from s : UML!Model
to t : UML!Model(
-- field copies omitted
),
t2 : UML2!Package(
)
}

and then add some EMF code after the transformation to finalize it (to delete the model for example).

If you chose the last option, you should consider studying the refiningTrace model produced by a refining Transformation.
To do that, just add a model refiningTrace conforming to RefiningTrace (you can find the ecore in the ATL dsl plugins I believe) as output to the transformation (you don't even need to declare it in the header). This model contains informations about the execution of the refining transformation and can be used to finalize the transformation.
Re: [ATL] Applying stereotypes in refinement mode [message #535185 is a reply to message #535151] Fri, 21 May 2010 13:46 Go to previous messageGo to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
Thanks for the insight! I'll try superimposition on the UML2Copy transformation fist, although this probably will be slower at runtime than refining and deleting.

Thanks again,
Max
Re: [ATL] Applying stereotypes in refinement mode [message #535207 is a reply to message #535185] Fri, 21 May 2010 15:00 Go to previous message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Max Bureck wrote on Fri, 21 May 2010 09:46
Thanks for the insight! I'll try superimposition on the UML2Copy transformation fist, although this probably will be slower at runtime than refining and deleting.

Thanks again,
Max

You'll probably have to also copy the stereotypes.
Previous Topic:how to transform the uml package with all its packagedElement
Next Topic:i++
Goto Forum:
  


Current Time: Wed Apr 21 15:38:51 GMT 2021

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

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

Back to the top