Top Banner
Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity Steffen Zschaler 22 July 2014 VAO, York
23

Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Jul 13, 2015

Download

Science

Welcome message from author
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
Page 1: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Towards Constraint-Based Model Types: A Generalised

Formal Foundation for Model Genericity

Steffen Zschaler

22 July 2014

VAO, York

Page 2: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Towards Constraint-Based Model Types: A Generalised

Formal Foundation for Model Genericity

Steffen Zschaler

22 July 2014

VAO, York

Page 3: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

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.

Page 4: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

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.)

Page 5: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

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

Page 6: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example problems

22/07/2014 4

mmo NewSM (s : Simple) {

s += new StateMachine ()

}

Page 7: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example problems

22/07/2014 4

mmo NewSM (s : Simple) {

s += new StateMachine ()

}

StateMachineState

name: String

Transition

event: String

initialState

0..1

containedState *

src

1

tgt

1

incoming

*

*

outgoing

Difference between Simple and Mandatory-startMandatory-start <:Steel Simple

Page 8: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example problems

22/07/2014 4

mmo NewSM (s : Simple) {

s += new StateMachine ()

}

StateMachineState

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

Page 9: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

mmo NewSM (s : Mandatory-start) {

sm := new StateMachine () ;

sm.initialState += new State () ;

s += sm

}

Example problems

22/07/2014 4

StateMachineState

name: String

Transition

event: String

initialState

0..1

containedState *

src

1

tgt

1

incoming

*

*

outgoing

Difference between Simple and Mandatory-startMandatory-start <:Guy Simple

Page 10: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

mmo NewSM (s : Mandatory-start) {

sm := new StateMachine () ;

sm.initialState += new State () ;

s += sm

}

Example problems

22/07/2014 4

StateMachineState

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

Page 11: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

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

Page 12: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

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

Page 13: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example

22/07/2014See paper for type rules

Page 14: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example

22/07/2014See paper for type rules

Page 15: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example

22/07/2014

Statements typed by

their effect on

system states

data flow analysis

States assign model types

to variables (see paper)

See paper for type rules

Page 16: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example

22/07/2014See paper for type rules

Page 17: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example

22/07/2014

Append rule generates

additional constraints.

Here: Forbids mandatory

associations from StateMachine.

See paper for type rules

Page 18: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example

22/07/2014See paper for type rules

Page 19: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example

22/07/2014See paper for type rules

Page 20: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example

22/07/2014See paper for type rules

Page 21: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

Example

22/07/2014See paper for type rules

Page 22: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

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

Page 23: Towards Constraint-Based Model Types: A Generalised Formal Foundation for Model Genericity

QUESTIONS?

Steffen Zschaler

[email protected], @szschaler

22/07/2014 9