# Getting Started

Warning: Eclipse QVTd 0.14.0 execution is not sufficiently mature for more than experimental/research usage.

For a very quick demonstration of QVTc or QVTr you may install the appropriate example project.

### QVTr Example Project

Invoke File->New->Example... then select Examples then QVT (Query/View/Transformation Language) Projects then select either QVTr HSTM2FSTM Project then Finish to create a small example project called org.eclipse.qvtd.examples.qvtrelation.hstm2fstm.

A QVTr or QVTc editor opens to show the transformation.

The image shows one of the mappings with hovertext elaborating the declaration referenced by name.

The QVT editors extend the OCL editor and so the OCL context menu provides useful functionality such as saving the transformation in Abstyract Syntax form.

A QVTr project is currently just a normal Java project. (A QVTd nature may be added in the future to support auto-building.)

The QVTr Hierarchical to Flat State Machine example contains

- HierarchicalStateMachine2FlatStateMachine.qvtr - the transformation

- HierarchicalStateMachine.ecore - the source metamodel

- FlatStateMachine.ecore - the target metamodel

- hier.xmi - an example model to exercise the execution

- expected.xmi - the expected execution result

- HierarchicalStateMachine2FlatStateMachine.qvtr.launch - a launch configuration for execution

You may execute the transformation on the hier.xmi input by invoking Run->Run Configurations... then QVTr (Relations) transformation then HierarchicalStateMachine2FlatStateMachine.qvtr.

The launch is currently cluttered by an excess of development information and not yet implemented facilities. The important fields are:

#### Project / Transformation

The project name provides a default name against which other filenames are resolved to reduce screen clutter.

The transformation name is the transformation to be executed.

The mode can only be enforce creation/overwrite of the output model at present.

The direction selects the output direction when executing a multi-directional transformation.

#### Inputs

The file bound to each input domain must be specified.

#### New outputs

The file bound to each output domain must be specified.

#### Intermediates

The location of each intermediate file in the transformation chain is identified. Their default location is a temp subfolder of the transformation’s parent folder. You can change them.

If you click Compile you can see the compilation progress as the grey Stale texts change to green Ready text.

#### Build

The Interpreted check box selects between interpreted execution (fast start, slow run) or code generated execution (slow start, fast run).

The interpreted compilation synthesizes a QVTc middle metamodel and a genmodel.

- HierarchicalStateMachine2FlatStateMachine.ecore

- HierarchicalStateMachine2FlatStateMachine.genmodel

The code generated compilation additionally synthesizes a Java class to implement the transformation and the Java classes for the QVTc middle model.

- HierarchicalStateMachine2FlatStateMachine.java

The generated files are generated to a distinct src-gen tree which you may need to refresh to see all files. Java problem markers come and go during the synthesis and build. The errors should all be gone before execution proceeds. Elimination of warnings is a work in progress.

##### Run

Clicking on Run will Compile automatically if you have not already done so.

The result should be a flat.xmi file that is similar to the expected.xmi file.

### QVTc Example Project

The OMG QVTc variant of the traditional UML to RDBMS transformation may be installed by:

Invoke File->New->Example... then select Examples then QVT (Query/View/Transformation Language) Projects then select either QVTc UML2RDBMS Project then Finish to create a small example project called org.eclipse.qvtd.examples.qvtcore.uml2rdbms.

The QVTc editor opens to show the transformation.

The QVTc tooling is very similar to the QVTr tooling. The main difference is that for QVTc the middle model and its genmodel are designed by the user, whereas the QVTr middle model and genmodel are synthesized automatically. If code generated Java execution is required, using the genmodel to generate Java code for the middle model is again a manual user responsibility.