Metamodel creation checklist
You are creating a metamodel and have troubles ? This short checklist may help you.
Kermeta uses EMF to load and store models and as EMF tools doesn't
really enforce the creation of correct metamodels, you may easily make
mistakes that leads to strange errors. We plan to provide a Model
Diagnostician that would help to correct those problems (see feature
request in the forge)
In the meantime, in order to help you, here is a checklist of point you should ensure:
- all the packages of your metamodel must have a ns_uri and ns_prefix.
This will help EMF to retreive the metamodel from your model. If you can indicate a real uri that's better. For example: platform:/resource/MyProject/<the/path/of/your/ecore/model.ecore/yourpackage
- use the "validate" function on the root packages of your metamodel. (see figure 1.)
- Advice
if you use EMF editors: All the classes should be contained (directly
or indirectly) by one of your metaclass. (For example you can create a
"Model" metaclass that contains all the metaclasses with no supertype
of your metamodel
- Verify that your sample model loads correctly in your workbench.
- If
you use the reflexive editor ("Create Dynamic Instance..." on the root
class in the ecore file) the editor must show both your instances and
the metamodel. see figures 2 and 3.
- If you use a generated editor (please also refer to the eclipse documentation on that subject) be sure that the correct version of the editor is available for the workbench that run your Kermeta code. Also remember that the runtime workbench doesn't have the same plugins as the normal workbench.
In complement, you should also have a look to our Kermeta EMF Tutorial and to its related resources (especially the articles on the Eclipse site).