Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Profile and Stereotype Application in Target Model
[ATL] Profile and Stereotype Application in Target Model [message #693597] Wed, 06 July 2011 20:26 Go to next message
Philipp Zech is currently offline Philipp ZechFriend
Messages: 96
Registered: July 2009
Member
Hi,

I know that the question I'm going to ask already has been discussed
several times, yet I could not find a working solution in the newsgroups
or forums.
I'm quite a newbie to ATL an as already indicated in the subject matter,
I'm currently attempting to generate a target model from a source model
by using the refining execution mode. In the target model, during the
transformation I want to apply a profile and various stereotypes to the
elements copied from the source model. Below please find an excerpt of
my ATL code (additional rules, producing the same error, have been omitted):


-- @nsURI UML=http://www.eclipse.org/uml2/2.1.0/UML
-- @path RMProfile=/sampleATL/profile/RMProfile.profile.uml


module riskAnalysis;
create OUT: UML refining IN: UML, PRO : RMProfile;


-- HELPERS --

--none so far


-- RULES --

rule applyProfile {
from
sourceModel : UML!Model
to
targetModel : UML!Model (
name <- sourceModel.name
),
st_profile : PRO!RM (
base_Model <- targetModel
)
}


rule profileInterfaces {
from
interface : UML!Interface
to
vulnerableInterface : UML!Interface (
),
st_vulnerableInterface : PRO!VulnerableInterface (
base_Interface <- vulnerableInterface
)
}

Some explanations on my code:

Both, the input and output model are from type UML, yet, the output
model also applies the profile "RMProfile", defining the above mentioned
stereotypes. As done in the Relational2UML example, I add my profile
(PRO : RMProfile) to later on access its stereotypes and apply them in
the target model during the transformation. The rule "applyProfile" is
intended to apply the profile itself to the target model, whereas
"profileInterfaces" adds the stereotypes to various copied model
elements (in this case UML2 interfaces) of the target model.
The stereotypes are set according to the explanation from
http://www.eclipse.org/forums/index.php?t=msg&goto=539795&S=9115fac6ca5ad6c93267129ecb8cc17b#msg_539795.

However, if executing the above ATL file I get the following exception:

org.eclipse.m2m.atl.engine.emfvm.VMException:
org.eclipse.m2m.atl.core.emf.EMFModel cannot be cast to
org.eclipse.m2m.atl.core.IReferenceModel.

Yet, no specific line number in the ATL file is mentioned. However,
removing various pieces from the code reveals that the exception is
thrown, as soon as a type, defined in the profile (PRO), is accessed,
i.e., "st_profile : PRO!RM" and "st_vulnerableInterface :
PRO!VulnerableInterface" ("RM" is the name of the profile itself as
defined inside the UML2 file under the properties of the concrete
instance of the UML2 element "Model", VulnerableInterface is a defined
stereotype, applicable to UML2 interfaces).

As all the discussions in the forums and newsgroups somehow didn't
reveal an answer (if I missed something I'm sorry) I again ask the
question, how to apply a profile and stereotypes during a transformation
to a target model, generated from a source model in refining execution mode?

Thanks a lot for your help!

Cheers,

PHilipp
Re: [ATL] Profile and Stereotype Application in Target Model [message #693767 is a reply to message #693597] Thu, 07 July 2011 07:24 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
try :
module riskAnalysis;
create OUT: RMProfile refining IN: RMProfile;


-- HELPERS --

--none so far


-- RULES --

rule applyProfile {
from
sourceModel : RMProfile!Model
to
targetModel : RMProfile!Model (
name <- sourceModel.name
),
st_profile : RMProfile!RM (
base_Model <- targetModel
)
}


rule profileInterfaces {
from
interface : RMProfile!Interface
to
vulnerableInterface : RMProfile!Interface (
),
st_vulnerableInterface : RMProfile!VulnerableInterface (
base_Interface <- vulnerableInterface
)
}
Re: [ATL] Profile and Stereotype Application in Target Model [message #693834 is a reply to message #693767] Thu, 07 July 2011 09:20 Go to previous message
Philipp Zech is currently offline Philipp ZechFriend
Messages: 96
Registered: July 2009
Member
On 07/07/2011 09:24 AM, Sylvain EVEILLARD wrote:
> try :
> module riskAnalysis;
> create OUT: RMProfile refining IN: RMProfile;
>
>
> -- HELPERS --
>
> --none so far
>
>
> -- RULES --
>
> rule applyProfile {
> from
> sourceModel : RMProfile!Model
> to
> targetModel : RMProfile!Model (
> name <- sourceModel.name
> ),
> st_profile : RMProfile!RM (
> base_Model <- targetModel
> )
> }
>
>
> rule profileInterfaces {
> from
> interface : RMProfile!Interface
> to
> vulnerableInterface : RMProfile!Interface (
> ),
> st_vulnerableInterface : RMProfile!VulnerableInterface (
> base_Interface <- vulnerableInterface
> )
> }
Hi Sylvain,

thanks a lot for your hint. It worked!

Cheers,

Philipp
Previous Topic:[ATL] Launch atl transformations programmatically
Next Topic:[ATL] getValue on ATL Map returns OclUndefined
Goto Forum:
  


Current Time: Thu Apr 25 22:53:42 GMT 2024

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

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

Back to the top