ARTIST2 - MOTIVES ARTIST2 - MOTIVES Trento - Italy, February 19-23, 2007 Trento - Italy, February 19-23, 2007 Model Transformation and Model Transformation and UML UML Reiko Heckel Reiko Heckel University of Leicester, UK University of Leicester, UK Foundations of Model Transformation
38
Embed
ARTIST2 - MOTIVES Trento - Italy, February 19-23, 2007 Model Transformation and UML Reiko Heckel University of Leicester, UK Foundations of Model Transformation.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
ARTIST2 - MOTIVESARTIST2 - MOTIVESTrento - Italy, February 19-23, 2007Trento - Italy, February 19-23, 2007
Model Transformation and Model Transformation and
UMLUML
Reiko HeckelReiko Heckel
University of Leicester, UKUniversity of Leicester, UK
Foundations of
Model
Transformation
Motivation: Model-driven Engineering
● Focus and primary artifacts are models instead of programs
● Core activities include
– maintaining consistency
– evolution
– translation
– execution
of models
● These are examples of model transformations
● A math. foundation is needed for studying
– expressiveness and complexity
– execution and optimisation
– well-definedness
– preservation of semantics
of transformations
● Graph transformations can be one such foundation
Outline
● Graph Transformation– why it is fun
– how it works
● Semantics-preserving Model Transformation
Why it is fun: Programming By Example
StageCast (www.stagecast.com): a visual programming environment for kids (from 8 years on), based on
– behavioral rules associated to graphical objects
– visual pattern matching
– simple control structures (priorities, sequence, choice, ...)
– external keyboard control
intuitive rule-based behavior modelling
Next: abstract from concrete visual presentation
States of the PacMan Game:Graph-Based Presentation
:Ghost
:Field
:Field :Field
:Field
:Field
:Field
:PacManmarbles=3
instance graph(represents a single state; abstracts from spatial layout)
type graph(specifies legalinstance graphs)
:Marble
typingtyping
FieldPacMan
marbles:intGhost
Marble
1
11 *
*
*
Rules of the PacMan Game:Graph-Based Presentation, PacMan
f1:Field f2:Field
pm:PacMan
f1:Field f2:Field
pm:PacManmovePM
pm:PacManmarbles=m
f1:Field f2:Field
:Marble
f1:Field f2:Field
pm:PacManmarbles=m+1collect
Rules of the PacMan Game:Graph-Based Presentation, Ghost
f1:Field f2:Field
g:Ghost
f1:Field f2:Field
g:GhostmoveGhost
g:Ghost
f1:Field f2:Field
:PacMan
f1:Field f2:Field
g:Ghostkill
Outline
● Graph Transformation why it is fun
– how it works
● Semantics-preserving Model Transformation
A Basic Formalism: Typed Graphs
Directed graphs
– multiple parallel edges
– undirected edges as pairs of directed ones
Graph homomorphism as mappings preserving source and target
Typed graphs given by
– fixed type graph TG
– instance graphs G typed over TG by homomorphism g
g:Ghost:Field
:Field :Field
:Field
:Field
f:Field
gg
FieldPacMan
marbles:intGhost
Marble
G
TG
Rules
p: L R with L R well-defined, in different presentations– like above (cf. PacMan example)– with L R explicit [DPO]: L K R
f1:Field f2:Field
pm:PacManmovePM:
f1:Field f2:Field
pm:PacMan
Rules
p: L R with L R well-defined, in different presentations– like above (cf. PacMan example)– with L R explicit [DPO]: L K R– with L, R integrated [UML, Fujaba]:
L R and marking● L - R as destroyed ● R - L as new
f1:Field f2:Field
pm:PacManmovePM:
{destroyed} {new}
Transformation Step
1. select rule p: L R ; occurrence oL: L G
2. remove from G the occurrence of L\ R
3. add to result a copy of R \ L
f1:Field
f2:Fieldpm:PacManmarbles=3
m2:Marble
oL
G
L Rppm:PacManmarbles=m
f2:Field f1:Field
m1:Marble
f2:Field f1:Field
pm:PacManmarbles=m+1
f3:Field
m1:Marble
oR
pm:PacManmarbles=4
H f1:Field
f2:Field
m2:Marblef3:Field
Semantic Questions: Dangling Edges
● conservative solution: application is forbidden– invertible transformations, no side-effects
● radical solution: delete dangling edges– more complex behavior, requires explicit control
a:A
a:A :B ??
A bit of History …
Chomsky Grammars
Term Rewriting
PetriNets
Graph Transformation and Graph Grammars
DiagramLanguages
BehaviourModelling and
Visual Programming
Models ofComputation
Outline
Graph Transformation why it is fun
how it works
● Semantics-preserving Model Transformation– operational
– denotational
AbstractSyntax
SemanticDomain
denotationalsemantics
operationalsemantics
transformation
Example: Executable Business Process
● refactoring of business processes, replacing centralised by distributed execution
● How to demonstrate preservation of behaviour?
1. specify operational semantics of processes
2. define transformations
3. show that transformations preserve semantics
Receiveorder
Undoorder
Shipment
Warehouse Office
Operational Semantics: Idea
● diagram syntax plus runtime state● GT rules to model state transitions