Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » How to add new model elements in refining mode
How to add new model elements in refining mode [message #1424771] Tue, 16 September 2014 11:47 Go to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Hello guys, I was interested in create a new model elements in refining model... I was searching and I was able to found that I should use the "including" instead of "newInstance()". As can be seen in the source code bellow the first including works pretty good. However, when I need to create another element inside of the earlier created I got an error message like this: org.eclipse.m2m.atl.engine.emfvm.VMException: Feature codeElement does not exist on Element

What am I doing wrong? Can someone help me? Thanks in advance.


module testingAllURI;
create OUT : build, OUT1 : code, OUT2 : conceptual, OUT3 : core, OUT4 : data, OUT5 : event, OUT6 : kdm, OUT7 : plat, OUT8 : source, OUT9 : structure, OUT10 : ui, OUT11 : action refining IN : build, IN1 : code, IN2 : conceptual, IN3 : core, IN4 : data, IN5 : event, IN6 : kdm, IN7 : plat, IN8 : source, IN9 : structure, IN10 : ui, IN11 : action;


rule addClassToPackage {
	
	from 
		source : code!Package (source.name = 'testelucas')
	to
		target: code!Package (
			codeElement <- source.codeElement->including(newClassUnit) //here it works
		
		),
		newClassUnit: code!ClassUnit (
			
			name <- 'theNameOfTheClasse',
			codeElement <- newClassUnit.codeElement->including(newStorableUnit)//I got the error here....
		
		),
		newStorableUnit: code!StorableUnit (
			
			name <- 'theAttribute'
		
		)
		

}

Re: How to add new model elements in refining mode [message #1424876 is a reply to message #1424771] Tue, 16 September 2014 14:47 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

"newClassUnit" is a new element: newClassUnit.codeElement will be empty, so you should not write the "including" code, but "Sequence{newStorableUnit}" instead.

In ATL, you should not read properties of a "to" element, only the "from" elements are readable.


Cheers,
Dennis
Re: How to add new model elements in refining mode [message #1424958 is a reply to message #1424876] Tue, 16 September 2014 17:07 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Dennis Wagelaar wrote on Tue, 16 September 2014 10:47
"newClassUnit" is a new element: newClassUnit.codeElement will be empty, so you should not write the "including" code, but "Sequence{newStorableUnit}" instead.

In ATL, you should not read properties of a "to" element, only the "from" elements are readable.



Thanks Dennis it works like a charm Razz
Re: How to add new model elements in refining mode [message #1424974 is a reply to message #1424958] Tue, 16 September 2014 17:34 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Although it worked, I would like to create a helper for every time create a storableUnit. What is better way to do this? I mean, I would like just to call something like this thisModule.createStorableUnit(theNewName....)
Re: How to add new model elements in refining mode [message #1425032 is a reply to message #1424974] Tue, 16 September 2014 19:35 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

that would be a lazy rule.

Cheers,
Dennis
Re: How to add new model elements in refining mode [message #1425042 is a reply to message #1425032] Tue, 16 September 2014 19:49 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
I've tried it out.. however I just found that lazy rules are not accepted in refining model. Thus, what is the best way in this case?


Thanks a lot.
Re: How to add new model elements in refining mode [message #1425344 is a reply to message #1425042] Wed, 17 September 2014 07:03 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

I just read the section that even atl2010 does not support lazy rules in refining mode. You can use EMFTVM then, which does support lazy rules in refining mode.

Cheers,
Dennis
Re: How to add new model elements in refining mode [message #1425569 is a reply to message #1425344] Wed, 17 September 2014 13:49 Go to previous message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
Registered: September 2012
Member
Thanks a lot Very Happy
Previous Topic:ATL Debug Mode Working?
Next Topic:Transform messages to List or Tree
Goto Forum:
  


Current Time: Thu Apr 25 11:40:39 GMT 2024

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

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

Back to the top