1 / 30

Behaviour -Preserving Model Transformation

Behaviour -Preserving Model Transformation. Arend Rensink , University of Twente IPA Spring Days, 18 April 2012. Models in Science. Mathematical model. Physical world. explanation. prediction. description. Models in computer science. Software. Verification. Modelling. Transforation.

ishi
Download Presentation

Behaviour -Preserving Model Transformation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Behaviour-Preserving Model Transformation ArendRensink, University of TwenteIPA Spring Days, 18 April 2012

  2. Models in Science Mathematical model Physical world explanation prediction description Behaviour Preserving Model Transformation

  3. Models in computer science Software Verification Modelling Transforation Behaviour Preserving Model Transformation

  4. Models for software requirements and design Use case diagram Sequence diagram Statechart Class diagram Behaviour Preserving Model Transformation

  5. Models for software implementation • Is this a model? • 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 >= y ? x = x-y yes no Behaviour Preserving Model Transformation

  6. Aspects of models in software development Modelling Language • Definition of modellinglanguage • Definition of model transformation • Definition of languagesemantics Syntax Transfor-mation Modelling Language Modelling Language Semanticdomain Modelling Language Semantics Behaviour Preserving Model Transformation

  7. The role of models in software development Syntax Syntax Syntax Transfor-mation Transfor-mation Program Design Require-ments Semantics Semantics Semanticdomain Behaviour Preserving Model Transformation

  8. Structure of this presentation • 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 Behaviour Preserving Model Transformation

  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 Behaviour 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) Behaviour 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 Behaviour 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 graph Type graph Behaviour Preserving Model Transformation

  13. Graph rewrite rules Putting an element into a circular buffer: • 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 RHS NAC LHS Behaviour Preserving Model Transformation

  14. Single-graph representation black = reader:LHS and RHSto be matched and preserved blue = eraser:LHS, not RHS to be matched and deleted red = embargo:NAC, not LHS forbidden green = creator:RHS, not LHS to be added Behaviour Preserving Model Transformation

  15. Rewrite rule rule morphism LHS RHS NAC NAC NACs forbidden matching source graph target graph graph morphism pushout Graph transition(labelledby rule and underlying morphism Graph productions Behaviour Preserving Model Transformation

  16. Example production RHS NAC LHS 2 1 3 4 1 2 1 2 3 4 3 Behaviour Preserving Model Transformation

  17. Graph Transition Systems put put get get Isomorphic state graphsare collapsed together get get put put Behaviour Preserving Model Transformation

  18. Structure of this presentation • 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 Behaviour Preserving Model Transformation

  19. Behaviour preservation • Behaviour captured by labelled transition systems • Transitions correspond to visible and invisible atomic steps • Labels specify the observable changes • This enables modular description: composition by product • Semantics as a mapping from modelling language to LTSs • Function for language • Behaviour is preserved when LTSs are equivalent • Many existing notions of equivalence • Prominent: trace equivalence, simulation, bisimilarity • Model transformation as a function • Correctness: • is the required equivalence Behaviour Preserving Model Transformation

  20. Behaviour preservation needs semantics Syntax Syntax Syntax Transfor-mation Transfor-mation Program Design Require-ments Semantics Semantics Semanticdomain Behaviour Preserving Model Transformation

  21. Structure of this presentation • 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 Behaviour Preserving Model Transformation

  22. Two laughably simple languages: Syntax Modelling Language • Language A: Featherweight flow graphs • Statements and next-arrows • Language B: Featherweight activity diagrams • Actions and connectors Syntax Instance Type Behaviour Preserving Model Transformation

  23. Language semantics • Language A: Thread-based execution • Language B: Token-based execution next start Semanticdomain Modelling Language Semantics start next-offer next-take Behaviour Preserving Model Transformation

  24. Once more: Behaviour preservation • 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 Behaviour Preserving Model Transformation

  25. Model transformation • 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 Modelling Language A-graph Glue graph B-graph Behaviour Preserving Model Transformation

  26. Laughably simple triple graph grammar A-graphs Glue B-graphs AB-init AB-new-state AB-new-next Behaviour Preserving Model Transformation

  27. Finally: Behaviour preservation • 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) A-graph B-graph A-graph Glue graph B-graph Semantics Semantics Semanticdomain Behaviour Preserving Model Transformation

  28. Structure of this presentation • 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 Behaviour Preserving Model Transformation

  29. Conclusions • 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 Behaviour Preserving Model Transformation

  30. What you should take home Graph grammar Graph grammar Graph grammar Triple graph grammar Triple graph grammar Program Design Require-ments Graph-based semantics Graph-based semantics Graph Transition Systems Behaviour Preserving Model Transformation

More Related