Question

What is the easieset way to see that an ecore-model is the model of a metamodel. I'm not interested in OCL, just that the model is a concrete model derived from the metamodel. I want to do this using Sphinx or any other API in eclipse

Was it helpful?

Solution

myModel.eClass().getEPackage()

Gives you the package used for your current model, from there you can use the package registry to see if it matches the registered metamodel of your choice.

EPackage.Registry.eINSTANCE.values()

I would recommend checking this with the NsURI of the metamodel. If the code of the model has been normally generated with EMF, it will be fine since the NsURI is the unique identifier of the meta-model.

myModel.eClass().getEPackage().getNsURI()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top