Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVT] Replacing entities in a transformation
[QVT] Replacing entities in a transformation [message #723327] Thu, 08 September 2011 10:54
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 209
Registered: June 2010
Senior Member
Hi,

I'm looking for an elegant way to replace entities of a certain type by entities of another type.

Assume that my meta model contains a class Animal and subclasses named Ape and Bear. Let's start with a model containing Animals (Animals, no specific types like Ape or Bear). Based on some computation I'm able to detect that certain Animals need to become Ape and others need to become Bears. A model transformation should do the trick. However, how am I going to tackle this without reconstructing the whole model tree.

Very loosely written, I would like to do something like:

inModel.rootObjects()->deepclone()
outModel->objectsOfType(Animal)->select(computation) -> foreach(b) { 
   b:= object Bear {
      ...
   }
outModel->objectsOfType(Animal)->select(other_computation) -> foreach(b) { 
   b:= object Ape {
      ...
   }


Obviously, the above is not going to work. However, what would be the most elegant way to make it work?

It is clear that, in order to respect the metamodel, I'm only allowed to replace an object by another object that has either the same type or a subtype of it. Furthermore, I need to find all other entities that refer to the object to be replaced and updated the references....

Any ideas?

Greetings,
Wilbert.

[Updated on: Thu, 08 September 2011 10:54]

Report message to a moderator

Previous Topic:[QVTo] Standalone transformation
Next Topic:ATL : Reference to a target class using a different rule
Goto Forum:
  


Current Time: Fri Apr 26 03:56:56 GMT 2024

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

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

Back to the top