EndUser Support for Debugging Demonstrationbased Model Transformation Execution
End-User Support for Debugging Demonstration-based Model Transformation Execution Yu Sun Jeff Gray University of Alabama at Birmingham PAR Works University of Alabama ECMFA @ Montpellier, France July 3 rd, 2013 University of Alabama at Birmingham University of Alabama This research is supported by NSF CAREER award CCF-1052616
Outline Model Transformation by Demonstration (MTBD) MTBD Debugger 2
Domain-Specific Modeling (DSM) DSM specifies a system using domain concept models, and enables code generation from models Problem Domains Represent the System Domain. Specific Modeling Languages Generate the Code Low-Level Software Artifacts … 3
DSM Helps End-User Programming DSM enables development end-users to End-Users participate in software End-User Developers Upgrade Using DSM 4
Typical Model Evolution Activities • Model Scalability A B c d e • Model Refactoring • Model Evolutio n • Model Manageme nt • Aspect. Oriented Modeling F B B c d e • Model Layout 5
Using Model Transformation Languages MTLs are specialized languages to implement model transformation tasks Automate model transformations by programming Popular Model Transformation Languages QVT Query/View/Transformation GRe. AT ECL Graph Rewriting and Transformation Embedded Constraint Language 6
Difficult to Learn and Use MTLs Diversity of MTLs Metamodel Programming Concepts End-Users 7
The Challenges Lead to an Irony A technology meant to enable end-users to participate in software development, does not enable end-users to change and evolve the software End-Users End-User Developers Upgrade End-Users Degrade Using DSM Using MTL Modeling System Model Evolution 8
Model Transformation By Demonstration (MTBD) A complete model transformation framework Specify and execute model transformations Users are fully isolated from MTLs and metamodel definitions Infer and generate model transformation patterns by demonstrating model transformations on concrete examples , Update Add, Remove 9
Overview of MTBD MT Specification User Demonstration Pattern Inference Operation Optimization Operation Recording MT Execution Pattern Execution Correctness Checking User Refinement Pattern Repository Execution Control 10
A Model Transformation Example If a room contains both a weapon (>100) and gold, replace them with a monster having half the power of the weapon 110 55 120 Source model with the weapon and gold 60 Target model with the monster 11
User Demonstration • Edit a sample source model to change it into the desired target model, reflecting the purpose of the transformation Pattern Inference Operation Optimization Operation Recording Before Demonstration After Demonstration Pattern Repository • Attribute refactoring Execution to demonstrate attribute transformation on a concrete model Correctness Checking Execution Control User Refinement 100 / 2 12
Operation Recording User Demonstration • All the user operations performed during the demonstration will be recorded, as well as the related context information Pattern Inference Operation Optimization Operation Recording User Refinement Step Operation Type Detail 1 Delete Element Root. Maze. Folder. Room 2. Weapon 1 2 Pattern Delete Element Execution Root. Maze. Folder. Room 2. Gold 1 3 Add Element Root. Maze. Folder. Room 2 (Monster 1) 4 Update Element Root. Maze. Folder. Room 2. Monster 1. power (Root. Maze. Folder. Room 2. Weapon 1. power / 2) Execution Correctness Checking Pattern Repository Control 13
Operation Optimization • Users. User may perform meaningless operations that need to be Demonstration optimized … Operation Recording … Operation Optimization Pattern. Step Inference 1 Operation User Refinement Add a Monster 1 in Room 2 for each op in the input operation list 2 Add the Gold 1 in Room 2 switch (op. type) … … case ADD_ELEM: … Delete Monster 1 in Room 2 for each op_temp after the current op in the list Pattern if op_temp. type == REMOVE_ELEM and op_temp removes what op Execution added Repository and the element was not referred in between then remove both op and op_temp from the list case MODIFY_ELEM: traverse the final model instance and search the element being modified Correctness Execution Checking if not found then remove op from the list Control …… 14
Pattern Inference User A transformation pattern consists of: Demonstration • Transformation precondition (When and Where) • Transformation actions (How) Operation Recording Pattern Inference Operation Optimization User Refinement Precondition (Elements needed) Precondition (Elements Type) elem 1. elem 2. elem 3. elem 4 elem 1 – Root elem 1. elem 2. elem 3. elem 6 elem 2 – Maze. Folder elem 1. elem 2. elem 3 (elem 5) Pattern No. Transformation Actions Execution elem 1. elem 2. elem 3. elem 5 elem 3 – Room 1 Remove elem 4 elem 5 – Weapon 2 Remove elem 6 – Gold 2 Add elem 5 Correctness in elem 3 Checking Set elem 5. power = elem 4. power / 2 3 elem 4 – Monster Pattern Repository Execution Control 15
User Refinement Userinferred pattern is usually not accurate: The initially Demonstration • Preconditions are not specific enough • Transformation actions are not generic enough Precondition (Elements needed) Precondition (Elements Type) elem 1. elem 2. elem 3. elem 4 (elem 4 Operation > 100)elem 1 – Root Pattern Operation Optimization Recording elem 1. elem 2. elem 3. elem 6 elem 2 – Maze. Folder. Inference elem 1. elem 2. elem 3 (elem 5) elem 3 – Room elem 1. elem 2. elem 3. elem 5 elem 4 – Monster User Refinement > 100 elem 5 – Weapon elem 6 – Gold Pattern Execution> 100 Weapon 1. strength Pattern Repository User-centric interfaces are provided to enable user refinement: Correctness Execution Checking • Users continue to work. Control at the model instance level • Isolate users from knowing MTLs and metamodels 16
Pattern Repository • All the User finalized patterns are stored in the repository for future Demonstration reuse Pattern Inference Operation Optimization Operation Recording Pattern Execution Correctness Checking User Refinement Pattern Repository Execution Control 17
Pattern Execution User The execution engine is responsible for: Demonstration • Precondition matching • Execution of transformation actions Operation Recording No. Transformation Actions 1 Remove elem 4 2 Remove. Operation elem 6 2 Optimization Add elem 5 in elem 3 3 Set elem 5. power = elem 4. power / 2 >100 Pattern Inference Pattern Execution User Refinement Pattern Repository • Traverse the whole model instance and list all elements • Start to match the elements in the precondition one-by. Correctness Execution one Checking Control • Backtracking algorithm is used 18
Correctness Checking Userthe execution from violating the metamodel To prevent Demonstration definitions: • Each execution is logged • Correctness checking is performed after each execution • After a violation occurs, all the executed operations will be Pattern Operation undone Inference Optimization Recording Pattern Execution Correctness Checking User Refinement Pattern Repository Execution Control 19
Execution Control User controller is built to enable: An execution Demonstration • Execute multiple transformation patterns • Control the execution sequence of multiple transformation patterns • Control the number of execution times Pattern Inference Operation Optimization Operation Recording Pattern Execution Correctness Checking User Refinement Pattern Repository Execution Control 20
Practical and Incremental Development of MTBD For each type of model evolution: • Identify the critical requirements • Update MTBD to make it work • Model Scalability • Model Refactoring • Model Evolutio n • Aspect. Oriented Modeling User Demonstration • Model Manageme nt • Model Layout Pattern Inference Operation Optimization Operation Recording Pattern Execution Correctness Checking User Refinement Pattern Repository Execution Control 21
The Need for a MTBD Debugger User Demonstration Users can make mistakes, and bugs can happen. emerge Operation Optimization Operation Recording Reusing existing patterns may cause unknown errors Pattern Execution Pattern Inference MT Specification User Refinement MT Execution Pattern Repository Correctness Execution Transformation Pattern Control Checking Models’ 22
Lack of an End-User MTL Debugger Bugs can occur in MTL rules Models’ MTL Rules Most MTLs do not have an associated debugger Some existing debuggers are at the same level as MTLs, so not appropriate for end-users End-Users 23
MTBD Debugger: Being User-Centric The debugger should be at the same level of abstraction as MTBD, and be domain-focused End-Users End-User Developers Using MTBD Upgrade End-Users End-User Developers Debugging Using DSM Modeling System Model Evolution Debuggin g Model Evolution 24
MTBD Debugger: Being User-Centric The debugger should be at the same level of abstraction as MTBD, and be domain-focused End-Users End-User Developers Using MTBD Debugge r Using MTBD Upgrade End-User Developers Using DSM Modeling System Model Evolution Debuggin g Model Evolution 25
Overview of MTBD Debugger MT Specification User Demonstration Transformation Pattern Models Operation Recording Pattern Matching View Optimization Pattern Execution View Pattern Inference Precondition User Refinement Transformation Actions Pattern Execution MTBD Debugger Models’ Correctness Checking MT Execution Pattern Repository Execution Control 26
MTBD Debugger Case Study Replace Monster with Weapon + Gold (Monster. Strength > 100) 120 Sequence 1 2 3 4 5 Operation Performed Remove Monster 1 in Root. Text. Game. Folder. Room 2 Add a Weapon in Root. Text. Game. Folder. Room 2 Add a Gold in Root. Text. Game. Folder. Room 2 Set Root. Text. Game. Folder. Room 2. Weapon. strength = Monster 1. strength = 120 Set precondition on Monster 1: Monster 1. strength > 10 This error may cause the generated pattern to be over-matched in the model 27
MTBD Debugger In Action Pattern Execution View • Step-through each transformation action • Display relative information • Track the currently matched elements 25 Pattern Matching View • Display the information about the matched elements • Display the precondition 28
MTBD Debugger In Action Common Bugs Over-Matched Precondition Under-Matched Precondition 25 Incorrect Generic Operation Choosing Wrong Element Incorrect Attribute Expression 29
MTBD Debugger In Action Common Bugs Over-Matched Precondition Under-Matched Precondition 25 Incorrect Generic Operation Choosing Wrong Element Incorrect Attribute Expression 30
MTBD Debugger In Action Common Bugs Over-Matched Precondition Under-Matched Precondition 25 Incorrect Generic Operation Choosing Wrong Element Incorrect Attribute Expression 31
MTBD Debugger In Action Common Bugs Over-Matched Precondition Under-Matched Precondition 25 Incorrect Generic Operation Choosing Wrong Element Incorrect Attribute Expression 32
MTBD Debugger Summary MTBD Debugger assists transformation patterns in debugging MTBD Pattern Matching View checks the matching elements Pattern Execution View traces the transformation actions MTBD Debugger is at the same level of abstraction as MTBD Users do not need to know MTLs Users are isolated from metamodels 33
Conclusion & Future Work Enable end-users to participate in changing and evolving software models with reusable transformations and debugging support Model Transformation By Demonstration (MTBD) MTBD Debugger An end-user centric model transformation approach to support model evolution activities An end-user centric debugging facility for MTBD Next version Improve user experience by adding graphical representations Breakpoint support Use MTBD debugger to support MTL debugging 34
Thank you Personal: http: //students. cis. uab. edu/yusun Model Transformation By Demonstration: http: //www. cis. uab. edu/softcom/mtbd Model Transformation By Demonstration
Related Work MTL Debugger (ATL, Fujaba) Transformation Nets (TNs) Supported Debugging Schoenboeck ’ 10 Forensic MT Debugging Allilaire ‘ 06, Königs ’ 05, Wagner ’ 06 Hillberd ‘ 07 M 2 T (Model-to-Text) Debugging Dhoolia‘ 10 36
- Slides: 36