Commit a09cbb15 authored by Jean-Sébastien Sottet's avatar Jean-Sébastien Sottet
Browse files

added ReamdMe Example

parent f34cf780
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()*.
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];
You can find examples, discover the other components and test it online with Tonic on JSMF github website (
## License information
See [License](LICENSE).
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