Nov 5, 2014
When defining a transformation
my-transform with Henshin, you usually have the following directory structure:
my-transform/ |-> my-transform.henshin # The transformation model |-> my-transform.henshin_diagram # The transformation diagram visualizing the model |-> my-model.xmi # A model the transformation operates on `-> my-metamodel.ecore # The metamodel my-model.xmi conforms to
In Henshin terminology, the directory
my-transform is called the base-path of the Henshin resource set containing all those files.
To translate the Henshin transformation model
my-transforms.henshin into an equivalent FunnyQT transformation, execute the following:
(henshin-to-funnyqt "path/to/my-transform/" ;; base-path "my-transform.henshin" ;; transformation model org.myself.my-transform ;; Namespace into which to generate mt) ;; Alias under which to require ;; org.myself.my-transform
After doing that, the target namespace
org.myself.my-transform contains one function per top-level Henshin unit defined in the transformation model. All those functions have the same name as their Henshin counterparts, and they also take the same parameters except that there is an additional first parameter denoting the model on which to execute the rule/unit.
my-transform.henshin defines a rule
createAccount(client:EString,accoundId:EInt) (see the Henshin Bank example) the corresponding generated FunnyQT/Clojure function has the same name and the parameter vector
[model client accountId]. Thus you can apply it using
(mt/createAccount my-bank-model "John Doe" 1626891).
At the current point in time, the following Henshin units can be translated:
Top-level Henshin Rules are translated to FunnyQT in-place transformation rules (see defrule).
Simple rules, i.e., matching some elements, preserving some and deleting some others, and creating new ones, are supported.
- Negative Application Conditions are supported.
- Positive Application Conditions are supported.
- Nested Rules (those with *-ed elements) are supported.
Sequential Units are translated to plain Clojure functions.
Iterated Units are translated to plain Clojure functions.
Distributed under the General Public License, Version 3 with the following additional grant:
Additional permission under GNU GPL version 3 section 7 If you modify this Program, or any covered work, by linking or combining it with Eclipse (or a modified version of that program or an Eclipse plugin), containing parts covered by the terms of the Eclipse Public License (EPL), the licensors of this Program grant you additional permission to convey the resulting work. Corresponding Source for a non-source form of such a combination shall include the source code for the parts of FunnyQT and JGraLab used as well as that of the covered work.