Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Model-to-Model Transformation » Multiple to One model Transformation In QVTO (Transforming two model instances into a single model instance )
Multiple to One model Transformation In QVTO [message #1235028] Thu, 23 January 2014 11:34 Go to next message
Ben Haldo is currently offline Ben Haldo
Messages: 6
Registered: October 2013
Junior Member
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 11:48]

Report message to a moderator

Re: Multiple to One model Transformation In QVTO [message #1235044 is a reply to message #1235028] Thu, 23 January 2014 12:27 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4097
Registered: July 2009
Senior Member
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?
Previous Topic:Any API for implementing M2M transformation in Java?
Next Topic:XML to XMI transformation with mapping between Ecore and XSD
Goto Forum:
  


Current Time: Fri Oct 24 17:07:13 GMT 2014

Powered by FUDForum. Page generated in 0.01656 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software