Example: Experiment with the different types of transformation rule in ETL using a Flowchart-to-HTML transformation.

rule Flowchart2Heading
  transform f : Flowchart!Flowchart
  to h1 : HTML!H1 {
  h1.value = f.name;

rule Action2Heading
  transform a : Flowchart!Action
  to h1 : HTML!H1 {
  h1.value = a.name;

rule Decision2Heading
  transform d : Flowchart!Decision
  to h1 : HTML!H1 {
  h1.value = d.name;

rule Transition2Heading
  transform t : Flowchart!Transition
  to h1 : HTML!H1 {
  h1.value = t.name;
rule NamedElement2Heading
  transform e : Flowchart!NamedElement
  to h1 : HTML!H1 {
  h1.value = e.name;
rule Action2Elements
  transform a : Flowchart!Action
  to container : HTML!DIV, title : HTML!H1, link : HTML!A {
  // Note that "Get up" is not transformed as it has no outgoing transitions
  guard: a.outgoing.notEmpty() 
  title.value = a.name;
  link.value = "Next steps";
  link.ahref = a.outgoing.first.target.name;

rule Decision2Elements
  transform d : Flowchart!Decision
  to container : HTML!DIV, title : HTML!H1, links : Sequence(HTML!A) {
  title.value = d.name;
  for (t in d.outgoing) {
    var link = new HTML!A;
    link.value = t.target.name;
    link.ahref = t.target.name;

Clone Epsilon's Git repository:

  • navigate to trunk/examples
  • import the org.eclipse.epsilon.examples.metamodels project
  • import the org.eclipse.epsilon.examples.etl.flowchart2html project

Once you have checked out/imported the code, to run the example you need to go through the following steps:

  1. register all .ecore metamodels in the org.eclipse.epsilon.examples.metamodels project (select all of them and then right click and select Register EPackages)
  2. register any .ecore metamodels in the org.eclipse.epsilon.examples.etl.flowchart2html project
  3. right click the .launch file in the org.eclipse.epsilon.examples.etl.flowchart2html project
  4. select Run as... and click the first item in the menu that pops up

What's this?

In this example, we show the different types of transformation rule that are provided by ETL, including plain, abstract, lazy, primary and greedy rules. We also explore rule inheritance and rules that generate more than model element. We transform from a Flowchart model to an HTML model.

What are .emf files?

.emf files are Ecore metamodels expressed using the Emfatic textual syntax.

More examples...

Epsilon Object Language
Epsilon Transformation Language
Epsilon Generation Language
Epsilon Validation Language
Epsilon Merging Language
Epsilon Flock
Combining the Epsilon Languages

Even more examples...

More examples are available in the examples folder of the Git repository.