Debugging Model-to-Model Transformations J. Sch¨ onb¨ ock, G. Kappel, and M. Wimmer Vienna University of Technology, Austria Email: {lastname}@big.tuwien.ac.at A. Kusel, W. Retschitzegger, and W. Schwinger Johannes Kepler University Linz, Austria Email: {firstname.lastname}@jku.at Abstract—Model-Driven Engineering places models as first- class artifacts throughout the software lifecycle requiring the availability of proper model transformation languages. Although numerous languages are available, they lack convenient facilities for debugging and supporting understanding of the transforma- tion logic. This is not least because the underlying transforma- tion engines operate on a low level of abstraction, hiding the operational semantics of a high-level language. Consequently, low-level debugging information is available only, e.g., variable values. To tackle these limitations, we propose a DSL on top of Colored Petri Nets (CPNs) – called Transformation Nets (TNs) – for the execution and debugging of model transformations. By integrating all artifacts of a transformation, i.e., metamodel elements, model elements, and transformation logic, a runtime model for model transformations is provided, making the afore hidden operational semantics explicit. Based on this runtime model we present various means for debugging by means of an example showing how a QVT-Relations (QVT-R) specification may be debugged using TNs. I. I NTRODUCTION Model-Driven Engineering (MDE) [1] proposes an active use of models to conduct the different phases of software development, whereby models are abstractions of systems and/or their environments [2]. This leads to a shift from the “everything is an object” paradigm to the “everything is a model” paradigm [3]. In the same way as programs have to follow certain syntactic constraints – commonly described by grammars – models also have to follow syntactic constraints given by so-called metamodels (MMs), which define their abstract syntax [4]. In MDE there is a recurring need to transform models between different languages and abstraction levels, e.g., to migrate between language versions, to trans- late models into semantic domains for analysis, to generate platform-dependent from platform-independent models, or to refine models. Model transformations always follow a cer- tain pattern [2], as depicted in Fig. 1. In this context, the transformation definition takes place between the respective MMs using a dedicated transformation language, describing how source models should be transformed into target models. In this paper the focus is on declarative, rule-based transfor- mation languages which only require the definition of what needs to be transformed by relating certain source and target MM elements. The actual specification is then executed in a transparent way by a dedicated transformation engine. Transformation engines, however, operate on a rather low level of abstraction, appearing as black-box to the transfor- This work has been funded by the FFG Bridge program under grant 832160 and by the FWF under grant P21374-N13. Source Target Source Metamodel conforms to executes conforms to Transformation Definition Target Metamodel Source Model New Target Model input output Transformation Engine conforms to Fig. 1. Model Transformation Pattern mation designer, thereby hiding the operational semantics. As a consequence, debugging is limited to the information provided by the transformation engines. As discussed in [5], a model transformation debugger may not make use of com- mon programming language debuggers “due to the semantic differences in abstraction between the artifacts of code and models”. Consequently, a model transformation debugger must understand the model representation. Thus, the execution of a model transformation should be represented as a model, i.e., the execution should be an instance of a runtime model. To tackle the limitations of current approaches and their un- derlying execution engines, we propose Transformation Nets (TNs), a domain-specific language (DSL) on top of Colored Petri Nets (CPNs) [6] as a runtime model for declarative model transformation languages to reveal the internals of the execution engine. First, the visual nature of TNs allows for visual debugging, e.g., to detect code-smells. Second, an explicit, model-based representation of the execution state allows to incorporate more sophisticated debugging facilities known from traditional software engineering, e.g., simulation or tracking the origin of a failure by means of reasoning backwards in time and slicing [7]. Finally, the formal prop- erties provided by the underlying CPNs may be applied for debugging and verifying the transformation specification. The rest of the paper is structured as follows. Section II gives an overview of the TN formalism by means of a running example. Section III to Section VI present means for debugging in TNs, ranging from visual debugging, i.e., examination of code-smells, to property-based debugging, i.e., making use of formal CPN properties for debugging. Lessons learned are presented in Section VIII. A comparison to related work is conducted in Section IX before Section X concludes. II. TRANSFORMATION NETS IN A NUTSHELL This section first introduces the design principles of the TN formalism. Second, we introduce a running example (cf.