Skip to content
  Kermeta  

I got errors while translating an ecore to kermeta

Document Actions
Images
Figure 1. Metamodel with a dependency to Ecore.ecore Figure 1. Metamodel with a dependency to Ecore.ecore
Figure 2. Metamodel without dependency (Ie. declaring its own EDataType) Figure 2. Metamodel without dependency (Ie. declaring its own EDataType)

When translating an ecore file to Kermeta using the wizard, you can get the following error :

In http://www.eclipse.org/emf/2002/Ecore : CONSTRAINT-CHECKER: Operation
eGet is already implemented in the superclass EObject in the file
http://www.eclipse.org/emf/2002/Ecore.
In http://www.eclipse.org/emf/2002/Ecore : CONSTRAINT-CHECKER: Operation
eGet is already implemented in the superclass EObject in the file
http://www.eclipse.org/emf/2002/Ecore.
...


This is a normal message.

This message is due to dependencies between your ecore file to the Ecore.ecore file. (Ecore.ecore is also generally accessed though the following nsURI : http://www.eclipse.org/emf/2002/Ecore). As Ecore.ecore defines some attribute with the same name this cannot be converted to Kermeta without some fixes.

There are 3 solutions :

  • Make your metamodel independent of Ecore. Actually, when we quickly create an ecore file we reuse Ecore primitive types (for example, EBoolean, EString, EInteger, ...). Even, if this is correct, you are creating a link between yourmetamodel.ecore and Ecore.ecore and your metamodel is not self described (see figure 1. As the EDataType EString is defined in Ecore.ecore, you are creating a dependency to it) ! To make a clean metamodel, you have to define your own EDataType in your metamodel. For example, create an EDataType named "String" and with "instance type name" set to java.lang.String (see figure 2).  You can do the same for Boolean and Integer (java.lang.Boolean and java.lang.Integer)

Sometime this isn't enough (for example, if you use enumerations)

  • Use the quick fix option of the wizard. These quick fixes are available when clicking on "Next" instead of "Finish" in the wizard. It will automatically rename the conflicting operations and properties.
If this is still not enough (unlikely case which tend to say that your ecore file is really incorrect)
  • Use the checkbox "Write file even if there are errors" in the wizard

In the last two cases, you'll probably have to manually correct the generated kmt file.