480 likes | 631 Views
A Template-Based Model Transformation Approach Using A Simplified Hierarchical Metamodel . Ph.D Dissertation Hongming Liu DePaul University. Agenda. Introduction Motivation HRMT Approach Case Study: HIMS Related Work and Evaluation Contributions. MDE .
E N D
A Template-Based Model Transformation Approach Using A Simplified Hierarchical Metamodel Ph.D DissertationHongming LiuDePaul University
Agenda • Introduction • Motivation • HRMT Approach • Case Study: HIMS • Related Work and Evaluation • Contributions
MDE • Using models to direct the course of understanding, design, construction, deployment, operation, maintenance and modification. • Transform abstract model into system implementation • Benefits of MDE
Model Transformation • A core concept to support MDE • Transform a Platform Independent Model(PIM) to Platform Specific Model(PSM) • A model transformer is similar to a compiler • Transformation requires a clear understanding of the abstract syntax and semantics of both the source models and target models
Model Transformation Overview Relational Template .NET Template EJB Template
State of the Art • UML as the de facto modeling language • UML 2.2 • Object Constrain Language(OCL) • UML 3.0? • MDA initiative of OMG • Model Object Facility(MOF) • Query/View/Transformation(QVT)
MDE Obstacles • Problems of UML and OCL • Large and complex • Inconsistent • Loose semantics • Difficult syntax of OCL • Inadequate tools support • Lack of effective transformation mechanism
Proposed Approach A model transformations framework • Based on ZOOM notation • Use Hierarchical Relational Metamodel(HRM) • Template based transformation • Aims to provide a simple, effective, and practical way to define model transformations
HRMT Approach • Source Model Representation • Hierarchical Relational Metamodel • Transformation Template • Transformation Control Algorithm • Post Processing
Hierarchical Relational Metamodel A Hierarchical Relational Metamodel HRM = (N, C, R) N a set of nodes: N = {n1, n2, ... ni } C a relation on N X N, which forms a tree structure that has one root and no unconnected nodes. R a set of relation on N X N
Model Transformation Rules • A transformation rule set R = {r1, r2, r3... rn} a set of model transformation rules • A transformation rule r = (P --> Tpre, Tpost) P: pattern to select the elements of source model Tpre: mapping before traversing children of selected element Tpost: mapping after traversing children of selected element
Development of Transformation • CSL Roster Example • Basic Classes • Classes with associations • Generation of EJB Entities • Generation of comprehensive EJB applications
Case Study: HIMS • Hospital Information Management System • Electronic Healthcare Record • Functional Requirement • Non-Functional Requirement
HISM <Rule match="Struct"> <Pre> <![CDATA[ <File name="view${name}.aspx"> <%@ Page Language="C#" %> ... Healthcare Information Management System <asp:GridView id="ctrlDataGrid" runat="server" ... </asp:GridView> <asp:SqlDataSource ID="ctrlDataSource" runat="server" ProviderName="System.Data.OleDb" ConnectionString=..."/> @table struct MedicalDataTemplate { int id; String desc; String SecurityLevel; String format; String attachment; }
HISM <%@ Page Language="C#" %> <html xmlns="http://www.w3.org/1999/xhtml"> <font size=4><strong>Show all the available medical data</strong></font> </p> <form id="WebForm" runat="server" > <asp:GridView id="ctrlDataGrid" runat="server" DataSourceID="ctrlDataSource" HeaderStyle-BackColor="#CCCCCC" CellSpacing="0" CellPadding="5" Width="400" AutoGenerateColumns="false" > <Columns> <asp:BoundField HeaderText="Patient ID" DataField="patientid"/> …. </Columns> </asp:GridView> </p> <asp:SqlDataSource ID="ctrlDataSource" runat="server" ProviderName="System.Data.OleDb" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\ectserver\jliu\Database\hospital.mdb" SelectCommand="SELECT * FROM [medicaldata]" />
Features Illustrated by Case Study • Multi-platform support • Security requirement support • Scalability requirement support • Performance requirement support
Evaluation • Choice of Test case • CSL Roster example • Choice of Metrics • Choice of transformation tools
Evaluation Metrics • Total Line/Token • Nesting Depth • Cross Reference - Inner cross reference/outer cross reference • Reference to Metamodel - reference/unique reference
Model Transformation Tools • Jamda Direct model manipulation using visitor mechanism • Stylus Studio Using XSLT stylesheet to describe mapping rules • AndroMDA An extensible template-based code generator • ATL Comply to the QVT standard(UML,MOF,XMI)
Evaluation • Evaluation Result Reflecting Metamodel Complicity
Evaluation • Evaluation Result Reflecting Transformation Complicity
Evaluation • Evaluation Result of Transformation Tools
Contribution • A Template Based Model Transformation Approach Using Simplified Metamodel • Benefits of our approach: • Simplicity of source modeling language • Readability of transformation definition • Support of non-functional requirement
Thank You! Questions/Comments?
Our Vision for MDE Our vision for MDE centers on • Notations for capturing formal and complete models of all aspects • Knowledge-based approaches and tools that transform models into complete applications through a process known as model compilation.
MOF • MOF stands for Meta Object Facility • enables meta-metamodeling of UML level metamodels • It defines a small set of concepts (such as package, class, method, attribute…) That • allow one to define and manipulate models of metadata (data about data) • are described using a subset UML notation
Why ZOOM • Problems of UML and OCL • Large and complex • Inconsistent • Loose semantics • Difficult syntax of OCL • Key features of ZOOM • Simple and consistent • Familiar and easy syntax • Dual visual and textual representations • Extensive libraries
A Simple ZOOM Structural Model Example Lexical elements --Very similar to Java/C#. namespace roster; @Entity struct Player { String playerId; String name; String position; double salary; } Types and variables -- Similar to Java, but more extensive. -- All basic Java data types are supported Expressions -- All Java expressions are valid in ZOOM Libraries -- Include common data types, collections (sets, lists, maps), and a lot more.
Benefits of MDE • Reduced development time and cost • Increased portability, platform independence, cross-platform interoperability, and reusability • Improved application quality
Model and Metamodel • Model A consistent and complete set of formal elements describing a system that is amenable to analysis • Metamodel A specification model for a system under study where such system under study is itself a valid model expressed in a certain modeling language
Transformation Control Algorithm 1 Transform(node , RuleSet , Output_Model ) 2 rule <- findMatchingRule(node , RuleSet ) 3 targettext <- instantiate( rule .pre , node ) 4 OutPut_Model . append( targettext ) 5 foreach c is a child of node 6 transform(c , RuleSet , Output_Model ) 7 endforeach 8 targettext <- instantiate( rule .post , node ) 9 OutPut_Model . append( targettext ) Starting point: transform(root, RuleSet, Output_Model)
Transformation Approaches • Direct-Manipulation Approach • Transformation using XSLT • Template-Based Approaches • QVT(Queries/Views/Transformations)
Example struct Player { String playerId; String name; String position; double salary; }
Example public class Player implements Serializable { @Entity Player (String id, String name, String position, double salary) { this.id = id; this.name = name; this.position = position; this.salary = salary; } @Id @Column(name = "id") public String getId() { return id; } … <Rule match="Struct"> <Mark> <Stereotype name="Entity"/> </Mark> <Pre> <![CDATA[ <File name="${name}.java"> … public class ${name} implements Serializable { <MacroRef name="${name}.constrDef"/> <MacroRef name="${name}.operDef"/> <MacroRef name="${name}.attrDef"/> } …