Ecore Muhammad Ali Memon IRISA Lab / INRIA Rennes, France Triskell Team mmemon@irisa.fr 1
2
3
The Unified Modeling Language (UML) Model-Driven Engineering (MDE) Eclipse-Modeling Framework (EMF) Ecore Kermeta Specification of abstract syntax, static semantics(OCL) and dynamic semantics Model and meta-model prototyping and simulation Model transformation Aspect weaving 4
Bridging the gap between UML and MDE Simulation Model Prototyping Model Transformation from PIMs to PSMs Aspect weaving Generating concrete implementations Migrating Legacy systems UML models. Automated translation of legacy UML models Save time to transform Complex and large UML models New compiler to Kermeta OCL for applying constraints Java for generating Java code 5
Translation EMF UML model Ecore model 6
7
Ecore UML EPackage Package EClass Class EOperation Operation EParameter Parameter EReference or EAttribute Property EEnum Enumeration EEnumLiteral EnumerationLiteral 8
Data types − Problem UML Primitive data types are different Ecore data types − Solution We create own data types with the reference to the java data type Type − Problem UML Primitive types does not match with the Ecore data types − Solution We identify the UML Primitive data types for the UML element We search the Ecore data types correspond to UML Primitive data types that was alreadycreated Assign Ecore data types to the Ecore elements Generalization − Problem Not direct mapping between both UML and Ecore metametamodels and may be multiple relationship − Solution Find all the generalization classes in relationship Collection 9 Match supertypes in Ecore and general relationship within the UML.
Association − Solution Create EReference element with the name of association End Composition − Solution Create EReference element with the name of association End Set Contaiement property of the EReference to true Multiplicities − Problem Difference between data types of lower and upper bounds − UML lower and upper bounds have different data types and then Ecore lower and upper bound − Solution We create the local variable of types UML primitive types and type casted them to Ecore data types Opposite Navigability − Solution To find opposite property in other class with the same type as current class. 10
This Algorithm works by traversing UML model in four passes. • First Pass : The main Package and Sub Packages are created. • Second Pass : Data types, classes, enumerations and its enumeration literals are created. • Third pass : Operations in the classes, parameters in the operations, attributes of the classes, generalization and association relationships are created. • Fourth pass : Opposition relationships are created between properties for both side navigability. 11
We combined two approaches for implmentation of the translation.(Kiczales) Aspect Oriented Approach Visitor Pattern aspect class Class { method thirdPass() : Void is do Aspect Classes All OwnedElements.secondPass() end } aspect class Operation { method thirdPass() : Void is do Create Eoperation in Ecore Visitor Methods end } 12
13
14
The main Package and Sub Packages are created Ecore Model UML Model 15
Data types, classes, enumerations and its enumeration literals are created UML Model Ecore Model 16
Operations in the classes, parameters in the operations, attributes of the classes, generalization and association relationships are created. UML Model 17 Ecore Model
Opposition relationships are assigned between properties for both side navigability. UML Model Property window of Ecore Model 18
19
Limitations − Translation does not support automated synchronization. − There is no reverse translation from Ecore to UML . − Translation targets only one part (Class Diagram) of UML Interfaces, Constraints, Aggregation Future Work − Work on limitations − Check Stability with more test cases − Case study that utilize all features of Kermeta − Adding this translation to Kermeta work bench for Kermeta community 20
21
Recommend
More recommend