Anthony Anjorin DECLARATIVE MODEL TRANSFORMATIONS WITH TRIPLE GRAPH GRAMMARS
https://trello.com
What is “ bx ” /box/? incremental updates model synchronisation … change propagation bx = bidirectional transformations consistency restoration reversible computations Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 4
Model-Driven Engineering Vision: 2066 domain experts should be able to solve problems in their respective domains consistent data exchange powered by bidirectional transformations (bx) using suitable domain specific languages Perdita Stevens: https://youtu.be/sxhGwJkcDuI end users can rely on a consistent software system Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 5
Our Example: A MediWare Application Medication Supply Verification, Task Management Validation or goal Complex System (bidirectional) (bidirectional) Transformations Transformations Model Model Platform a “patient dashboard” application to ensure that the hospital has doctor prescribes a certain adequate supplies, this prescription drug via its generic name is mapped to a concrete brand (e.g., Aspirin ) (e.g., Buffaprin ) Jens H. Weber, Simon Diemert, Morgan Price: Using Graph Transformations for Formalizing Prescriptions and Monitoring Adherence. ICGT 2015: 205-220 Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 6
Our Running Example: A MediWare Application Medication Supply Verification, Task Management Validation or goal Complex System (bidirectional) (bidirectional) Transformations Transformations my models contain some changes I make should be Model Model Platform extra information though! automatically propagated… I only care about I do not want to share my whole prescriptions, everything model. I only want to share what else is irrelevant for me. is absolutely necessary. Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 7
Consistency Maintenance patient information, doctors in the hospital, … prescriptions (via generic names) this must be kept consistent in both models! mapping to concrete brands Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 8
MDE Vision: 2066 MediSoft MediSupply let’s build those wires! Perdita Stevens: https://youtu.be/sxhGwJkcDuI Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 9
The name of the bx game Nodes are models, arrows are deltas, dashed outline indicates derived elements r r A B A B 7 ! 7! bpg fpg a a b b r' r' A' B' B' A' Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 10
What’s a Model Space? Nodes are sets, arrows are total functions assigns every src all deltas in delta a source model space A model id A M A ∆ A also referred to as vertical deltas all models in assigns every trg model space A delta a target model Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 11
What’s a Model Space? Nodes are sets, arrows are total functions src assigns every model an idle delta id A M A ∆ A this will be important later trg Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 12
What’s a Triple Space? Nodes are sets, arrows are total functions all models in model space B trg src M A M B ∆ AB horizontal deltas all models in (or correspondence model space A models) Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 13
What’s a Triple Space? Nodes are sets, arrows are total functions modelspace A src B src A trg src M A M B ∆ B ∆ A ∆ AB trg A trg B R modelspace B R A → B ← Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 14
Symmetric Delta Lenses (SDL) Nodes are sets, arrows are total functions ∆ AB × ∆ B source target model bpg model space space source src A src B models trg src M A M B ∆ AB ∆ B ∆ A source correspondence trg A trg B deltas models fpg ∆ AB × ∆ A an SDL is a pair of functions … with all incidence conditions fpg and bpg operating in a R indicated on previous slide given triple space A → B ← Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 15
A MediSoft < > MediSupply Triple and Deltas trg nodes are sets, src M A M B ∆ AB arrows are functions trg(AB) nodes are models, A AB B arrows are mappings src(AB) :HospitalTo source target :Hospital :DosagePlan DosagePlan name = "Springfield General Hospital" patients doctors dosages pharmaceuticals :Doctor :MedicationTo source target :Aspirin :Dosage Dosage name = "Nick Riviera" Brand = Ascriptin prescribed patients :Patient name = "Lisa" Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 16
A MediSoft < > MediSupply Triple and Deltas trg src M A M B ∆ AB A AB B this is also (in general), a models realised as typed, attributed graph typed, attributed graphs :HospitalTo source target :Hospital :DosagePlan DosagePlan name = "Springfield General Hospital" patients doctors dosages pharmaceuticals :Doctor :MedicationTo source target :Aspirin :Dosage Dosage name = "Nick Riviera" Brand = Ascriptin prescribed patients :Patient name = "Lisa" Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 17
A MediSoft < > MediSupply Triple and Deltas trg src M A M B ∆ AB A AB B this mapping can be realised as a typed graph morphism :HospitalTo source target :Hospital :DosagePlan DosagePlan name = "Springfield General Hospital" patients doctors dosages pharmaceuticals :Doctor :MedicationTo source target :Aspirin :Dosage Dosage name = "Nick Riviera" Brand = Ascriptin prescribed patients :Patient name = "Lisa" Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 18
:HospitalTo source target :Hospital :DosagePlan DosagePlan name = "Springfield General Hospital" patients doctors pharmaceuticals :Doctor :Aspirin name = "Nick Riviera" patients :Patient name = "Lisa" one could also choose to have vertical deltas on correspondence models :HospitalTo source target :Hospital :DosagePlan DosagePlan name = "Springfield General Hospital" patients doctors dosages pharmaceuticals :Doctor :MedicationTo source target :Aspirin :Dosage Dosage name = "Nick Riviera" Brand = Ascriptin prescribed patients :Patient name = "Lisa"
Specifying SDLs R A → B ← given a triple space, how do we specify an SDL? r r A B A B Idea 1: 7 ! 7! bpg fpg Enumerate all squares: a a b b r' r' A' B' B' A' not really feasible… but why not? Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 20
Exhaustive Enumeration :HospitalTo source target :Hospital :DosagePlan DosagePlan name = "Springfield General Hospital" patients doctors pharmaceuticals :Doctor :Aspirin name = "Nick Riviera" patients :Patient name = "Lisa" Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 21
:HospitalTo source target :Hospital :DosagePlan DosagePlan name = "Springfield General Hospital" patients doctors pharmaceuticals :Doctor :Aspirin name = "Nick Riviera" patients 7! :Patient fpg name = "Lisa" :HospitalTo source target :DosagePlan :Hospital DosagePlan name = "Springfield General Hospital" dosages patients doctors pharmaceuticals :Doctor :MedicationTo source target :Dosage :Aspirin Dosage name = "Nick Riviera" Brand = Ascriptin patients prescribed :Patient name = "Lisa"
Simultaneous , exhaustive enumeration r A B Idea 2: ! ! 7 7 Enumerate all squares representing a b combined fpg and bpg squares bpg fpg r' B' A' still infeasible, but quite a nice idea… Why? • promotes “symmetrical” thinking and avoids favouring either fpg or bpg • easier to enforce “good” lens specifications • we obviously only have to enumerate half of all squares (still typically infinitely many) Anthony Anjorin: Declarative Model Transformations with Triple Graph Grammars 23
:HospitalTo source target :Hospital :DosagePlan DosagePlan name = "Springfield General Hospital" patients doctors pharmaceuticals :Doctor :Aspirin 7! 7! name = "Nick Riviera" patients :Patient name = "Lisa" bpg fpg :HospitalTo source target :DosagePlan :Hospital DosagePlan name = "Springfield General Hospital" dosages patients doctors pharmaceuticals :Doctor :MedicationTo source target :Dosage :Aspirin Dosage name = "Nick Riviera" Brand = Ascriptin patients prescribed :Patient name = "Lisa"
Recommend
More recommend