Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Setting a tagged value with refining mode?
Setting a tagged value with refining mode? [message #896233] Tue, 17 July 2012 16:27 Go to next message
Martin Benedict is currently offline Martin BenedictFriend
Messages: 22
Registered: June 2012
Junior Member
I'm currently building a transformation chain. The last step should be to set some tagged values in my model. This should be done for a specific stereotype.

I tried to use the refining mode, but I have to realize, that the refining mode doesn't support do blocks.

My aim is to set a tagged value which represents a position with an increasing number (so I think I need a counter variable or something).

Could such a problem be formulated in a declarative way in ATL.
Here is the code I have tried, but it contains a do block. (code not working)

module postprocessing;


create OUT: UML refining IN: UML, PRO: UML, BDT: UML;

helper def: getStereotype ...

rule EnumerateProperties {
	from
		cl:UML!Class
	using {
		counter:Integer = 0;
		t:UML!Property = OclUndefined; 
	}
	to
		c2:UML!Class()
	
	do {
		for (a in cl.getAllAttributes()){
			t <- a;
			thisModule.debug(t.getAppliedStereotypes());
			if(t.isStereotypeApplied(thisModule.getStereotype('xsdElement')))){
				thisModule.debug('adding position ' + counter + ' to attribute ' + a.name + ' in class ' + cl.name);
				a.setValue(thisModule.getStereotype('xsdElement'), 'position', counter);
				counter <- counter + 1;
			
			}
			
		}
		
		
		
		
	}
}


Would be great if there are some advices. Thank you very much.

Martin
Re: Setting a tagged value with refining mode? [message #898448 is a reply to message #896233] Thu, 26 July 2012 12:03 Go to previous message
Ronan B is currently offline Ronan BFriend
Messages: 248
Registered: July 2009
Senior Member
Hi Martin,
I'm not a big fan of the refining mode but I do know you can address the stereotypes in your rules. Take a look at http://www.eclipse.org/forums/index.php/m/658674/. here we discuss using the stereotypes directly as the source and target rule patterns. This should help you a little.

If it doesn't then you can of course use the ATL UML2Copy.atl, see http://www.eclipse.org/forums/index.php/m/758267/ This makes everything possible Smile

Regards,
Ronan
Previous Topic:How to add option to ANT atl.saveModel?
Next Topic:Building/Compiling ATL Files With ANT And Maven
Goto Forum:
  


Current Time: Fri Nov 21 02:39:48 GMT 2014

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

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