Download presentation
Presentation is loading. Please wait.
Published byTracey Gibbs Modified over 9 years ago
1
Behaviour-Preserving Model Transformation Arend Rensink, University of Twente IPA Spring Days, 18 April 2012
2
Models in Science 2 18 April 2012Behaviour Preserving Model Transformation Physical world Mathematical model explanation prediction description
3
Models in computer science 18 April 2012Behaviour Preserving Model Transformation 3
4
Use case diagram Sequence diagram Class diagram Statechart Models for software requirements and design 18 April 2012Behaviour Preserving Model Transformation 4
5
Models for software implementation 18 April 2012Behaviour Preserving Model Transformation 5 Is this a model? Claim: Textual and graphical models only differ in concrete syntax Compilation is a special case of model transformation while (x >= y) x = x – y; x = x-y x >= y ? yes no
6
Definition of modelling language Definition of model transformation Definition of language semantics Syntax Modelling Language Aspects of models in software development 18 April 2012Behaviour Preserving Model Transformation 6 Semantic domain Modelling Language Semantics Transfor- mation Modelling Language
7
Transfor- mation Syntax Semantics Require- ments Design Semantic domain Transfor- mation Program Semantics Syntax The role of models in software development 18 April 2012Behaviour Preserving Model Transformation 7
8
Structure of this presentation 18 April 2012Behaviour Preserving Model Transformation 8 Models in Software Engineering Syntax, semantics, transformation Graph Transformation Provides uniform framework Behaviour preservation Observational equivalence Examples Graph-based syntax and semantics Triple graph-based model transformation Conclusion What you should take home
9
9 Graph Transformation Formalism to capture dynamics of graph-like structures Transformation rules embody predefined changes to graphs Aim: Provide a universal modelling framework All elements in previous slides can be formalised: Syntax: Syntax graphs + graph grammar Transformation: Syntax graphs + transformation rules Semantics: States + operational semantics Why graph transformation? Very powerful, widely applicable paradigm Graphs are natural for the software modelling domain Capture the essentials of (many) discrete structures Direct capabilities for visualisation 18 April 2012Behaviour Preserving Model Transformation
10
18 April 2012Behaviour Preserving Model Transformation 10 Graphs as models Example state graph Nodes represents objects Edges represent fields or relations between objects Here: Circular buffer Objects inserted at the tail (last element) Objects removed from the head (first element)
11
18 April 2012Behaviour Preserving Model Transformation 11 Type graphs as metamodels Compare with (UML) class diagrams Nodes stand for object types Also supported: Node inheritance Edges stand for field/relation types Also supported: Multiplicities
12
18 April 2012Behaviour Preserving Model Transformation 12 Relation between instance and type graphs Typing is a (weak) structuring mechanism Limits node and edge labels and their interconnection May enforce presence of edges through multiplicities State graphType graph
13
18 April 2012Behaviour Preserving Model Transformation 13 Graph rewrite rules A rule embodies a particular change to a graph Left Hand Side (LHS): should be matched in the host (source) graph Difference of Right Hand Side (RHS) and LHS defines change Negative Application Condition (NAC): should not occur in host graph Compare to string rewriting Graph rewrite rules are context sensitive Graph Production System: Set of rewrite rules LHS RHS NAC Putting an element into a circular buffer:
14
18 April 2012Behaviour Preserving Model Transformation 14 Single-graph representation blue = eraser: LHS, not RHS to be matched and deleted green = creator: RHS, not LHS to be added black = reader: LHS and RHS to be matched and preserved red = embargo: NAC, not LHS forbidden
15
18 April 2012Behaviour Preserving Model Transformation 15 forbidden Graph productions Rewrite rule source graph matching Graph transition (labelled by rule and underlying morphism graph morphism target graph pushout NAC NACs LHSRHS rule morphism
16
18 April 2012Behaviour Preserving Model Transformation 16 Example production LHS RHS NAC 1 1 2 3 3 2 4 4 1 3 2
17
18 April 2012Behaviour Preserving Model Transformation 17 Graph Transition Systems put get Isomorphic state graphs are collapsed together
18
Structure of this presentation 18 April 2012Behaviour Preserving Model Transformation 18 Models in Software Engineering Syntax, semantics, transformation Graph Transformation Provides uniform framework Behaviour preservation Observational equivalence Examples Graph-based syntax and semantics Triple graph-based model transformation Conclusion What you should take home
19
Behaviour preservation 18 April 2012Behaviour Preserving Model Transformation 19
20
Transfor- mation Syntax Semantics Require- ments Design Semantic domain Transfor- mation Program Semantics Syntax Behaviour preservation needs semantics 18 April 2012Behaviour Preserving Model Transformation 20
21
Structure of this presentation 18 April 2012Behaviour Preserving Model Transformation 21 Models in Software Engineering Syntax, semantics, transformation Graph Transformation Provides uniform framework Behaviour preservation Observational equivalence Examples Graph-based syntax and semantics Triple graph-based model transformation Conclusion What you should take home
22
Two laughably simple languages: Syntax 18 April 2012Behaviour Preserving Model Transformation 22 Language A: Featherweight flow graphs Statements and next-arrows Language B: Featherweight activity diagrams Actions and connectors Type Instance Syntax Modelling Language
23
Language semantics 18 April 2012Behaviour Preserving Model Transformation 23 Language A: Thread-based execution Language B: Token-based execution start next start next-offer next-take Semantic domain Modelling Language Semantics
24
Once more: Behaviour preservation 18 April 2012Behaviour Preserving Model Transformation 24 Initial thought: use rule names as transition labels Does not work: rule names chosen for understandability Names for comparable activities may differ between languages For instance: A’s next does not correspond to B’s next-* actions Refinement: allow relabelling between semantics Map actions of one language onto that of the other In LTS: make (sequences of) transitions unobservable or atomic In this example: two possibilities Rename one of B’s next-* to next and make the other invisible Combine next-offer + next-take into single atomic action
25
Model transformation 18 April 2012Behaviour Preserving Model Transformation 25 In general, transformation occurs between different languages In-place (endogenous) or side-by-side (exogenous) For traceability, exogenous is to be preferred Triple graph: composition of Syntax graph of language A Syntax graph of language B Glue graph: connects A-elements with B-elements (tracing) Triple graph grammar: builds A- and B-models + glue simultaneously Each triple graph can be projected onto source and target graph Transfor- mation Modelling Language A-graph B-graph Glue graph
26
Laughably simple triple graph grammar 18 April 2012Behaviour Preserving Model Transformation 26 AB-init AB-new-state AB-new-next A-graphsGlueB-graphs
27
Finally: Behaviour preservation 18 April 2012Behaviour Preserving Model Transformation 27 For every combined graph produced by the triple graph grammar … … if we project to the A- and B-models … … and compute the corresponding LTS using the semantic rules … … and apply action relabelling … … then the LTSs are weakly bisimilar (Full Semantics Preservation in Model Transformation – A Comparison of Proof Techniques, IFM 2010) Semantics Semantic domain Semantics A-graph B-graph Glue graph A-graph B-graph
28
Structure of this presentation 18 April 2012Behaviour Preserving Model Transformation 28 Models in Software Engineering Syntax, semantics, transformation Graph Transformation Provides uniform framework Behaviour preservation Observational equivalence Examples Graph-based syntax and semantics Triple graph-based model transformation Conclusion What you should take home
29
Conclusions 18 April 2012Behaviour Preserving Model Transformation 29 Modelling is the new programming We should take our models more seriously Compilation is a special case of model transformation Distinction between textual and graphical languages is artificial Learn (more) lessons from compiler construction Behaviour preservation is a tough proof obligation Universally quantified over all models in a language Requires semantics of modelling languages Alternative: run-time verification
30
18 April 2012Behaviour Preserving Model Transformation 30 What you should take home Triple graph grammar Graph grammar Graph-based semantics Require- ments Design Graph Transition Systems Triple graph grammar Program Graph-based semantics Graph grammar
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.