Skip to content
  Kermeta  

Kermeta 1 to Kermeta 2 migration guide

Document Actions
This document describes the most usual points that need to be changed when migrating a Kermeta 1 program to Kermeta 2.

The document is organised in tables highlighting the differences between a typical kermeta 1 code and its equivalent in kermeta 2. It should cover all most common migration cases. (More complex cases migth find their answer in this other document )

1/ Create a yourProject.kp

All the "require" that you had all over  in your kmt files must be gathered into one *.kp file.

An unfinished wizard can help you create your first kp file from your main kermeta 1 kmt file.

Please read the following document to understand *.kp file syntax.

Each project can only have 1 kp file.


Project structure

Kermeta 1 had support for multiple kermeta projects into 1 eclipse project. In kermeta 2, you need to create one eclipse project per program. If those programs have dependencies, you can create projects with dependencies to other projects.

2/ Standard IO

There are some minor changes in the framework on IO

In Kermeta 1
Equivalent in Kermeta 2
 stdio.writeln("hello")kermeta::io::StdIO.writeln("hello")
or
using kermeta::io::StdIO => stdio
...
stdio.writeln("hello")
kermeta::io::FileIO.new.writeTextFile("path", contents)
kermeta::io::FileIO.writeTextFile("path".toURI(), contents)

3/ Load/save model

The current framework is slightly different from Kermeta 1 framework.

In kermeta 1
Equivalent in Kermeta 2
using kermeta::persistenceusing kermeta::emfpersistence
var repository : Repository init EMFRepository.new
var resource : Resource init repository.createResource(uriModel)
resource.load()
var repository : ResourceSet init ResourceSet.new
var resource : Resource init repository.createResource(uriModel)
resource.load(void)
resource.save()
resource.save(void)
resource.one
or
resource.instances.one
resource.getContents.one
resource.each{...
or
resource.instances.each{
resource.getContents.each{...
resource.contents.each{...
resource.getAllContents.each{...

4/ Multi-inheritance (since Kermeta 2.1)

The keyword 'from' is now decrepated. The declaration of the targeted super type must be done by the super call.

In Kermeta 1
Equivalent in Kermeta 2.1
operation foo() from MySuperClass is do
  super
end
operation foo() is do
  super[MySuperClass]
end