Diff tool for Eclipse GMT Swallow models

Our task is to develop command line comparison tool for Swallow models. Swallow is a simple meta-model developed by Eclipse GMT open source project as an example of Model Driven Software Development approach. This example is described in details in "Template Programming for Model-Driven Code Generation" paper. You can see EMF class diagram of this meta-model below.

  • Swallow meta-model is defined using EMF Ecore and so is supported by current framework infrastructure.
  • Now, we load Swallow meta-model. We do it by adding needed jar files into the classpath. All needed libraries could be accesses from Eclipse GMT project.
  • We decide to use algorithm implementation based on "Difference and Union of Models" paper. This algorithm is provided with a framework, so we do not need to implement our own algorithm.
  • We implement Framework Caller using simple java class to access MetaDiff functionality.

To test the tool we borrow simple guest book application model described in paper mentioned above. Based on Swallow meta-model first version of Guest Book model was defined and then changes applied to that model. You can see tree representation of both models below. Following changes were done in the initial guest book model:

  • Rename Package "guestbook" to "gb"
  • Add new Attribute to "GuestBook" Class
  • Delete Attribute "text" from Class "GuestEntry"

Running created tool has given a result of following set of difference operations:

  • Create new element of type Attribute
  • Set the value of feature name of element Attribute from value "null" to new value = "name"
  • Set the value of feature name of Attribute with name "text" from value "text" to new value "null"
  • Set the value of feature name of Package from value "guestbook" to new value "gb"
  • Remove a link from element Class with name "GuestEntry" to feature with name "null"
  • Insert a link from feature Attribute of element Class with name "GuestBook" to Attribute with name "name"
  • Delete element Attribute with name "null"
Resources (Not yet added)
  • Swallow meta-model jars.
  • XMI files of Guest book model A and Guest book model B
  • Example diff tool source code