Commit 1436e207 authored by Nicolas Biri's avatar Nicolas Biri
Browse files

Merge branch 'master' of

parents 996f9585 183db570
JSTL is a model to model transformation engine that handle JSMF models. JSTL simplifies the transformation writing while leaving some responsibilities to the transformation developer following JavaScript way of thinking (e.g., the developer has to check for concurrent rules).
## Install
Thanks to npm: `npm install jsmf-jstl`
## Usage and Example
if you are not familiar with JSMF-CORE please see it first:
In JSTL you define a set of transformation rules as inspired by ATL transformation Engine for EMF (
Transformation rules an composed by input (*in*) and an output (*out*) pattern functions.
The input is a function that process elements of a given input model, it provides the "set of element" that corresponds to a given pattern. For instance
this function can return all the elements that a "name" attributes or all elements that are conform to metaClass "Person".
The output pattern iterates over the fitered element and can create output elements for each of those.
You can also use Javascript function as helper and call them into the transformation rules.
Alike ATL, you can define helper attributes: function that will be launch once and that produce a value available in all transformations.
Let's take a simple example from ATL (
In this example, we first select all the element conform to *Member* of the Family metamodel (named *MMI*). Then, we filter (using lodash _.filter)
and returning the result of the helper function *isFemale()*.
//Helper function
function isFemale(member) {
//Warning writting the function name... checking empty table
return (member.familyMother.length!=0 || member.familyDaughter.length!=0);
var Member2Female = {
in : function(inputModel) {
return _.filter(inputModel.Filter(MMI.Member),
return isFemale(elem);
out : function(inp) {
var d = MMO.Female.newInstance('');
d.setFullName(inp.firstName+' '+familyName(inp));
return [d];
Launching the transformation is made by creating a new Transformation then by adding the rules it contains.
var transformation = new Transformation();
Execution of transformation rule is made using the apply function on a transformation. The parameters
are the input Model and output model (as defined in JSMF).
transformation.apply(, M.mb);
You can find examples, discover the other components and test it online with Tonic on JSMF github website (
## License information
See [License](LICENSE).
......@@ -11,7 +11,7 @@
"repository": {
"type": "git",
"url": ""
"url": ""
"keywords": [
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment