Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Applying Profile and Stereotypes in the Output Model
[ATL] Applying Profile and Stereotypes in the Output Model [message #642583] Wed, 01 December 2010 20:36 Go to next message
Pejman  is currently offline Pejman
Messages: 18
Registered: June 2010
Junior Member
Hi everyone,

I have two profiles (PA) and (PB). Each one has a single stereotype let say A and B. I want to simply transform an instance of PA to an instance of PB meanwhile transforming all instances of stereotype A to the instances of Stereotype B.
So I came up with the code below:

module T;
create OUT : MM1 from IN : MM; 

rule init {
	from s: MM! Package 
	to t: MM1! Package(
		name <- 'root')
do {
	t.applyProfile(OUT!Profile.allInstances()->select(p | p.name ='PB').first()); 
}
}
rule main{
from s: MM! Class(s.getAppliedStereotypes()->collect(st | st.name) ->at(1) ='A')
to t: MM1! Class(
	name<- 'Target' 
	)

do {
t.applyStereotype('PB::B');
}
	
}



It gives me the following exception

"org.eclipse.m2m.atl.core.emf.EMFModel cannot be cast to org.eclipse.m2m.atl.core.IReferenceModel"

Could anyone help.

Thanks in advance

[Updated on: Wed, 01 December 2010 20:36]

Report message to a moderator

Re: [ATL] Applying Profile and Stereotypes in the Output Model [message #644799 is a reply to message #642583] Tue, 14 December 2010 09:41 Go to previous message
Ronan B is currently offline Ronan B
Messages: 248
Registered: July 2009
Senior Member
Hi,
The first error I see in your code is that you are passing a String into the applyStereotype method. It expects a Stereotype type. See http://download.eclipse.org/modeling/mdt/uml2/javadoc/3.1.0/ org/eclipse/uml2/uml/Element.html and search for applyStereotype. Try getting a handle to the stereotype you wish to apply and passing that in instead.
Regards,
Ronan
Previous Topic:What happened to uml2ecore after OAW->Eclipse Migration?
Next Topic:[ATL] Transformation Problem in Helios
Goto Forum:
  


Current Time: Thu Oct 30 16:37:50 GMT 2014

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

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