Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [Kermeta] Benefits compared with EMF + pure Java ?
[Kermeta] Benefits compared with EMF + pure Java ? [message #108032] Wed, 08 July 2009 15:40 Go to next message
Olivier BERNARD is currently offline Olivier BERNARDFriend
Messages: 12
Registered: July 2009
Junior Member
Hi all,

As I faced too many problems with ATL, see for example:
http://www.eclipse.org/newsportal/article.php?id=4416&gr oup=eclipse.modeling.m2m#4416

I tried Kermeta and could get what I needed (create objects in an existing
model using transformation + link new objects with existing objects).

This was just a short evaluation but thinking of it, I am wondering which
benefits could be pointed out compared with another approach: describe the
transformation in Java code using EMF generated API.

Any idea ? Is there anybody who uses this language ?

-- Olivier
Re: [Kermeta] Benefits compared with EMF + pure Java ? [message #108059 is a reply to message #108032] Wed, 08 July 2009 18:17 Go to previous messageGo to next message
Krzysztof Kowalczyk is currently offline Krzysztof KowalczykFriend
Messages: 113
Registered: July 2009
Senior Member
Olivier BERNARD pisze:

> I tried Kermeta and could get what I needed (create objects in an
> existing model using transformation + link new objects with existing
> objects).
>
> This was just a short evaluation but thinking of it, I am wondering
> which benefits could be pointed out compared with another approach:
> describe the transformation in Java code using EMF generated API.

I am not familiar enough with Kermeta, but I am familiar with Xtend (M2M
language from Eclipse Xpand), QVT and with ATL(just a bit). I think that
some of benefits found in those languages are in Kermeta.

Each language has it advantages, even Java will fit in some situation,
but it easier to analyse them in context of concrete problem and I
encourage you to do so.

In my case I have chosen special M2M language not Java.

In general when comparing Java to M2M language:
Java should be faster on runtime (and Xtend is even slower than ATL and
QVT, nevertheless I have chosen Xtend)
Java is easier to start with (you don't have to learn new language)
Java don't need additional dependencies or special tools...

but:

M2M is not natural for Java. Java is painfully verbose in M2M. M2M
languages add syntactic sugar and some semantic concepts that are
valuable for M2M. Especially handling collections, querying, caching
created objects(keys in QVT, create/cache in Xtend), and potentially
tracing (modiniQVT handle tracing in a cool way, Xtend need some special
effort but it is easier than in Java).

To get collection of all the names of attributes in first class in a
package you would have something like that in Java:
for (... x.getPackage().getClasses().get(1).getAttributes()...){
anotherCollection.add(collection.next().getName()
}
anotherCollection;

Where in M2M you would have something like
x.pakage.classes.first().atributes.name


In Java you would treat generated model differently than dynamic Ecore
model, or you would use dynamic api that is even more verbose and it is
not type safe. M2M languages are type safe in most cases and can handle
both dynamic and generated models in a transparent way.

In some languages (e.g. Xpand/Xtend, Epsilon) it is really easy to use
different sources of metamodels. E.g. I have used XML Schema, Ecore
files, Ecore generated models and Java Classes as metamodels in one of
my projects (I read xml files and mix that information with information
that is provided by existing Java framework to create an UML model). But
I use just one language to handle all of that! If I would use Java I
would probably use a bit of Java, OCL, Xpath and Java reflection api,
plus dynamic and static EMF API to accomplish the same. It is also
really easy to connect Java code to my Xtend transformation.

Some languages (especially Xtend/Xpand and Epsilon) are tightly
integrated so you can reuse queries and functions from M2M to generate
code or other text.

But that is my use case and you have your own requirements...

Regards,
Krzysztof Kowalczyk
Re: [Kermeta] Benefits compared with EMF + pure Java ? [message #108073 is a reply to message #108059] Wed, 08 July 2009 19:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33264
Registered: July 2009
Senior Member
Krzysztof,

This is very good advice. Just one minor point. EMF's dynamic APIs are
type safe, they're just dynamically type safe, not statically type
safe. I.e., the compiler won't complain because it doesn't know the
dynamic type, but at runtime, type safety will definitely be enforced.
Of course you know that, I'm just splitting hairs. :-P


Krzysztof Kowalczyk wrote:
> Olivier BERNARD pisze:
>
>> I tried Kermeta and could get what I needed (create objects in an
>> existing model using transformation + link new objects with existing
>> objects).
>>
>> This was just a short evaluation but thinking of it, I am wondering
>> which benefits could be pointed out compared with another approach:
>> describe the transformation in Java code using EMF generated API.
>
> I am not familiar enough with Kermeta, but I am familiar with Xtend
> (M2M language from Eclipse Xpand), QVT and with ATL(just a bit). I
> think that some of benefits found in those languages are in Kermeta.
>
> Each language has it advantages, even Java will fit in some situation,
> but it easier to analyse them in context of concrete problem and I
> encourage you to do so.
>
> In my case I have chosen special M2M language not Java.
>
> In general when comparing Java to M2M language:
> Java should be faster on runtime (and Xtend is even slower than ATL
> and QVT, nevertheless I have chosen Xtend)
> Java is easier to start with (you don't have to learn new language)
> Java don't need additional dependencies or special tools...
>
> but:
>
> M2M is not natural for Java. Java is painfully verbose in M2M. M2M
> languages add syntactic sugar and some semantic concepts that are
> valuable for M2M. Especially handling collections, querying, caching
> created objects(keys in QVT, create/cache in Xtend), and potentially
> tracing (modiniQVT handle tracing in a cool way, Xtend need some
> special effort but it is easier than in Java).
>
> To get collection of all the names of attributes in first class in a
> package you would have something like that in Java:
> for (... x.getPackage().getClasses().get(1).getAttributes()...){
> anotherCollection.add(collection.next().getName()
> }
> anotherCollection;
>
> Where in M2M you would have something like
> x.pakage.classes.first().atributes.name
>
>
> In Java you would treat generated model differently than dynamic Ecore
> model, or you would use dynamic api that is even more verbose and it
> is not type safe. M2M languages are type safe in most cases and can
> handle both dynamic and generated models in a transparent way.
>
> In some languages (e.g. Xpand/Xtend, Epsilon) it is really easy to use
> different sources of metamodels. E.g. I have used XML Schema, Ecore
> files, Ecore generated models and Java Classes as metamodels in one of
> my projects (I read xml files and mix that information with
> information that is provided by existing Java framework to create an
> UML model). But I use just one language to handle all of that! If I
> would use Java I would probably use a bit of Java, OCL, Xpath and Java
> reflection api, plus dynamic and static EMF API to accomplish the
> same. It is also really easy to connect Java code to my Xtend
> transformation.
>
> Some languages (especially Xtend/Xpand and Epsilon) are tightly
> integrated so you can reuse queries and functions from M2M to generate
> code or other text.
>
> But that is my use case and you have your own requirements...
>
> Regards,
> Krzysztof Kowalczyk


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Kermeta] Benefits compared with EMF + pure Java ? [message #108099 is a reply to message #108059] Thu, 09 July 2009 07:51 Go to previous messageGo to next message
Olivier BERNARD is currently offline Olivier BERNARDFriend
Messages: 12
Registered: July 2009
Junior Member
Krzysztof & Ed,

Thanks for your feedback.

I agree the language has to be selected according to the application
requirements ... but the point is that you are never sure requirements are
fully identified at the beginning of the project.

So to me, M2M languages have to be flexible enough to allow the user to
use let say low-level features and not only high-level constructs.

If I come back to my previous experience with ATL: at the beginning I
would have said "ATL fits well with my requirements" ... except there is
this an impossibility to load an existing set of objects prior to perform
the transformation. Compared with the overall set of features provided by
ATL, this looks as something minor but this is a blocking !

Looking at Kermeta and its imperative programming approach, its seems I
have much more flexibility ... but I miss the declarative approach of ATL
!

Comparing Java with Kermeta, an important point is the integration of
OCL-like expression provided under the form of lambda expression.

Last point: it is quite difficult to find documentation for those
languages. Do you have references for Xtend ?

-- Olivier
Re: [Kermeta] Benefits compared with EMF + pure Java ? [message #108114 is a reply to message #108099] Thu, 09 July 2009 12:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lizzi.itemis.de

Olivier,

Xtend allows to mix expression language and Java calls.
Since galileo, Xtend is now part of eclipse M2T/Xpand project. A
reference documentation is provided in Eclipse doc
(http://help.eclipse.org/galileo/index.jsp), see "Xpand Documentation
section".

You may also have a look at the previous oAW reference manual here:
http://www.openarchitectureware.com/staticpages/index.php/do cumentation?menu=Documentation_



Cheers,
Yannick


Olivier BERNARD a écrit :
> Krzysztof & Ed,
>
> Thanks for your feedback.
>
> I agree the language has to be selected according to the application
> requirements ... but the point is that you are never sure requirements
> are fully identified at the beginning of the project.
>
> So to me, M2M languages have to be flexible enough to allow the user to
> use let say low-level features and not only high-level constructs.
> If I come back to my previous experience with ATL: at the beginning I
> would have said "ATL fits well with my requirements" ... except there is
> this an impossibility to load an existing set of objects prior to
> perform the transformation. Compared with the overall set of features
> provided by ATL, this looks as something minor but this is a blocking !
>
> Looking at Kermeta and its imperative programming approach, its seems I
> have much more flexibility ... but I miss the declarative approach of ATL !
> Comparing Java with Kermeta, an important point is the integration of
> OCL-like expression provided under the form of lambda expression.
>
> Last point: it is quite difficult to find documentation for those
> languages. Do you have references for Xtend ?
>
> -- Olivier
>
>
Re: [Kermeta] Benefits compared with EMF + pure Java ? [message #108126 is a reply to message #108099] Thu, 09 July 2009 13:59 Go to previous messageGo to next message
Krzysztof Kowalczyk is currently offline Krzysztof KowalczykFriend
Messages: 113
Registered: July 2009
Senior Member
Olivier BERNARD pisze:
> Last point: it is quite difficult to find documentation for those
> languages. Do you have references for Xtend ?

You can find online reference(for old Xtend, but it does not change,
except workflow invokations) on:
http://www.openarchitectureware.org/pub/documentation/4.3.1/ html/contents/core_reference.html

Questions about Xtend should be asked on m2t news group as Xtend is
developed under Eclipse M2T Xpand project. You will have to use Eclipse
MWE (workflow) project also, but that can be a good thing.

Xtend is easy to integrate with Java for low level stuff. I also like
the idea of QVT relations, but it is not acceptable for me until mature
solution with support for black box operation will be avaible.

Xtend is imperative, ocl based language with refection and AOP
capabilities. There are small problems with Xtend - it has just migrated
into Eclipse, but some extensions are not yet available for that version.

If you would like to try new Xtend, it is best to download Eclipse
distribution (or plugins) from http://xtext.itemis.com it is newer than
Galileo release. In that release help is included (it is missing in
Galileo release). It needs Eclipse Galileo.

There are some things that are hard for beginners (usually problems with
workflow and metamodels registration), so be ready to use newsgroup :)

If you are not using Eclipse Galileo then you should use xtend from
openArchitectureWare e.g.:
update site -
http://www.openarchitectureware.org/updatesite/milestone/sit e.xml
or distribution
http://oaw.itemis.com/openarchitectureware/language=en/2837/ downloads

This distribution has more add-ons compatible and some M2M examples
included (XML Schema adapter comes with M2M examples, or model
visualisations with Grapviz etc.), but it is deprecated package and
those add-ons will be made compatible with Eclipse Xpand/Xtend in near
future. If you don't need to use Xtext (what is really a great project
for modeling!) it can be even better to start with this distribution
IMO. AFAIK Xtend did not change between those versions, so with
exception for add-ons, there are no problems with switching them.

Some existing projects that use Xtend for M2M:
-
http://openarchitectureware.org/pub/documentation/4.3.1/html /contents/visualization.html#visualization_graphviz_ecore
- http://code.google.com/p/emfmodelvisualizer/
- http://code.google.com/p/gmftools/

Concepts I found important to learn Xtend:
- ocl-like navigation (a.b.collect(e|e.c) etc.)

- static typing with multi dispatching - type of each parameter is
checked on runtime to select extension that fit best, it is simply
awesome feature in context of M2M, like polymorphism, but better.

- functions is called extension
func(ModelElement e, String s):
//do something, e.g.:
e.setName(s)
;

it can be used:
modelElement.func("hello")
or like
func(modelElement,"hello")
Strange on beginning, great influence on readability letter.

- 'create' and 'cached' extensions to handle mapping of models (keys in
QVT handle same issue)

- the awkward setter convention, and even more awkward '->' instead of
semicolon. To set an element of model you need to use setter, or add
statement:
elementA.setName(elementB.name) ->
elementA.subelements.add(elementB)

- 'this' parameter name, to understand existing transformations ;)
func(ModelElement this, String s):
setName(s) // it is invoked on
;

- standard library for error reporting, iterators etc.

- Java extensions, to call Java.

Regards,
Krzysztof Kowalczyk
Re: [Kermeta] Benefits compared with EMF + pure Java ? [message #108140 is a reply to message #108099] Thu, 09 July 2009 16:55 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Olivier,

Just to add another language to the discussion, ETL from the Epsilon
component of the GMT project provides a combination of the declarative
style of ATL with the imperative style of Kermeta (i.e. declarative
rules as in ATL but with imperative bodies as in Kermeta). You can find
out more about ETL in:

http://www.eclipse.org/gmt/epsilon/doc/etl/

and see a quick example in:

http://www.eclipse.org/gmt/epsilon/examples/index.php?exampl e=org.eclipse.epsilon.examples.oo2db

The complete reference of the language is provided in Chapter 6 of the
Epsilon book:

http://www.eclipse.org/gmt/epsilon/doc/book/

Should you have any further questions about ETL please drop by the
Epsilon newsgroup:

http://www.eclipse.org/gmt/epsilon/newsgroup/

Cheers,
Dimitris

Olivier BERNARD wrote:
> Krzysztof & Ed,
>
> Thanks for your feedback.
>
> I agree the language has to be selected according to the application
> requirements ... but the point is that you are never sure requirements
> are fully identified at the beginning of the project.
>
> So to me, M2M languages have to be flexible enough to allow the user to
> use let say low-level features and not only high-level constructs.
> If I come back to my previous experience with ATL: at the beginning I
> would have said "ATL fits well with my requirements" ... except there is
> this an impossibility to load an existing set of objects prior to
> perform the transformation. Compared with the overall set of features
> provided by ATL, this looks as something minor but this is a blocking !
>
> Looking at Kermeta and its imperative programming approach, its seems I
> have much more flexibility ... but I miss the declarative approach of ATL !
> Comparing Java with Kermeta, an important point is the integration of
> OCL-like expression provided under the form of lambda expression.
>
> Last point: it is quite difficult to find documentation for those
> languages. Do you have references for Xtend ?
>
> -- Olivier
>
>
Re: [Kermeta] Benefits compared with EMF + pure Java ? [message #108154 is a reply to message #108140] Thu, 09 July 2009 17:59 Go to previous messageGo to next message
Krzysztof Kowalczyk is currently offline Krzysztof KowalczykFriend
Messages: 113
Registered: July 2009
Senior Member
Oh, I should mention Epsilon too. I did not, so I will add even more
info about it now ;)
I really like the work being done there (e.g. EWL, EuGENia).

Actually, in general, I would consider Xtend/Xpand and Epsilon (not the
rest) because of three reasons:

- tight integration with Java if needed.

- "abstract type system" in Xpand terminology or "metamodel-agnostic" in
Epsilon terminology. That is you can use same language for models that
are not EMF based (e.g. xml files in Xpand, or mdr files in Epsilon).

- Full integrated package!
You get all things that you need and more. In both families you use only
one core language for all the functions, querying etc. That means a lot
when you do both, M2M and M2T. Both projects have some additional cool
tools, Epsilon have EuGENia, its special purpose languages (e.g. Epsilon
Wizard language is really cool, and there are special languages for
comparing and merging models), better generic Ecore model editor
(customizable) etc. In Xtend/Xpand you have Xtext, model visualisations,
some support for software product lines, better generic Ecore model
editor(customizable, yes they have some duplicate functionality, third
"generic ecore model editor" is developed in Eclipse MoDisco) etc.

Point of info, QVTo has some integration with GMF version of Xpand, but
I don't like GMF Xpand, as it is incompatible with Eclipse M2T Xpand.


IMO Epsilon has one of the best websites in eclipse.org, and really good
documentation with many examples and good tooling. You can even test
Epsilon core language without any download -
http://www.eclipse.org/gmt/epsilon/live/


I did not mention Epsilon earlier because I don't like a statement in
Epsilon FAQ :
>in Epsilon, precedence is given to experimenting with interesting
>and novel features - as opposed to producing a comprehensive
>industrial-strength platform

Nevertheless I do appreciate the work and like many ideas. Actually
there is a possibility that I will create something like EWL and EuGENia
in Xtext for my toolbox(or try to reuse them if possible).

Cheers,
Krzysztof Kowalczyk
Re: [Kermeta] Benefits compared with EMF + pure Java ? [message #108168 is a reply to message #108154] Thu, 09 July 2009 20:40 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Krzysztof,

Many thanks for your feedback and for the comprehensive overview of
Epsilon. We've indeed put much effort into both the languages/tools and
the website and it's always nice to see that this is appreciated.

Regarding the FAQ you mentioned, the rationale behind it was definitely
not "we are building toys here", but I can now see how one can interpret
it as such. Thanks for bringing this to our attention! We'll need to
look into this and rephrase accordingly so that we don't convey the
wrong message - and gloriously shoot ourselves in the foot.

Cheers,
Dimitris

Krzysztof Kowalczyk wrote:
> Oh, I should mention Epsilon too. I did not, so I will add even more
> info about it now ;)
> I really like the work being done there (e.g. EWL, EuGENia).
>
> Actually, in general, I would consider Xtend/Xpand and Epsilon (not the
> rest) because of three reasons:
>
> - tight integration with Java if needed.
>
> - "abstract type system" in Xpand terminology or "metamodel-agnostic" in
> Epsilon terminology. That is you can use same language for models that
> are not EMF based (e.g. xml files in Xpand, or mdr files in Epsilon).
>
> - Full integrated package!
> You get all things that you need and more. In both families you use only
> one core language for all the functions, querying etc. That means a lot
> when you do both, M2M and M2T. Both projects have some additional cool
> tools, Epsilon have EuGENia, its special purpose languages (e.g. Epsilon
> Wizard language is really cool, and there are special languages for
> comparing and merging models), better generic Ecore model editor
> (customizable) etc. In Xtend/Xpand you have Xtext, model visualisations,
> some support for software product lines, better generic Ecore model
> editor(customizable, yes they have some duplicate functionality, third
> "generic ecore model editor" is developed in Eclipse MoDisco) etc.
>
> Point of info, QVTo has some integration with GMF version of Xpand, but
> I don't like GMF Xpand, as it is incompatible with Eclipse M2T Xpand.
>
>
> IMO Epsilon has one of the best websites in eclipse.org, and really good
> documentation with many examples and good tooling. You can even test
> Epsilon core language without any download -
> http://www.eclipse.org/gmt/epsilon/live/
>
>
> I did not mention Epsilon earlier because I don't like a statement in
> Epsilon FAQ :
> >in Epsilon, precedence is given to experimenting with interesting
> >and novel features - as opposed to producing a comprehensive
> >industrial-strength platform
>
> Nevertheless I do appreciate the work and like many ideas. Actually
> there is a possibility that I will create something like EWL and EuGENia
> in Xtext for my toolbox(or try to reuse them if possible).
>
> Cheers,
> Krzysztof Kowalczyk
Previous Topic:[QVTR]First Implementation
Next Topic:How to extend rule ?
Goto Forum:
  


Current Time: Fri Jan 17 12:50:45 GMT 2025

Powered by FUDForum. Page generated in 0.04724 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top