eclipseeclipse-plugineclipse-emfmetamodel

How can I download the raw metamodels from my EMF registry?


I'm using Eclipse EMF in a project with MoDisco as a dependency.

I can access many different metamodels through the MoDisco Explorer, but I can only open them using the MoDisco browser. Is it possible to have access to the raw metamodels somehow? (all of them: Ecore files, XSD schemas, etc.)

I checked the MoDisco source code, but apparently, the metamodels are not stored there.

Example of what I want to do:

  1. Open the MoDisco Explorer

Screnshot of the Modisco Explorer with the "http://www.eclipse.org/emf/2002/Tree" selected

  1. Select some of the registered metamodels (e.g. http://www.eclipse.org/emf/2002/Tree)

  2. Open the raw file for this metamodel. I don't want to open the metamodel with any model explorer. Instead, I want access to the actual text (XML) file.

I know there are other ways to find the metamodels, but I am interested in this specific process. Is it possible?

The only similar question I found at SO is this one, but it's not the same problem.


Solution

  • I think you need to go programmatic about it. This does not seem too hard if you are familiar with the loading of EMF Resources.

    I would create a dummy plugin that programmatically accesses the registry of metamodel that MoDisco shows (not sure if this registry is specific to MoDisco or just the EMF one). This should basically give you a list of URIs of all the metamodels available on your platform.

    Then you can iterate on this list and for each URI, load the contents in a Resource which you then serialize into a local file or to the console.