Ecore.ecore using EcoreTools

Posté le dans Blog

A few weeks ago I ended up on the following thread on the EMF Forum asking for Ecore meta-model formal documentation?. Ed pointed at some documentation which includes diagrams done with great care but done with tools from another era.

As the maintainer of EcoreTools I had to do something about it, and so I did:

All participants in the Ecore Modeling Framework implement the EObject's interface

Tadaa!

The following diagrams have been created thanks to EcoreTools which is part of the Eclipse Modeling Package. All the hard work has been done earlier by Ed when he had to decide what to display and how, all I did is reproduce those using EcoreTools and exporting those at a fairly high resolution (click on the images to get the full resolution).

The corresponding patchset for EMF is here.

But beside this anecdotic action there is something interesting and more general in how these diagrams are presenting the Ecore.ecore model.

Ecore Components

Ed starts by diagramming the type hierarchy, without any other information (attributes or references). And at least in the case of Ecore but in am sure it is true in the general sense, this gives a very good introduction to a domain model: only starting with the types it defines.

The Ecore components are related according to this hierarchy

To construct such a diagram using EcoreTools import all the EClasses in it and then enable the following filters:

Filters in EcoreTool

You can also enable the Constraints layer which gives a bit more information about what makes those types valid.

Layers in EcoreTool The hiearchy + the specific constraints

Here is a general diagram highlighting the references and attributes. It might look a bit crowded at first but it is filled with information. You can get and understand how all of the primary aspects of Ecore are working just using this diagram.

The Ecore Components have the following relations, attributes, and operations

for this kind of diagrams you really want to know a few keyboard shortcuts, among others:

Hide element + ->doc
Hide label + ->doc
Remove Bendpoints + + ->doc

You’ll find all the keyboard shortcuts in Mélanie’s excellent blog post.

Generics

The next diagram focuses on how Generics are modeled in Ecore and does a fairly good job in describing it by hidding all the other aspects.

Ecore supports generics as follows

More important: this was not displayed at all in the previous diagram and that is a good thing as one don’t need to understand this specific point to leverage Ecore.

Java Language Types

The last diagrams are enumerating datatypes.

Ecore defines the data types for the following Java language types

For these kind of diagrams with many un-connected shapes your best friends are the Make same size, Distribute and Align actions.

Make same size Align Distribute

External Types

Ecore defines following additional data types

So now, who wants a nice poster in the office ?

Ecore.ecore using EcoreTools was originally published by Cédric Brun at CTO @ Obeo on May 18, 2016.

Auteur d'origine: Cédric Brun
Mots clés: obeodesigner