edit this page - page history - about editing


EMF is the Eclipse Modelling Framework. It is based on the Ecore metamodelling language. Also have a look at GMF for the Graphical Modelling Framework. Also see openArchitectureWare.
  1. Combine Multiple Ecore Models Together
  2. Using EOpposite in GMF
  3. Getting IDs on EMF model elements
  4. Using XPath to find EMF elements
  5. Improving EMF Model Loading Performance
  6. Loading EMF XSD Models at Runtime
  7. Dynamic Templates in EMF
  8. Extending Ecore to define a new M3
  9. Resolving Proxy EMF Elements
  10. EMF Validation Framework
  11. Other pages tagged as "emf"

Upper Bound in EMF

To set the upper bound of an association to unbounded/unlimited, instead of using "*" or "many" or "n", use "-1". Roll Eyes

Convert ecore_diagram to ecore

It doesn't appear that you can export an ecorediagram file to an ecore file, but that's because the ecorediagram file is already based on an existing ecore file. For example, editing the default.ecore_diagram file automatically updates default.ecore with the model changes.

Convert ecore to xsd/XML Schema

  1. Right click on the .genmodel and select Export Model, and you should be able to export it there.
  2. If you set Model > Generate Schema to true in the .genmodel, the XSD files will be automatically generated when you Generate Model Code. (ref)
  3. If you get the message that no model exporters exist, try installing the XSD features from Eclipse. (ref)

Meaning of Ecore Attributes

  1. Volatile means that no variables/fields are generated and you will write all the accessor methods by hand. (ref)
  2. Transient means it will not be serialized, i.e., it's not persistent. (ref)
  3. Derived features are assumed to be computed from other features and hence are typically transient as well. Derived features are not copied by EcoreUtil.copy. (ref)
  4. Resolve Proxies means, at least, that if the model element is moved into a new resource (model file), the eContainer will be preserved. (ref)


  1. org.eclipse.emf.ecore.provider.EcoreEditPlugin: part of the org.eclipse.emf.ecore.edit plugin.
  2. org.eclipse.emf.codegen.ecore.genmodel.provider.GenModelEditPlugin: part of the org.eclipse.emf.codegen.ecore.ui plugin.

EMF Documentation annotations

To add documentation to your generated EMF classes, add an EAnnotation with the following details:

Source: http://www.eclipse.org/emf/2002/GenModel

And to this EAnnotation, add a details entry:

Key: documentation
Value: Any documentation you'd like included

If you want to access this information at runtime (e.g. EClass.getEAnnotation) you will need to set Model > Suppress GenModel Annotations in your .genmodel to true.

Cannot create a resource for XXX; a registered resource factory is needed

I got this message while developing a JUnit Plug-in Test for Eclipse. You can either register an external Resource factory, or if your source model is using XMI, you can just add the org.eclipse.emf.ecore.xmi plug-in as a dependency of your current plugin.

Extending Ecore

I had an interesting experience trying to extend another Ecore model: in particular, I was trying to define a MyClass extends Custom, which was loaded from another Ecore model in the environment.

The generating implementation class file was extending EObjectImpl and not CustomImpl, meaning that a lot of fields were duplicated and some operations were not implemented, as they were in CustomImpl.

The problem was that my object was extending other objects. Only the first element is used as the base class for the implementation class. Moving Custom as the first superType meant that MyClassImpl extended CustomImpl and not EObjectImpl.
Categories: Technology
edit this page - what links to here? - page history - top
Last edited by jevon jevon 48 months ago