a template-based model transformation approach using a simplified hierarchical metamodel ph.d...

Post on 29-Dec-2015

219 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

RelationalPSM

EJB ComponentPSM

SQL Source Code

Java SourceCode

Platform Independent Model(PIM)

.NETPSM

C# SourceCode

Transformation:PIM -> Relational

Transformation:PIM -> EJB Component

Transformation:PIM -> .NET PSM

Transformation:Code Generation

Transformation:Code Generation

Transformation:Code Generation

Relational Template

EJB Template

.NET Template

State of the Art UML as the de facto modeling language

UML 2.2Object Constrain Language(OCL)UML 3.0?

MDA initiative of OMGModel 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 frameworkBased on ZOOM notationUse Hierarchical Relational Metamodel(HRM)Template based transformationAims to provide a simple, effective, and

practical way to define model transformations

HRMT Approach

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

HRM Example

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

Transformation Control Algorithm

Transformation Process

A

attrA1: Type

B

attrB1: TypeattrB2: Type

z

C

attrC1: TypeattrC2: Type

D

attrD1: Type

x

y

role2role1

Transformation Process

Class A

Attribute attrA1

ClassDiagram

Class B

Class C

Class D

Attribute attrB1

Attribute attrB2

Attribute attrC1

Attribute attrC2

Attribute attrD1

Relation Nodex Ay A

superClass

Relation Nodex Cy D

subClass

LeftAssociationEnd

RightAssociationEnd

Relation Nodez A

Relation Nodez BRelationships

Transformation Process

Development of Transformation

CSL Roster Example Basic Classes Classes with associations Generation of EJB Entities Generation of comprehensive EJB

applications

CSL Roster Example

Case Study: HIMS

Hospital Information Management System Electronic Healthcare Record Functional Requirement Non-Functional Requirement

HISM

@tablestruct MedicalDataTemplate { int id; String desc; String SecurityLevel; String format; String attachment;}

<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=..."/>

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]" />

HISM

Features Illustrated by Case Study

Multi-platform support Security requirement support Scalability requirement support Performance requirement support

Evaluation

Choice of Test caseCSL Roster example

Choice of Metrics Choice of transformation tools

CSL Roster Example

Evaluation Metrics

Total Line/Token Nesting Depth Cross Reference

- Inner cross reference/outer cross reference Reference to Metamodel

- reference/unique reference

Evaluation Metrics

Model Transformation Tools

JamdaDirect model manipulation using visitor mechanism

Stylus StudioUsing XSLT stylesheet to describe mapping rules

AndroMDAAn extensible template-based code generator

ATLComply 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

ZOOM Architecture

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

namespace roster;

@Entitystruct Player { String playerId; String name; String position; double salary; }

Lexical elements

--Very similar to Java/C#.

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.

MOF

HRM

Benefits of MDE

Reduced development time and cost Increased portability, platform

independence, cross-platform interoperability, and reusability

Improved application quality

Model and Metamodel

ModelA consistent and complete set of formal elements

describing a system that is amenable to analysis

MetamodelA 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 node6 transform(c , RuleSet , Output_Model )7 endforeach8 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; }

[m1] Model: Player

[s1f1]Field: String playerId

[s1f2]Field: String name

[s1f3]Field: String position

[s1f4]Field: Double salary

Example

<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"/>}

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; }

top related