Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity
1. Towards Constraint-Based Model Types:
A Generalised
Formal Foundation for Model Genericity
Steffen Zschaler
22 July 2014
VAO, York
2. Towards Constraint-Based Model Types:
A Generalised
Formal Foundation for Model Genericity
Steffen Zschaler
22 July 2014
VAO, York
3. Reuse in model management
22/07/2014 2
Model transformation specifications
Untyped
• No documentation
of assumptions
• No checking of
applicability for a
given model
Typed over one
specific meta-model
• Only work for models
that instantiate the
particular meta-model
• Need to rewrite
transformation from
scratch for any
similar meta-model.
4. Reuse in model management
22/07/2014 2
Model transformation specifications
Untyped
• No documentation
of assumptions
• No checking of
applicability for a
given model
Typed over one
specific meta-model
• Only work for models
that instantiate the
particular meta-model
• Need to rewrite
transformation from
scratch for any
similar meta-model.
We need a type system that is both sufficiently lax and
sufficiently precise to capture the best of both worlds.
(NB Can think of such model types as views on the
models to be manipulated.)
5. Existing approaches
• Two attempts at such type systems
exist:
– Model Typing (Steel, Guy, Combemale, et al.)
– Model Concepts (de Lara, Guerra, Rose, et
al.)
• All have problems
22/07/2014 3
7. Example problems
22/07/2014 4
mmo NewSM (s : Simple) {
s += new StateMachine ()
}
StateMachine
State
name: String
Transition
event: String
initialState
0..1
containedState *
src
1
tgt
1
incoming
*
*
outgoing
Difference between Simple and Mandatory-startMandatory-start <:Steel Simple
8. Example problems
22/07/2014 4
mmo NewSM (s : Simple) {
s += new StateMachine ()
}
StateMachine
State
name: String
Transition
event: String
initialState
0..1
containedState *
src
1
tgt
1
incoming
*
*
outgoing
Difference between Simple and Mandatory-start
Error: Allows passing in
Mandatory-start instance, but breaks it.
Mandatory-start <:Steel Simple
9. mmo NewSM (s : Mandatory-start) {
sm := new StateMachine () ;
sm.initialState += new State () ;
s += sm
}
Example problems
22/07/2014 4
StateMachine
State
name: String
Transition
event: String
initialState
0..1
containedState *
src
1
tgt
1
incoming
*
*
outgoing
Difference between Simple and Mandatory-startMandatory-start <:Guy Simple
10. mmo NewSM (s : Mandatory-start) {
sm := new StateMachine () ;
sm.initialState += new State () ;
s += sm
}
Example problems
22/07/2014 4
StateMachine
State
name: String
Transition
event: String
initialState
0..1
containedState *
src
1
tgt
1
incoming
*
*
outgoing
Difference between Simple and Mandatory-start
Over-restriction: Would work with any
Simple instance, but cannot specify.
Mandatory-start <:Guy Simple
11. Two general problems
1. Focus on external contracts
– Can validate invocations but not
implementations
2. No formal definition
– Cannot analyse correctness
22/07/2014 5
12. Towards a solution
1. Provide a formalisation
– Explicit type system for model types
– Explicitly include constraints on the structure
of acceptable models
2. Define a notion of an internal contract
– In the paper defined through a set of type
inference rules
– Key really: Dataflow analysis of MMO
implementation
22/07/2014 6
22. Conclusions and Outlook
• Need better understanding of generic
model types
– Internal contracts
– Constraint-based model types may provide
the basis
• Proper formalisation needed
• Limits of data-flow analysis?
22/07/2014 8