//Here you can import some libraries, in which you can define auxiliary maps and/or queries import ExampleQVTLibrary; // these are the model A requirements modeltype A "strict" uses testA('http://dim.de/testA'); // these are the model B requirements modeltype B "strict" uses testB('http://dim.de/testB'); transformation ExampleQVTMap(in modelA:A, out modelB:B); /* /In the main() you need to specify which kind of objects you want to map from model A to model B. /In the example below we are saying to take all the object of class ClassInModelA of the model A and to map them /to model B through the map toModelB(), which is defined below. */ main() { modelA.rootObjects()[A::PersonA]->map toModelB(); } /* /Here you specify what the map toModelB() does. The syntax is always the same as here. In the map body you link /the attributes in model B to the ones in model A. The notation self refers to the model A. /With the . you map one element of A into one element of B. With -> instead you map all elements of A into all elements /of B (use this for lists of objects). When the two properties you need to map are not of the same type you could use a /query to map them (see in the library). */ mapping A::PersonA::toModelB() : B::PersonB { firstNameB := self.firstNameA; lastNameB := self.lastNameA; contactsB := self.contactsA->map toContactList(); }