Domain Specific Language Tool Development
Total Page:16
File Type:pdf, Size:1020Kb
University of Latvia ELĪNA KALNIŅA MODEL TRANSFORMATION DEVELOPMENT USING MOLA MAPPINGS AND TEMPLATE MOLA Thesis for the PhD Degree at the University of Latvia Field: Computer Science Section: Programming Languages and Systems Scientific Advisor: Prof., Dr. Habil. Sc. Comp. AUDRIS KALNINS Riga – 2011 This work has been supported by the European Social Fund within the project «Support for Doctoral Studies at University of Latvia». Scientific Advisor: Professor, Dr. Sc. Comp. Audris Kalniņš Latvijas Universitāte Referees: Professor, Dr. Sc. Comp. Guntis Bārzdiņš University of Latvia Professor, Dr. Sc. Ing. Oksana Ņikiforova Riga Technical University Professor, Dr. Olegas Vasilecas Vilnius Gediminas Technical University (Vilnius, Lithuania) The defence of the thesis will take place in an open session of the Council of Promotion in Computer Science of the University of Latvia, in the Institute of Mathematics and Computer Science of the University of Latvia (Room 413, Raina Boulevard 29, Riga, Latvia) on March 7, 2012 at 4 PM. The thesis and its summary are available at the library of the University of Latvia (Kalpaka Boulevard 4, Riga, Latvia). 3 4 ABSTRACT Model transformation development for three specific domains: Model-Driven Software Development (MDSD), DSL tool development and transformation synthesis has been studied in the thesis. It is concluded that transformation development in domain- specific transformation languages is more straightforward and faster compared to traditional transformation languages. A domain-specific model transformation language has been developed for each studied domain. Two of them are based on mappings. In both cases it was concluded that mappings better fit for typical tasks and transformations better fit for non-standard tasks. Therefore a close integration between mappings and transformations is required. The research results have been published in 15 papers (6 of them have been included in SCOPUS). Keywords Model transformations, Domain-Specific Languages (DSL), Model-Driven Software Development (MDSD), DSL tool development, Higher-Order Transformations (HOT) 5 6 CONTENTS LIST OF FIGURES ........................................................................................................ 11 LIST OF TABLES .......................................................................................................... 15 ACKNOWLEDGEMENT .............................................................................................. 17 INTRODUCTION ........................................................................................................... 19 CHAPTER 1 MOTIVATION - MDSD AND MODEL TRANSFORMATION LANGUAGES ..................................................................................................... 27 1.1 Modelling ................................................................................................................ 27 1.1.1 What is a Model? ........................................................................................... 27 1.1.2 Meta-modelling ............................................................................................. 32 1.2 Model-Driven Software Development .................................................................... 34 1.2.1 MD* .............................................................................................................. 34 1.2.2 Model Driven Architecture ........................................................................... 36 1.2.3 Model Driven Software Development .......................................................... 39 1.2.4 Domain-Specific Modelling Languages ........................................................ 40 1.3 Model Transformations ........................................................................................... 42 1.3.1 Model Transformation Languages ................................................................ 43 1.3.2 Mapping Languages ...................................................................................... 45 1.3.3 Higher-Order Transformations ...................................................................... 45 CHAPTER 2 MOLA LANGUAGE .............................................................................. 47 2.1 MOLA Overview .................................................................................................... 47 2.2 MOLA Elements ..................................................................................................... 48 2.3 MOLA Example ...................................................................................................... 53 2.4 Hello World with MOLA ........................................................................................ 55 2.4.1 Greeting Tasks ............................................................................................... 56 2.4.2 Instance Counting .......................................................................................... 57 2.4.3 Reversion ....................................................................................................... 63 2.4.4 Model Migration ........................................................................................... 64 2.4.5 Deletion Tasks ............................................................................................... 66 2.4.6 MOLA Tool Support ..................................................................................... 67 2.5 MOLA Metamodel .................................................................................................. 69 CHAPTER 3 TRANSFORMATIONS FOR MODEL-DRIVEN DEVELOPMENT IN REDSEEDS .................................................................................................... 73 3.1 ReDSeeDS Overview .............................................................................................. 73 3.2 Requirements Specification in ReDSeeDS ............................................................. 75 3.2.1 Requirements Specification Language in ReDSeeDS .................................. 75 3.2.2 Example of Requirements ............................................................................. 77 3.3 Model-Driven Development in the ReDSeeDS Project .......................................... 78 3.3.1 Design Patterns and the Architecture Style ................................................... 79 3.3.2 The RSL Profile ............................................................................................ 81 7 3.4 ReDSeeDS Basic Style ............................................................................................ 81 3.4.1 The Platform-Independent Model ................................................................. 82 3.4.2 The Platform-Specific Model ........................................................................ 85 3.5 The Keyword-Based Style ...................................................................................... 85 3.5.1 Models ........................................................................................................... 86 3.5.2 Selected Design Patterns for the Keyword-Based Style ............................... 88 3.5.3 RSL Profile for the Keyword-Based Style .................................................... 89 3.5.4 The Structure of the Analysis Model ............................................................ 91 3.5.5 Transformation of Requirements to Analysis ............................................... 92 3.5.6 The Platform-Independent Model ................................................................. 93 3.5.7 Transformation of Requirements and Analysis to PIM ................................ 95 3.5.8 The Platform-Specific Model ........................................................................ 98 3.5.9 The Java Code ............................................................................................... 99 3.6 Implementation ...................................................................................................... 103 3.6.1 Model-to-Model Transformations Implementation .................................... 103 3.6.2 Model-to-Model Transformations in the Keyword-Based Style................. 105 3.6.3 Model-to-Code Transformation Implementation ........................................ 111 3.6.4 Integration with the Enterprise Architect .................................................... 112 3.7 Conclusions ........................................................................................................... 113 CHAPTER 4 MAPPING LANGUAGES.................................................................... 115 4.1 Mapping Idea ......................................................................................................... 115 4.1.1 Transformation Languages and Mapping Languages ................................. 116 4.1.2 General Purpose Mapping Languages......................................................... 118 4.2 Domain-Specific Mapping Languages .................................................................. 120 4.2.1 Domain-Specific Model Transformations ................................................... 120 4.2.2 Domain-Specific Mapping Languages ........................................................ 121 4.3 MALA4MDSD – Mapping Language for MDSD ................................................ 121 4.3.1 MALA4MDSD Motivation ......................................................................... 122 4.3.2 Basics of MALA4MDSD ............................................................................ 124 4.3.3 MALA4MDSD