# VIATRA2/Examples/MTBE

The goal of this short review is to demonstrate how can we realize the complex process to derive model transformation rules by example using the VIATRA2 model transformation framework.

## Introduction

To define a model transformation, transformation designers need to understand not only the transformation problem, i.e. how to map source models to target models, but significant knowledge is required in the transformation language itself to formalize the solution. Unfortunately, many domain experts, who are specialized in the source and target languages, lack such skills in underlying transformation technologies.

Model transformation by example (MTBE) is a novel approach (first introduced in [1]) to bridge this conceptual gap in transformation design. The essence of the approach is to derive model transformation rules from an initial prototypical set of interrelated source and target models, which describe critical cases of the model transformation problem in a purely declarative way. A main advantage of the approach is that transformation designers use the concepts of the source and target modeling languages for the specification of the transformation, while the implementation, i.e. the actual model transformation rules are generated (semi-)automatically. In our context, (semi-)automatic rule generation means that transformation designers give hints how source and target models can potentially be interconnected in the form of a mapping metamodel. Then the actual contextual conditions used in the transformation rules are derived automatically based upon the prototypical source and target model pairs.

Now we give a short overview of the automation of the MTBE process using the VIATRA2 framework and inductive logic programming (ILP). ILP can be defined as an intersection of inductive learning and logic programming as it aims at the inductive construction of first-order clausal theories from examples and background knowledge, thus using induction instead of deduction as the basic mode of inference.

## Overview of the MTBE

Model transformations by example is defined as a highly iterative and interactive process as illustrated in the upper figure.

- Step 1: Manual set-up of prototype mapping models. The transformation designer assembles an initial set of interrelated source and target model pairs, which are called prototype mapping models in the sequel. These prototype mapping models typically capture critical situations of the transformation problem by showing how the source and target model elements should be interrelated by appropriate reference (mapping) constructs.
- Step 2: Automated derivation of rules. Based upon the prototype mapping models, the MTBE framework synthesize a set of model transformation rules using Inductive Logic Programming, which correctly transforms at least the prototypical source models into their target equivalents.
- Step 3: Manual refinement of rules. The transformation designer can refine the rules manually at any time by adding attribute conditions or providing generalizations of existing rules.
- Step 4: Automated execution of rules. The transformation designer validates the correctness of the synthesized rules by executing them on additional source-target model pairs as test cases, which will serve as additional prototype mapping models. Then the MTBE process is started all over again.

## Implementation using VIATRA2

Without further review of the main process (which can be found in [2]) let’s see how much VIATRA2 can facilitate the implementation of the process of MTBE. The upper figure shows the whole process in details highlighted the VIATRA specific parts.

From the prototype mapping model some ILP problem models are derived using VIATRA2 transformations. These models contain information expressed in term of the ILP domain, so from the ILP problem model it’s easy now to generate the ILP specific input files. Running the Inductive Logic Programming with the given files, prolog rules are generated, which has to be imported to the VIATRA model space for further processing. These prolog rules are used for final transformation in which we transform the models of prolog rules to the graph transformation rules that can be used directly by VIATRA framework to execute model transformations.

This work is in initial phase now, which means that it can be used only by the direct invocation of the core components/ core transformations. One of our main future works is to develop a convenient end-user interface that can hide the core layers and can help to achieve a higher-level mechanism to generate model transformation rules by example.

## References

[1] D. Varró. Model transformation by example. In In Proc. 9th International Conference on Model Driven Engineering Languages and Systems (MODELS 2006). Springer, 2006. In press.

[2] D. Varró and Z. Balogh. Automating model transformation by example using inductive logic programming. In ACM Symposium on Applied Computing -- Model Transformation Track (SAC 2007). ACM Press, New York, NY, USA, 2007.