[ATL] Profile and Stereotype Application in Target Model [message #693597] |
Wed, 06 July 2011 20:26 |
Philipp Zech 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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03484 seconds