Passer au contenu
  Projet Triskell  

Using the Pruner

Document Actions
Here we learn the usage of the meta-model pruner.

Setting up the input meta-model


1. The input meta-model in ecore format must be placed in the input directory

2. We must generate a Kermeta model (input.km) from the input ecore file (input.ecore)

3. Right click on ecore file (input.ecore). Go to Kermeta->Generate KMT

Note:

If an error is reported perform the generation even with the errors. The error is usually due to use of operation overloading (not supported in Kermeta).

Open the Ecore.kmt file remove one occurence of a repeated operation. Normally there are three such operaitons.

Open input.kmt and replace the line require "http://www.eclipse.org/.../Ecore" to require "Ecore.kmt" such that it refers to the corrected kmt.

4. Right click on input.kmt. Go to Kermeta -> Generate Kermeta model km file.


Editing the meta-model pruner


1. Open src/metamodelPruner.kmt

2. Goto operation initializeRequriedClasses() in Class Main

3. Add the textual names of classes and properties that are "interesting" or "required"

For example,

Classes:

    self.reqClasses.add(self.getReqClass("Class"))
    self.reqClasses.add(self.getReqClass("Property"))

Properties:

    self.reqProperties.add(self.getReqProp("name","NamedElement"))

4. Change the input meta-model directory. Go to operation main() of Class Main

Edit self.prune("platform:/resource/MetamodelPruner/input/input.km")


5. Change output meta-model directory. Go to operation prune() of Class Main

Edit metamodelPruner.save("platform:/resource/MetamodelPruner/output/output.km")


6. Run the program as a Kermeta application. Right click -> Run As-> Run As Kermeta Application


7. The output is store in MetamodelPruner/output/


8. The output can be transformed back to Ecore. Right Click on output.km -> Kermeta -> Generate Ecore


9. Output ecore model is saved in the MetamodelPruner/output/


10. The resulting Ecore model output.ecore contains all required classes and its mandatory dependencies. Feel free to play with the options in the Kermeta program to prune in different ways.