[QVTO]Clone Operation [message #103052] |
Tue, 07 April 2009 19:33 |
Eclipse User |
|
|
|
Originally posted by: mariam.xxxxx.xxx
Hi,
I am starting to learn how to use qvto to write some transformations. I
want to use the clone and deepclone methods to copy an existing model
(source)to another model (target) without overwriting the target model.
I tried using the deepclone method and it works just fine, but the problem
i am facing is that it erases the target model and overwrite it completly.
here is how my transformation look like:
============================================================ =
transformation m2m(in source:UML,inout target:UML);
main(){
--here I specify where exactly I want the model to be copied.
-- which is inside package pack1 in target model
target.objectsOfType(Package)[name='Pack1']->map addModel();
}
mapping inout Package::addModel()
{
init{
--here I specify which package in the source model I want to copy
-- which is pack2.
var a:=source.objectsOfType(Package)![name='pack2'];
a.deepclone().oclAsType(Class);
}
}
============================================================
when I run this transformation the target model is overwritten with the
source model. What am I doing wrong!! how can i modify this to make the
source model appended to the target model.!!
|
|
|
|
Powered by
FUDForum. Page generated in 0.03546 seconds