Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Refining mode usage with UML Profile
[ATL] Refining mode usage with UML Profile [message #649746] Thu, 20 January 2011 14:11 Go to next message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,
I had hoped to refine a UML model that would change the stereotype on a Class A from Stereotype1 to Stereotype2. However, I see I cannot use a do block i.e. I need a do block to use applyStereotype, setValue etc. Is there any way to do this refinement?
Thanks,
Ronan
Re: [ATL] Refining mode usage with UML Profile [message #649749 is a reply to message #649746] Thu, 20 January 2011 14:18 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Even with imperative code, you'll be able to add the Stereotype2 but you won't be able to "remove" the Stereotype1 on the class as the refining mode can only add informations and not remove some.

You have another solution than the APIs though, you can use your profile as meta-model and then manipulate stereotypes as instances.

ex :
rule Stereotype1 {
from s : MyProfile!Stereotype1
to
t : MyProfile!Stereotype1(),
u : MyProfile!Stereotype2(
base_Class <- s.base_Class
)
}
Re: [ATL] Refining mode usage with UML Profile [message #649796 is a reply to message #649746] Thu, 20 January 2011 15:52 Go to previous messageGo to next message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi Sylvain,
That is a very good suggestion! I want to remove A and put on B. However,
when I try what you say I get an error in the ATL editor:

"MyProfile is not a source model"

My ATL header is

module Refine;
create OUT : UML refining IN : UML, MyProfile : UML;

and the ATL is as suggested...

rule Stereotype1 {
from s : MyProfile!Stereotype1
to
t : MyProfile!Stereotype1(),
u : MyProfile!Stereotype2(
base_Class <- s.base_Class
)
}

I get the same error with just the profile as the input model.

Any ideas?
Thanks,
Ronan
Re: [ATL] Refining mode usage with UML Profile [message #649808 is a reply to message #649746] Thu, 20 January 2011 15:56 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
With this mode, the profile isn't an input model, it's the meta-model in place of UML2 (in fact, as it references UML2, it becomes profile + UML2).

You'd then have this header :
module Refine;
create OUT : MyProfile refining IN : MyProfile;
Re: [ATL] Refining mode usage with UML Profile [message #649837 is a reply to message #649808] Thu, 20 January 2011 17:38 Go to previous messageGo to next message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi Sylvain,
Ah I see, of course! I should have figured that one out. Okay with that changed the transform run. However, the output is not as expected. In fact nothing gets updated. In the following I had expected all classes that had Stereotype A to now have Stereotype B and that the stereotype property valueA would be assigned a value from a stereotype property that was on A.

For example:

rule AToB
{
from
s : PRO!A
to
t : PRO!B
(
valueA <- s.valueX
)
}

I'm still running in refining mode. Am I missing something really obvious!?
Thanks,
Ronan
Re: [ATL] Refining mode usage with UML Profile [message #652552 is a reply to message #649808] Fri, 04 February 2011 14:14 Go to previous messageGo to next message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,
I'm just getting back to this now. Using ATL 3.1.1 this stereotype refining approach doesn't seem to work. I created a super simple profile with stereotypes A and B. I then have a model with a Class called Class1 with stereotype A applied. I then tell ATL to add stereotype B to this class using the following code.

module Refine;

create OUT : PRO refining IN : PRO;

rule AToAB
{
from
s : PRO!A
to
t : PRO!A(
),
u : PRO!B
(
base_Class <- s.base_Class.debug('s')
)

}

The output from ATL is the same as the input i.e. no change!

Note the debug('s) never shows int he console.

Any ideas?
Thanks,
Ronan
Re: [ATL] Refining mode usage with UML Profile [message #658674 is a reply to message #649808] Wed, 09 March 2011 13:01 Go to previous message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,
I have found the problem. My profile has a number of versions defined. This seems to cause the refining to fail as ATL thinks the stereotypes have been defined many times. Can you seen this behaviour?

I get an ATL warning:
Metamodel contains several classifiers with same name: A
Metamodel contains several classifiers with same name: Papy::A

To get refining working using a Profile as an in and out Metamodel you must delete the "older" defined EPackages from the profile. They reside inside an EAnnotation directly under the Profile construct. This beahviour also occurs in regular ATL mode using a Profile as an in and out Metamodel and refering directly to the stereotypes.

This is quite a serious issue as most/all profiles will have been defined many times before they are used in a refining context. Has anyone else noticed this?

I thought I'd also add some experience I have with refining.
1) You cannot use do blocks. This is a well known restriction.
2) Refining mode cannot remove stereotypes it can only add new Stereotypes. For example you cannot drop a stereotype and replace it with another.

I have tried the above using ATL 3.1.2 and 3.1.1 in Eclipse Helios, RSA 7.5.5.1 and Papyrus 1.1.2

Comments welcome!
Regards,
Ronan
Previous Topic:For loop in ATL
Next Topic:[ATL] Target model should have a reference to the source model
Goto Forum:
  


Current Time: Thu Mar 28 09:03:28 GMT 2024

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

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

Back to the top