Multiple to One model Transformation In QVTO [message #1235028] |
Thu, 23 January 2014 06:34  |
Eclipse User |
|
|
|
I have posted this in another Eclipse forum, I'm posting it here because I couldn't get an answer.
I am trying to learn model transformation using QVTO. I have two simple source models (VehicleMM , DriverMM )each with a single class and a single attribute. My target metamodel (CarMM )has also one class but has two attributes. I want to transform the attributes of the source models to the attributes of target model. Putting it simply, I want to do a multiple models to a single model transformation in QVTO.
So far I managed to write a transformation like this:
transformation VehitoCar(in vehiSource:VehicleMM, out carTarget:CarMM);
main() {
vehiSource.rootObjects()[Vehicle] . map vehi2Car( ????? );
}
mapping Vehicle::vehi2Car(driverInst:Driver):Car{
brand := self.brand;
driver := driverInst.drivName;
}
I couldn't figure how to instantiate the Driver model to pass it to the vehi2Car mapping. I mean what kind of construct should be placed in place of ????? Any ideas on how to achieve this? Or Is there another way to solve this problem?
[Updated on: Thu, 23 January 2014 06:48] by Moderator
|
|
|
Re: Multiple to One model Transformation In QVTO [message #1235044 is a reply to message #1235028] |
Thu, 23 January 2014 07:27  |
Eclipse User |
|
|
|
Answer on qvto newsgroup.
On 23/01/2014 11:34, Ben Haldo wrote:
> I have posted this in another Eclipse forum, I'm posting it here
> because I couldn't get an answer.
> I am trying to learn model transformation using QVTO. I have two
> simple source models (VehicleMM , DriverMM )each with a single class
> and a single attribute. My target metamodel (CarMM )has also one class
> but has two attributes. I want to transform the attributes of the
> source models to the attributes of target model. Putting it simply, I
> want to do a multiple models to a single model transformation in QVTO.
>
> So far I managed to write a transformation like this:
>
>
> transformation VehitoCar(in vehiSource:VehicleMM, out carTarget:CarMM);
>
> main() {
> vehiSource.rootObjects()[Vehicle] . map vehi2Car( ????? );
> }
>
> mapping Vehicle::vehi2Car(driverInst:Driver):Car{
>
> brand := self.brand;
> driver := driverInst.drivName;
> }
>
> I couldn't figure how to instantiate the Driver model to pass it to
> the vehi2Car mapping. I mean what kind of construct should be placed
> in place of ????? Any ideas on how to achieve this?
|
|
|
Powered by
FUDForum. Page generated in 0.10350 seconds