Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Gauging Interest: EMF M2M Transformations in Scala?
Gauging Interest: EMF M2M Transformations in Scala? [message #108631] Fri, 24 July 2009 03:51
Matthew Watson is currently offline Matthew WatsonFriend
Messages: 1
Registered: July 2009
Junior Member
Hi All,

I'd like to get some indication of interest in a Scala-based
model-to-model transformation engine (open-source)

In a previous job, we looked at all the existing M2M technologies for
doing transformations from incoming XML formats (varieties of FpML amongst
others), into our rich object model (based on FpML 5.0) and back again to
outgoing formats for downstream systems.

While the existing tools were good, there were little flaws in each that
stopped us from adopting them, as well as the jump our programmers would
have to make to learn them (especially given each programmer may only need
to make small modifications to an existing transform).

Ideally, we would have liked to use a full QVT stack, mostly written in
QVT-R so it would work bi-directionally, falling back to QVT-O when we
need to and back to java code for extreme cases (both of which would have
to be one-directional transforms only).

Instead, we ended up developing our own engine in java that used a DSL for
relating a type in one model to a type in another, with mappings between
fields that could use OCL expressions to short-circuit deep nesting and
for complex assignments in one-way sections. This only worked on generated
Java models, not models only defined by their meta-model, however, for us,
this was not a problem (although we ended up with a lot of java source
files for multiple different versions of FpML). The generated models were
required so we could use type safe identifiers for the fields from the
Literals interface of the package, rather than using ugly string
specifiers for the names of types and fields. It also meant our IDE would
code complete for us and we could write lots of automated tests to check
the validity of transformations without ever running them (although we
could also write functional unit tests).

Our experience with this technology was extremely positive. New developers
could get up and going transforming from one model to another (in a
pipeline of up to 4 M2M Transformations) very quickly, it fit in with
existing testing frameworks and was very fast.

Now, it occurs to me that a transformation is really a functional process
and would be better defined in a functional language like Scala.

Scala can also mirror the functionality of OCL expressions using closures
etc (although these features will be difficult to express such that they
work bi-directionally).

Scala is also much better than Java at developing DSL's, so it would be
easier to express a type transformation in terms of a where block and a
set of mappings.

The engine would handle the calling of further transformations where a
mapping between fields of a type does not result in compatible types.

The advantages of this approach over QVT/O/R would be:

* Developers don't need to learn a new language only used for
Transformations, however they would be learning an API and possibly Scala,
but at least Scala is applicable to other prgramming problems and becoming
a bigger and bigger player:
http://macstrac.blogspot.com/2009/04/scala-as-long-term-repl acement-for.html

* It would be possible to write a Java API on top of the engine so
developers don't even need to learn Scala. Each Transformation between 2
types would be represented as a Class (possibly inner when grouping
transformations into sets)

* It's trivial to call Scala or Java libraries from the middle of
transformations to produce new values, or to call methods on the java
model that have been custom implemented (I acknowledge QVT can do this as
well, for this it would be trivial). This makes it easy to extend the
functionality of the transformation.

* It would be fast.

I see this sort of technology, and M2M technologies in general as being a
replacement for Velocity/XSLT, which are both ugly, typeless languages
which do not encourage re-use.

There would of course, be many issues that would have to be resolved, such
as inheritance of transformations (explicit or implicit or both), enabling
explicit calling of other transformations, coping with 1->Many mappings
and vice versa.

Feedback highly desired!
Thanks in Advance,
Matthew Watson
Previous Topic:[ATL]org.eclipse.emf.ecore.xmi.PackageNotFoundException:
Next Topic:[ATL] How to Genenerate UML Model primitivetype pathmap from Other Model
Goto Forum:
  


Current Time: Mon Jan 20 02:44:28 GMT 2025

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

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

Back to the top