Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » creating a RULE just to rename a ClassUNIT
creating a RULE just to rename a ClassUNIT [message #1421444] Thu, 11 September 2014 11:23 Go to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Hello,


i'm new to ATL so sorry for any dumb questions. First let me contextualize what I like to do. I'm working with an instance of the KDM, which was generated by MODisco. I would like to use this instance of KDM and create a rule in ATL to rename an specifies ClassUnit. I tried the code below. But the this code runs and creates a separate ClassUnit excluding all other elements of the KDM.


-- @nsURI MM=http://www.eclipse.org/MoDisco/kdm/code
-- @nsURI MM1=http://www.eclipse.org/MoDisco/kdm/code

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

rule renameClass { 
	from
		s : MM!ClassUnit (s.name = 'Client')
	using {
	newName : String = 'newName';
}	
		to 
		t : MM1!ClassUnit (
			name <- newName
		)

}



Does anyone know how to rename a element (ClassUnit) and just keep the other without change after the transformation?

Could you show me a basic example?

Thank you so much.




[Updated on: Thu, 11 September 2014 11:28]

Report message to a moderator

Re: creating a RULE just to rename a ClassUNIT [message #1422172 is a reply to message #1421444] Fri, 12 September 2014 12:34 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Any suggestion?
Re: creating a RULE just to rename a ClassUNIT [message #1422240 is a reply to message #1422172] Fri, 12 September 2014 14:42 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 606
Registered: September 2012
Location: Belgium
Senior Member

Sounds like you want to use refining mode:
https://wiki.eclipse.org/ATL/User_Guide_-_The_ATL_Language#ATL_Refining_Mode


Cheers,
Dennis
Re: creating a RULE just to rename a ClassUNIT [message #1424218 is a reply to message #1422240] Mon, 15 September 2014 17:03 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Thanks Dennis, I didn't know about it. I gonna try it out then I let you know if it worked. Thanks again.
Re: creating a RULE just to rename a ClassUNIT [message #1424239 is a reply to message #1424218] Mon, 15 September 2014 17:49 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Hello again Dennis, I tried what you told me. However, when I execute the source code below I get an empty XMI. My launch configuration is attached. Can you please help me out? THanks again have a good one.




-- @nsURI MM=http://www.eclipse.org/MoDisco/kdm/code
-- @nsURI MM1=http://www.eclipse.org/MoDisco/kdm/code

module teste;
create OUT : MM1 refining IN : MM;

rule renameClass { 
	from
		s : MM!ClassUnit
		
		to 
		t : MM1!ClassUnit (
			name <- 'NewName'
		)

}





Re: creating a RULE just to rename a ClassUNIT [message #1424268 is a reply to message #1424239] Mon, 15 September 2014 18:45 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 606
Registered: September 2012
Location: Belgium
Senior Member

The metamodels have to be the same for the input and output model:

create OUT : MM refining IN : MM;


Cheers,
Dennis
Re: creating a RULE just to rename a ClassUNIT [message #1424297 is a reply to message #1424268] Mon, 15 September 2014 19:41 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Hello Dennis, I did what you told me but it didn't work. When I put -- @atlcompiler emftvm on the ATL file I get I error saying "Errors occurred during the build.". I don't know what to do anymore, can you please send me a basic example of "refining model" with ATL, that would be great.

Thank you.
Re: creating a RULE just to rename a ClassUNIT [message #1424306 is a reply to message #1424297] Mon, 15 September 2014 19:59 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Dennis I made the followings steps, but it didn't work......

1 - I installed ATL/EMFTVM..
2 - Then I put -- @atlcompiler emftvm on the head of my ATL file, but it always get an error..
3 - Then I set up the ATL/EMFTVM launch as shown in the attached picture
4 - Then when I ask it to run I get the following message "org.eclipse.m2m.atl.emftvm.util.VMException: Error during module loading: Module rename not found"


[code]
-- @atlcompiler emftvm
-- @nsURI MM=http://www.eclipse.org/MoDisco/kdm/code

module rename;
create OUT : MM refining IN : MM;

rule renameClass {
from
s : MM!ClassUnit (s.name = 'Client')
using {
newName : String = 'newName';
}
to
t : MM!ClassUnit (
name <- newName
)


}
[\code]

Does I need to use the -- @atlcompiler emftvm???

Thanks
Re: creating a RULE just to rename a ClassUNIT [message #1424871 is a reply to message #1424306] Tue, 16 September 2014 14:36 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 606
Registered: September 2012
Location: Belgium
Senior Member

You don't have to use EMFTVM per sé, but it should definitely work. Unfortunately, I cannot see your attachment with the launch config. I've attached a zipped test Eclipse project that shows how to use EMFTVM for this scenario. Let me know if that works for you!
  • Attachment: atl-test.zip
    (Size: 2.36KB, Downloaded 138 times)


Cheers,
Dennis
Re: creating a RULE just to rename a ClassUNIT [message #1425027 is a reply to message #1424871] Tue, 16 September 2014 19:25 Go to previous message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Thanks Dennis, it works Very Happy
Previous Topic:atl transformation
Next Topic:Problem with ATL transformation BPMN2PN
Goto Forum:
  


Current Time: Wed Sep 25 05:49:15 GMT 2024

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

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

Back to the top