[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.m2m] [QVTO] Problems with resolve and update
|
Hi,
I seem to 'loose' elements if I modify them after I retrieved them with
resolve.
In the following program I would expect that mp.packagedElement contains a
class, but that is not the case.
Is this a bug or a feature?
Thanks for any help,
Kurt
modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';
transformation updateTest();
mapping main() {
init {
this.runTest();
}}
query OclAny::runTest() : OclVoid {
var o := object UML::Class { name := 'myClass'; };
var p := object UML::Package { packagedElement += o; };
p.map copyPackage();
o.map copyClass();
var mp := p.updatePackage();
o.name := 'yourClass';
log('package', mp.packagedElement.name);
return null;
}
mapping UML::Package::copyPackage() : Package { }
mapping UML::Class::copyClass() : Class { }
query UML::Package::updatePackage() : Package {
var x := self.resolveone(Package);
x.packagedElement :=
self.packagedElement.resolveone(PackageableElement)->asSet();
return x;
}