Wrong output model structure [message #1850551] |
Tue, 08 March 2022 11:48 |
John Henbergs Messages: 239 Registered: October 2020 |
Senior Member |
|
|
Hi,
I have the following example, where the metamodel on the left is the source metamodel and the one on the right the target metamodel.
If I have the following source model:
University Harvard
-> Room 1-01
->Room 1-02
->Room 2-01
In the target model it should look like this:
University Harvard:
->Floor 1
-->Room 01
-->Room 02
->Floor 2
--> Room 03
Up until now I have the following mapping:
mapping University :: University2University() : University {
name:=self.name;
var Floor := object Floor Ob{
name := self. room.name.substringBefore("-");
room := self.room -> map Room2Room();
}
floor := FloorOb;
}
mapping Room :: Room2Room() : Room {
name := self.name.substringAfter("-");
}
However, there are two issues:
The first is in this line:
Quote: name := self. room.name.substringBefore("-");
Because I am trying to assign a sequence string to string. When I comment that out, and run the transformations, instead of the expected target model that I included at the beginning, I get:
University Harvard:
->Floor
-->Room 01
-->Room 02
-->Room 03
Could there be a solution for these two issues without changing the metamodels?
Thank you in advance!
[Updated on: Tue, 08 March 2022 11:48] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03405 seconds