henshintgg: tgg-extension of henshinemf

11
Frank Hermann, [email protected] SECAN-Lab Interdisciplinary Centre for Security, Reliability and Trust Université du Luxembourg BANFF Bidirectional Transformations 05-DECEMBER-2013 HenshinTGG: TGG-Extension of HenshinEMF

Upload: trannguyet

Post on 11-Feb-2017

237 views

Category:

Documents


2 download

TRANSCRIPT

Frank Hermann, [email protected]

SECAN-LabInterdisciplinary Centre for Security, Reliability and Trust Université du Luxembourg

BANFF Bidirectional Transformations05-DECEMBER-2013

HenshinTGG: TGG-Extension of HenshinEMF

02-DEC-2013 Tool Demonstration: HenshinTGG 2

• CD2RDBM

• DSL-Translation via TGGs

• Conclusion

OVERVIEW

02-DEC-2013 Tool Demonstration: HenshinTGG 3

Interrelated Models in Model Driven Engineering

02-DEC-2013 Tool Demonstration: HenshinTGG 4

Model 2Model 1

PIM

2 2

1

1. PIM$PIM (horizontal): DSL1$DSL2, Model Translation/ Integration/ Synchronisation, e.g.:UML Class Diag.$ RDBMBPMN $ BPELSequence Diag. $ St. Machines

Model Transformations

1

1. PIM$PSM (vertical):Model/Code generation, reverse engineering, e.g.:Class Diag.$Class Diag.Class Diag.$Java

2

[HEO+13]

1PSM

Model 1b Model 2b

CD2RDBM: Integrated Model

02-DEC-2013 Tool Demonstration: HenshinTGG 5

Co

ncrete

Syntax

T5:FKey

S2:src

T4:fkeys

T10:cols

T9:pkey

S3:Association

name = "employee"

S1:Class name="Company"

S5:Class name="Person"

S7:Class name="Customer"

S11:PrimitiveDataType

name = "int" S9:Attribute

is_primary = Tname="cust_id"

T11:Column type = "int"name = "cust_id"

T3:Column type = "int"name = "employee_cust_id"

T2:cols

T7:references

S10:type

C1:CT

C4:CT

C2:AFK

C3:CT

C5:AC

GS GT

S4:dest

S8:attrs

S6:parentT8:Table

name="Person"

T1:Table name="Company"

T6:fcols

Ab

stractSyn

tax

Company

FK1 employee_cust_id

Person

PK cust_idemployeePersonCompany

cust_id : int

Customer

employee

Triple Type Graph for CD2RDBM (Abstract Syntax)

• TGG=(TG,SG, TR), TG = type graph, SG=start graph (SG= ∅), TR = set oftriple rules

Triple Graph Grammar (TGG)

02-DEC-2013 Tool Demonstration: HenshinTGG 6

Source TargetCorrespondence

src

Association

name: StringFKey cols

fkeysreferencesdest

fcols

pkeyattrs

type

parent

type

CT

AFK

AC

110..1

0..1

1

0..1Class

name: String

Attribute

name: String

is_primary: boolean

Table

name: String

Column

type: String

name: String

PrimitiveDataType

name: String

0..1

[Schürr94]

Interrelated Models in Model Driven Engineering

02-DEC-2013 Tool Demonstration: HenshinTGG 7

Model 2Model 1

PIM

PSM

Code Aclass Person extends Object{

int age;

String name;

double wage;

Person(String name){

age=0;this.name=name;wage=0;}

public int getAge(){return age;}

public double getWage(){return

wage;}

public String getName(){return

name;}

}

Code Bclass Executer{

String name;

int runs=0;

boolean success=false;

Executer(String name){

this.name=name;}

public static void main(String[] args) {

// load file

final Resource.Factory.Registry reg =

Resource.Factory.Registry.INSTANCE;

execute(args,reg);

}

}

2 2

1

1. PIM$PIM (horizontal): DSL1$DSL2, Model Translation/ Integration/ Synchronisation, e.g.:UML Class Diag.$ RDBMBPMN $ BPELSequence Diag. $ St. Machines

Model Transformations

1

1. PIM$PSM (vertical):Model/Code generation, reverse engineering, e.g.:Class Diag.$Class Diag.Class Diag.$Java

2

[HEO+13]

1

3 Main phases

• Parsing (Xtext)

• FW-Transforamtion(HenshinTGG)

• Serialisation (Xtext)

DSL-Translation via TGGs: Conceptual Overview

02-DEC-2013 Tool Demonstration: HenshinTGG 8

Parsing Serialisation

Eclipse Frameworks(Xtext, Henshin)

Formal Theory

(Graph Transformation)

&

Source Code in

A

Source Code in

B

EMF EMF

Translation

Model

Transformation

Source Code in

A

Source Code in

BTranslation

LREPEAT:

• Loops: REPEAT … UNTIL <cond>, i.e., at least one execution

• Further constructs: READ <var>, <exp> AND <exp>, <exp> EQ <exp>, …

Example DSLs: LREPEAT, LWHILE

02-DEC-2013 Tool Demonstration: HenshinTGG 9

LWHILE:

• Loops: while, i.e., at least zero executions

• Further constructs: input(), <exp> && <exp>, <exp> == <exp>, …

Further Reading

02-DEC-2013 Tool Demonstration: HenshinTGG 10

[EEE+07] H. Ehrig, K. Ehrig, C. Ermel, F. Hermann, and G. Taentzer: Information PreservingBidirectional Model Transformations. Proc. FASE‘07. Springer (2007).

[EEPT06] H. Ehrig, K. Ehrig, U. Prange, and G. Taentzer: Fundamentals of Algebraic Graph Transformation. EATCS Monographs in Theoretical Computer Science. Springer (2006).

[GHL12] Giese, H., Hildebrandt, S., Lambers, L.: Bridging the Gap Between Formal Semantics and Implementation of Triple Graph Grammars. Ensuring Conformance of Relational Model Transformation Specifications and Implementations. Software and Systems Modeling, Springer (2012).

[GW09] Giese, H., Wagner, R.: From model transformation to incremental bidirectional model synchronization. Software and Systems Modeling 8(1), Springer (2009).

[HEGO10] F. Hermann, H. Ehrig, U. Golas, Fernando Orejas: Efficient Analysis and Execution of Correct and Complete Model Transformations Based on Triple Graph Grammars. Proc. of MDI’10, ACM (2010).

[HEOG10] F. Hermann, H. Ehrig, F. Orejas, U. Golas: Formal analysis of functional behaviourfor model transformations based on triple graph grammars. In: Int. Conf. on Graph Transformations, Springer (2010).

Further Reading

02-DEC-2013 Tool Demonstration: HenshinTGG 11

[HEO+13] F. Hermann, H. Ehrig, F. Orejas, K. Czarnecki, Z. Diskin, Y. Xiong, S. Gottmann, T. Engel: Model synchronization based on triple graph grammars: correctness, completeness and invertibility. In: Software & Systems Modeling, Springer 2013.

[KW07] Kindler, E., Wagner, R.: Triple graph grammars. concepts, extensions, implementations, and application scenarios. Tech. Rep. TR-ri-07-284, Department of Computer Science, University of Paderborn (2007).

[LAVS12] Lauder, M., Anjorin, A., Varró, G., Schürr, A.: Bidirectional model transformation withprecedence triple graph grammars. In: Proc. Eur. Conf. on Modelling Foundationsand Applications (ECMFA'12), LNCS, vol. 7349. Springer (2012).

[Schürr94] Schürr, A.: Specication of Graph Translators with Triple Graph Grammars. Proc. ofWG 1994. LNCS, Springer (1995).

[SK08] Schürr, A., Klar, F.: 15 years of triple graph grammars. In: Int. Conf. on Graph Transformations (ICGT 2008). LNCS, vol. 5214, Springer (2008).