The Epsilon Transformation Language is an eclipse extension for model transformations. Despite many code snippets available online, it is hard to find a standalone demo that is:
- well documented
- minimal
- working
- fully standalone (no eclipse required, builds into self-contained jar)
I therefore parted from the standalone examples of Hyacinths fork and the official repo. After a lot of cherry-picking and refactoring, I ended up with this simple demo project.
- Added this markdown file, as a place to start.
- Decluttered original repo from everything, not of particular interest for a minimal ETL demo.
- Removed non-standalone sibling projects
- Removed non-ETL examples
- Removed irrelevant / unused etl / meta-models / xmi files.
- Removed eclipse / html / bloat / meta files
- Added code
- Launcher class for enhanced separation of concerns
- Util class to correctly resolve metamodel / etl-rule as java resources
- Util class to detect if code is executed from JAR or natively
- Cleaned up and added many comments to explain what the code actually does.
- Fixed maven configuration
- Refactored project structure, so it complies to maven conventions
- Pom entry to correctly reference main class for direct launch
- Pom configuration for creation of self-contained JAR
The code of this demo project transforms a Tree input model into a Tree output model. Specifically, it copies every node of the input model and prefixes it's label by copyOf
.
- Example output model:
<?xml version="1.0" encoding="ASCII"?>
<Tree xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="TreeDsl" xsi:schemaLocation="TreeDsl file:///Users/schieder/Code/EtlStandaloneExample/target/classes/metamodels/Tree.ecore" label="CopyOfa">
<children label="CopyOfb">
<children label="CopyOfc"/>
</children>
</Tree>
- The syntax of tree models is defined by an ecore meta-model. The input model (Tree.xmi), as well as the generated deep copy conform to this meta-model.
This is a true standalone project. You do not need an IDE to run this, especially you do not need eclipse.
git clone https://github.com/kartoffelquadrat/EtlTrueStandalone.git
You can either directly run the code, or first build a self-contained jar.
- Update the input / output model locations in
pom.xml:87/88
:
<argument>/Users/schieder/Code/EtlStandaloneExample/Tree.xmi</argument>
<argument>/Users/schieder/Desktop/Copy.xmi</argument>
- Then run the demo:
mvn clean package exec:java
-
Build a self-contained jar:
mvn clean package
-
Run the self-contained jar with:
java -jar target/EtlPlayground.jar /Users/schieder/Code/EtlTrueStandalone/Tree.xmi /Users/schieder/Desktop/Copy.xmi
Again, don't forget to update the runtime arguments.
- Modifications: Maximilian Schiedermeier
- Github: Kartoffelquadrat
- Webpage: https://www.cs.mcgill.ca/~mschie3
- Original license, usage of official ETL-demo code snippets approved by authors.