Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » How to delete a model element of rule ?
How to delete a model element of rule ? [message #1003957] Tue, 22 January 2013 10:23 Go to next message
Nicolas Fauvergue is currently offline Nicolas FauvergueFriend
Messages: 5
Registered: January 2013
Junior Member
Hi all,

I am developing an ATL plug-in and i have a problem.
This is the following :

In fact i create an output model element from an input model element and in some cases, this output element musn't be created.

For the moment, i succeed to recognize if i have to delete this element or not by this following implementation :

helper def : lastNode : tc463!NodeType = OclUndefined;

rule Step{
	from
		step : tc50!Step
	to
		node : tc463!NodeType(
			transition <- transition463
		),
		transition463 : tc463!TransitionType(
			x <- step50.x;
		)
	do{
                if(thisModule.lastNode.oclIsUndefined()){
			thisModule.lastNode <- node463;
		}else{
			if(thisModule.lastNode.id = node463.id){
				thisModule.lastNode.transition <- node463.transition;
				--I have to delete node463 here
			}else{
				thisModule.lastNode <- node463;
			}
		}
        }
}


I tryed to delete this element by affect "OclUndefined" to this element but it didin't work.

Have you an idea to make this action ?

Thank you a lot in advance.

Nicolas

[Updated on: Tue, 22 January 2013 14:12]

Report message to a moderator

Re: How to delete a model element of rule ? [message #1004088 is a reply to message #1003957] Tue, 22 January 2013 14:57 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Hello,

In regular transformations (i.e. when the input and output metamodels are different), you don't need to "delete" elements as you are only creating new elements into the target model (initially empty).
In your current example, you should probably add a guard to the input pattern of your rule in order to match it (and thus create the corresponding model element) only when required.
I encourage to take a look to the ATL user guide to get more insights on this.

Best regards,

Hugo


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: How to delete a model element of rule ? [message #1004130 is a reply to message #1004088] Tue, 22 January 2013 16:19 Go to previous message
Nicolas Fauvergue is currently offline Nicolas FauvergueFriend
Messages: 5
Registered: January 2013
Junior Member
Thank you.

In fact, i just have to reorganize my document and use lazy rulse to have a better solution.

Best regards,

Nicolas
Previous Topic:The class 'VisitableCS' is not a valid classifier
Next Topic:Finanzverwaltung von Vereinen
Goto Forum:
  


Current Time: Tue Apr 16 12:43:04 GMT 2024

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

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

Back to the top