My experience with Henshin is quite limited since I've used it only since a couple of days.
I'd like to use Henshin to represent the rules that map the information model of a legacy system to a standard information model, so basically to do model-to-model transformations. I think Henshin could be a pretty good alternative to XSLT or ATL based mapping specially for information modelers that would rather manipulate data objects and their mapping graphically than manually write XSL/ATL mappings.
I have the feeling that Henshin is intuitive and powerful enough to let users define endogenous rules graphically. Though, I guess it could be more straight forward when it comes to define exogenous rules graphically. Specially declaring a rule parameter for each class attribute to be mapped is a bit heavy. It would be great to graphically be able to draw a kind of "mapping edge" between attributes of mapped classes and specify the mapping (like father.firstName + family.lastName). But maybe this does not respect the Henshin's way to do stuffs.
Regards,
Roch
PS: I use this email address for mailing lists only so no, rok is not my actual name. :-)
I took a look at your example and I have a number of suggestions for
you.
First of all, (currently) Henshin does not support multi-parameters,
i.e., you cannot use a parameter "sons" to return a
List/Array/Collection.. of Persons.
Secondly, the part of your rule that matches sons was defined
incorrectly. From the graphical editor point of view you just have
set the asterisk * at the wrong location. In order to define multi
rules, set the asterisk to the stereotype (see the correct rule
attached). Please note the significant change of the rule in the
tree-based editor!
I propose the following solutions:
1) Execute the transformation. Calling emfGraph.getRootObjects(),
you will receive all objects not contained in a tree. Choose those
being an instance of Person.
2) Introduce a new root element in your Persons model, e.g., PersonRegister
and modify the rule such that all persons end up being
contained in a PersonRegister object. Then, you could
just return that instance and persist it without additional coding
overhead.
3) Use our trace model, i.e., add the henshin trace model
(http:/www.eclipse.org/emf/2011/Henshin/Trace) to your
transformation system and use a Trace object as sort of
anchor. In detail, create a Trace object and let this
object refer to all newly created Persons. Then return
this trace object to your code and collect all referred persons.
I would definitely prefer option (2) while all solutions work!!
If you need further help, please drop a message.
Regards,
Stefan
PS: By the way, is "rok" your actual name?
PPS: If you have a minute or two, short statements for what reasons
and in what environment you (plan to) use Henshin are highly
appreciated...as well as any suggestions for improvement or feature
requests....even criticism is welcome in order to improve Henshin.
Great example Stefan, thanks! It helps a lot to get started with
exogenous transformation.
I'm now trying to apply an exogenous transformation to the ATL
example Families 2 Persons (http://www.eclipse.org/m2m/atl/atlTransformations/Families2Persons/Families2Persons.zip).
So far, I can match the mother and the father from a Family and
create the transformed Persons. But I'm having a hard time to
manage the sons/daughters, since many of them can be specified in
the source files, and each of them shall be transformed into a
person. My transformation file (see enclosed file) only matches
the last specified son from the source file.
How could I do to match each of the sons/daughter please?
I added an OO2RDB example to our examples plugin. It
makes extensive use of multi rules which turned out to
work very well.
The transformation translates ecore models into
instances of an rdb.ecore model.
However, the scenario is quite boring and I will pimp
that up in short terms.
I already though of adding the common OO-->RDB
scenario as (simple) exogenous transformation example.
Therefore, I would create a simple RDB ecore model and
let arbitrary Ecore files being transformed into
instances of the RDB ecore model.
I will come up with a first version at the end of this
week.
@Rok: You may also want to have a look at the
ecore2genmodel transformation which actually *is* an
exogenous transformation; its rather complex though.
Regards,
Stefan
Am 20.02.2012 07:45, schrieb Christian Krause:
Hi,
we are aware of the issue and it will be fixed in
the new version. The new version will be released in
March. Thank you for your feed back anyway. We will
also add an example of an exogenous transformation
soon.
Best regards,
Christian
On 02/19/2012 08:35 PM, rok wrote:
Hello,
I have the following issues when running the Bank
Account Example using Henshin SDK 0.8.0 with
Eclipse Indigo 3.7.1 on windows 7:
Preview is not working
Rule deleteAllAccounts is not working
I've updated to Henshin SDK 0.8.1 SNAPSHOT but
the Bank Account Example files cannot be opened
anymore (NPE).
Enclosed are the files for the Bank Account
Example that works under SDK 0.8.1. I hope it
helps someone.
Note:
I couldn't rename the model file. I think
making the Eclipse "refactor" functionality
work would be great.
Also, a simple working example of
an exogenous transformation would be very much
appreciated.