EMF model-to-model

111 Views Asked by At

There are 2 EMF ecore models. Named lang.ecore and export.ecore. They are in general the same like. But export.ecore is in some aspects a little stripped down and some elements have a litte bit different semantics.

Now I have a loaded model of lang in memory and I want to create an export object tree, just in memory.

  • mapping equal-like elements
  • recreate references in the export model
  • customize different objects

Is there a way that I can efficiently do that while avoiding too much repetitive coding?

1

There are 1 best solutions below

0
Banoffee On

You could probably start your transformation by a step based on the reflexive APIs to "recreate" your source model into a destination model that is "mostly similar" just based on the names of your types and their features.

However if your metamodels are not that big I am not sure you would gain a lot of time, for a price in clarity/debugging.

Moreover, you want to consider whether your two metamodels will remain "generally alike" or if there is a chance they will evolve differently, or if your mapping will require you to divert from that path.