Graphical Definition of In-Place Transformations in the Eclipse - - PowerPoint PPT Presentation

graphical definition of in place transformations in the
SMART_READER_LITE
LIVE PREVIEW

Graphical Definition of In-Place Transformations in the Eclipse - - PowerPoint PPT Presentation

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework Enrico Biermann, Karsten Ehrig, Christian Khler, Gnter Kuhns, Gabriele Taentzer, Eduard Weiss Technical University of Berlin University of Leicester A


slide-1
SLIDE 1

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework

Enrico Biermann, Karsten Ehrig, Christian Köhler, Günter Kuhns, Gabriele Taentzer, Eduard Weiss Technical University of Berlin University of Leicester

slide-2
SLIDE 2

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 2

A fictious dialog on models

  • We made good experiences with model-driven

software development. It‘s much faster!

  • Good to hear! That‘s what I told you from the

beginning.

  • But I think our models could be better.
  • You could test the model smell and check out model

refactoring.

  • Okay! That means we can improve our models by

transformation?

  • Yes, you need some in-place model transformer.
slide-3
SLIDE 3

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 3

Synopsis

Eclipse Modeling Framework EMF model transformer in-place model updates graphical definition

  • f transformation rules

analysis and validation of transformations

slide-4
SLIDE 4

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 4

Outline

  • What is the Eclipse Modeling Framework (EMF)?
  • EMF transformation concepts
  • Running example: EMF model refactoring
  • Execution of EMF transformations

– Interpreter mode – Compiler mode

  • Related work
  • Conclusions
slide-5
SLIDE 5

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 5

Eclipse Modeling Framework (EMF)

EMF class diagram EMF Generator set of Java classes for manipulating the model basic tree-based editor uses XMI

slide-6
SLIDE 6

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 6

EMF and MetaObject Facility (MOF)

  • EMF consists of a metamodel and technology mappings like

MetaObject Facility (MOF).

  • MOF is the basis for a couple of language definitions by the

Object Management Group (OMG), including UML 2.

Ecore Essential MOF Complete MOF EMF MOF Metamodels Technology Mappings XML / XMI, Java (Implementations) XMI, CORBA IDL (Interfaces)

slide-7
SLIDE 7

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 7

Eclipse Modeling Framework (EMF)

Ecore Metamodel: Classes, references and properties

slide-8
SLIDE 8

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 8

Transformation Model for EMF

EMF Source Model EMF Core Model ECore instance of instance of Transformation Rules instance of applied instance of Transformation Model instance of typed over EMF Target Model

slide-9
SLIDE 9

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 9

Sample EMF Model Refactoring

Two refactorings:

  • new superclass „NamedElement“ for classes „Place“, „PetriNet“, and „Transition“
  • pull up attribute „name“ to class „NamedElement“
slide-10
SLIDE 10

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 10

A simple refactoring rule for Ecore

Create a new superclass for a given class

slide-11
SLIDE 11

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 11

Transformation Model for EMF

  • influenced by graph

transformation due to validation facilities

  • LHS checks existence
  • f pattern
  • NACs check non-

existence of any pattern

  • difference between

LHS and RHS defines actions

slide-12
SLIDE 12

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 12

Transformation Model for EMF

  • mappings are defined as LHS -> RHS or LHS -> NAC
  • non-injective mappings, i.e. gluings, are allowed
slide-13
SLIDE 13

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 13

A simple refactoring rule for Ecore

Move a class from one package to another Similar: move attribute, create superclass, connect superclass, rename parameter, add /remove parameter, etc.

slide-14
SLIDE 14

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 14

A complex Ecore refactoring – Pull up attribute

  • 1. Check if all subclasses contain the attribute to be pulled up
slide-15
SLIDE 15

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 15

A complex Ecore refactoring – Pull up attribute

  • 2. If all subclasses have the attribute, then pull it up
slide-16
SLIDE 16

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 16

A complex Ecore refactoring – Pull up attribute

  • 3. After pulling up, delete the attribute in all subclasses.
slide-17
SLIDE 17

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 17

A complex Ecore refactoring – Pull up attribute

  • 4. If there are still annotations, delete them.
slide-18
SLIDE 18

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 18

How to perform EMF model transformations?

1. Create an AGG type graph from an EPackage 2. Convert the EMF rules to AGG rules 3. Convert an EMF instance to AGG graph 4. Apply a rule in AGG / validate rules 5. Translate AGG graph back to EMF 6. Check and repair consistency

Interpreter:

1. Create Java code from rules, one class per rule 2. Execute rules on EMF model instances or on EMF models (instances

  • f Ecore meta-model)

Compiler:

slide-19
SLIDE 19

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 19

Code Snippet for Rule Application

ResourceSet resourceSet = new ResourceSetImpl(); Resource resource =resourceSet.getResource(URI.createFileURI( "src/Ecore/instances/petrimodel.ecore"), true); EPackage model = (EPackage) resource.getContents().get(0); // create the new superclass CreateSuperclassRule createSC = new CreateSuperclassRule(model); createSC.setParA(true); createSC.setParC("PetriNet"); createSC.setParS("NamedElement"); createSC.execute();

slide-20
SLIDE 20

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 20

Consistency of EMF Refactorings

  • coherent refactoring of model and code

– no problem if purely model-driven

  • refactoring result is syntactically correct
  • refactoring result fullfills validation properties

– for validation based on graph transformation:

consistence of EMF transformation with graph transformation conflict and dependency analysis of rule applications, termination checks, etc.

slide-21
SLIDE 21

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 21

Related Work

EMF-related:

  • Merlin
  • Eclipse GMT-Project:

– Tefkat – ATL – UMLX – ViaTra2

  • MOMENT

Graph transformation-related:

  • AToM3
  • GReAT
  • VMTS
  • ViaTra2
  • Gmorph
  • MOFLON
  • MOTMOT
slide-22
SLIDE 22

Graphical Definition of In-Place Transformations in the Eclipse Modeling Framework 22

Conclusion and Future Work

  • EMF model transformations as in-place model updates
  • Interpreter/Compiler for EMF transformations
  • Visual definition of transformation rules
  • Consistency of EMF transformation with graph transformation
  • ffers validation facilities

Future work:

  • Complete and integrate transformation engine and editor
  • Implement checks for possible containment constraint violations
  • Consider different applications:

– Complex Editing Operations (Eclipse GMF), Simulation, Optimizations