| How to delete a model element of rule ? [message #1003957] |
Tue, 22 January 2013 05:23  |
Nicolas Fauvergue 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 09: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 09:57   |
Hugo Bruneliere Messages: 494 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 - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
|
|
|
|
Powered by
FUDForum. Page generated in 0.05804 seconds