[QVTo] Created Objects don't appear in their right position [message #516575] |
Wed, 24 February 2010 07:49  |
Eclipse User |
|
|
|
Hi all,
I am trying to transform a metamodel M1 in an other one, M2.
To simplify the metamodel, let's just say that a class C1 in M1 can be updated. It contains 0..1 updates.
This update class Update1 contains 1..* variables (to be updated) and 1..* expressions.
C1:

The class C2 (which will be transformed from C1) can be updated as well, but contains 0..* updates. This update class, Update2, just contains 1 variable and 1 expression.
C2:

In my transformation, I transform the Update1 Class which returns a set of Update2 classes (remember, the Update1 class contains ALL updates while Update2 just updates a single variable).
Updates := self.Updates.map toUpdates2();
--
mapping Update1::toUpdates2() : OrderedSet(Update2) {
--Count the VariableExpressions. For each one, create an object and add it to result.
var NewUpdate: Update2;
NewUpdate := object Update2 {
--Some Attributes that I didn't show. These need to be mapped too.
};
result += NewUpdate;
}
The above code actually generates objects, but puts them not in the right place (i.e. as child of the C2 Class), but on the same level als the C2 class (so, as siblings).
Why does this happen?
---
Another question just came to my mind, can somebody give an example of a post-condition for a mapping? I mean the "where" clausule. In the official MOF QVT document it is mentioned, but there are no examples.
Two more yes/no questions:
- Is the exception bug (from xmap) already fixed? http:// www.eclipse.org/forums/index.php?t=msg&th=161599&sta rt=0&
- I came accross a topic about a function like allSubobjectsOfType. Somebody stated that when using this function, the order of the objects (as in the model) is not maintained, is this already solved? I cannot find the topic at the moment...
Thanks a lot
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08093 seconds