a generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/slides/rabbi.pdf ·...

60
A generalization of termination conditions for partial model completion Fazle Rabbi 1,2 Yngve Lamo 1 Lars Michael Kristensen 1 Ingrid Chieh Yu 2 1 Bergen University College, Bergen, Norway 2 University of Oslo, Oslo, Norway [email protected], [email protected], ingridcy@ifi.uio.no, [email protected] October 22, 2015 Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 1 / 60

Upload: others

Post on 18-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

A generalization of termination conditions for partialmodel completion

Fazle Rabbi1,2 Yngve Lamo1 Lars Michael Kristensen1

Ingrid Chieh Yu2

1Bergen University College, Bergen, Norway2University of Oslo, Oslo, Norway

[email protected], [email protected], [email protected],[email protected]

October 22, 2015

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 1 / 60

Page 2: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Introduction: Why do we need Domain-specificlanguages (DSLs)?

DSLs are - tailored to a specific application domain.- used to capture domain-specific knowledge and concepts.- expressive.- easy to use.

Development of domain models require domain specific languages

Figure : MDE focuses on exploiting domain models

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 2 / 60

Page 3: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Introduction: How to develop DSLs?

conforms to

Figure : How to develop domain specific modelling languages

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 3 / 60

Page 4: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Introduction: Complexity of developing DSLs

conforms to

Meta-modelConstraints

DSLdevelopment is hard, requiring - language development skill - domain knowledge

Model

Figure : Metamodelling for DSL development

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 4 / 60

Page 5: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Introduction: Consistency management

Caregiver Department

Ward

caregiversdepartments

Bryan Emergency

Ward10

(a)

(b)

M1

1..**

wards

department1..1

*

caregivers

worksAt *

*

context Wardinv rule: self.caregivers -> includesAll(self.department.caregivers)

M2

Attached OCL constraint

Figure : (a) Model M2, (b) a partial model M1 (not conforming to M2)

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 5 / 60

Page 6: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Introduction: Consistency management

conforms to

Meta-modelConstraints

INCONSIS

TENT ?

Model

Figure : Inconsistent model

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 6 / 60

Page 7: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Introduction: Consistency management

conforms to

Meta-modelConstraints

Completionrules

Apply Completion rules...

Model

Completion rules may 1. automatically fix an inconsistent model2. increase modelling efficiency

Figure : Consistency management by fixing inconsistencies

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 7 / 60

Page 8: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Challenges

conforms to

Meta-model

Constraints

Completionrules

Apply Completion rules...

Can we reuse completion rules ?

Will it Terminate ?

Can we automatically construct completion rules by processing constraints ?

Will it always find a consistent model ?

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 8 / 60

Page 9: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Multilevel metamodelling

conforms to

Model

conforms to

Model

conforms to

Model

Metamodel stack

Figure : Multilevel metamodelling

Multilevel metamodelling offers aclean, simple and coherentsemantics for metamodelling[Atkinson and Kuhne, 2001]It is an essential requirement forthe development ofdomain-specific modellinglanguages

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 9 / 60

Page 10: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Diagram Predicate Framework (DPF) [Rutle, 2010]

ClassData Type AttributeReference

Node Arrow

Typing

Typing

Patient Caregiver Department

Ward

Typing

wardPats

dataAccess

empDeps

depEmps

wardDepswardEmps

[COMP] [COMP]

[INV]

[1.. ]8 [1..1]

Predicate, p

1

(p)

[mult(n,m)]

[inverse]

[composite]

X Y

X Y

X Z

Y

gf

hConstraint

2

3

f

f

g

Semantic interpretation of [composite]:For each instance of (f; g ),there exists an instance of h.

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 10 / 60

Page 11: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Diagram Predicate Framework (DPF) [Rutle, 2010]

ClassData Type AttributeReference

Node Arrow

Typing

Typing

Patient Caregiver Department

Ward

Typing

wardPats

dataAccess

empDeps

depEmps

wardDepswardEmps

[COMP] [COMP]

[INV]

[1.. ]8 [1..1]

Predicate, p

1

(p)

[mult(n,m)]

[inverse]

[composite]

X Y

X Y

X Z

Y

gf

hConstraint

2

3

f

f

g

Semantic interpretation of [inverse]:For each instance of f thereexists an instance of g or vice

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 11 / 60

Page 12: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Diagram Predicate Framework (DPF) [Rutle, 2010]

ClassData Type AttributeReference

Node Arrow

Typing

Typing

Patient Caregiver Department

Ward

Typing

wardPats

dataAccess

empDeps

depEmps

wardDepswardEmps

[COMP] [COMP]

[INV]

[1.. ]8 [1..1]

Predicate, p

1

(p)

[mult(n,m)]

[inverse]

[composite]

X Y

X Y

X Z

Y

gf

hConstraint

2

3

f

f

g

Semantic interpretation of [mult(n,m)]:f must have at least n and at most m instances

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 12 / 60

Page 13: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Diagram Predicate Framework (DPF) [Rutle, 2010]

Patient Caregiver Department

Ward

Typing,

wardPats

dataAccess

empDeps

depEmps

wardDepswardEmps

[COMP] [COMP]

[INV]

[1.. ]8 [1..1]

1

John Bryan Emergency

Ward10

:wardEmps

:wardDeps:wardPats

I

Figure : Conformance checking

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 13 / 60

Page 14: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Diagram Predicate Framework (DPF) [Rutle, 2010]

Patient Caregiver Department

Ward

Typing,

wardPats

dataAccess

empDeps

depEmps

wardDepswardEmps

[COMP] [COMP]

[INV]

[1.. ]8 [1..1]

1

John Bryan Emergency

Ward10

:wardEmps

:wardDeps:wardPats

I

g

X

Y

f

hZ

0([composite]) 1

Bryan Emergency

Ward10

:wardEmps:wardDeps

*

1*

PB

Figure : Pullback αΣ0 ([composition])ι∗←− O∗

δ∗1−−→ I of αΣ0 ([composition])

δ1−−→ S ι

←− I

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 14 / 60

Page 15: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

An inconsistent instance

Figure : An inconsistent instanceFazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 15 / 60

Page 16: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Diagrammatic model completion

Diagrammatic model completion is based on completion rulesCompletion rules are typed coupled transformation rulesType graphs of completion rules are not changed by thetransformationCompletion rules are linked to predicatesCompletion rules are applied to a partial model to correctinconsistenciesWe use the standard double-pushout (DPO) approach[Ehrig, 2006] for defining completion rules.

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 16 / 60

Page 17: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Diagrammatic model completion

Diagrammatic model completion is based oncompletion rules

Completion rules are typed coupledtransformation rules

Type graphs of completion rules are notchanged by the transformation

Completion rules are linked to predicates

Completion rules are applied to a partial modelto correct inconsistencies

We use the standard double-pushout (DPO)approach [Ehrig, 2006] for defining completionrules.

Figure : A completion rule

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 17 / 60

Page 18: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Diagrammatic model completion

Diagrammatic model completion is based oncompletion rules

Completion rules are typed coupledtransformation rules

Type graphs of completion rules are notchanged by the transformation

Completion rules are linked to predicates

Completion rules are applied to a partial modelto correct inconsistencies

We use the standard double-pushout (DPO)approach [Ehrig, 2006] for defining completionrules.

X

Y

Z

g f

h

[comp]

([composite])

LHS (L)N RHS (R)

Typing

x

y

z

:f

:h

:g

x

y

z

:f:g

x

y

z

:f

:h

:g

x

y

z

:f:g

Glue (K)

Figure : A transformation rule is linked tothe [composite] predicate

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 18 / 60

Page 19: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Diagrammatic model completion

Diagrammatic model completion is based oncompletion rules

Completion rules are typed coupledtransformation rules

Type graphs of completion rules are notchanged by the transformation

Completion rules are linked to predicates

Completion rules are applied to a partial modelto correct inconsistencies

We use the standard double-pushout (DPO)approach [Ehrig, 2006] for defining completionrules.

X

Y

Z

g f

h

[COMP]

([composite])

Typing

x:X z:Z

y:Y

:f:g

:h

Figure : A completion rule

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 19 / 60

Page 20: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Diagrammatic model completion

Table : Completion scheme for predicates and completion rules of S1

Cp ζ(Cp ) Interpretation

[inv-com〉[inv]

X Yg

f

[INV]

([inverse])

Typing

x:X y:Y

:g

:f

X Yg

f

[INV]

([inverse])

Typing

x:X y:Y

:g

:f

derive an edge y:g−−→ x (if it does not

exist) from the existence of an edge

x :f−→ y or vice versa.

[comp-com〉[comp]

X

Y

Z

g f

h

[COMP]

([composite])

Typing

x:X z:Z

y:Y

:f:g

:h

derive an edge x :h−−→ z (if it does

not exist) from the existence of edges

x:g−−→ y and y :f

−→ z.

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 20 / 60

Page 21: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Application of a completion rule

(p)

N

N

(p)

L

L

(p)

K

K

(p)

R

R

id id id

n k l

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 21 / 60

Page 22: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Application of a completion rule

(p)

N

N

(p)

L

L

(p)

K

K

(p)

R

R

id id id

n k l

S

S

i

Si-1

i

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 22 / 60

Page 23: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Application of a completion rule

(p)

N

N

(p)

L

L

(p)

K

K

(p)

R

R

id id id

n k l

S

S

i

Si-1

im (p)

L

L

S

S

i

Si-1

i

m

=

Match of a completion rule

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 23 / 60

Page 24: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Application of a completion rule

(p)

N

N

(p)

L

L

(p)

K

K

(p)

R

R

id id id

n k l

S

S

i

Si-1

im (p)

L

L

S

S

i

Si-1

i

m

=

Match of a completion rule

A match (δ,m) is given by an atomic constraint δ : αΣ(p)→ Si−1 and a match m : L → Si such that the constraint δ and

match m together with typing morphisms ιL : L → αΣ(p) and ιSi: Si → Si−1 constitute a commuting square: ιL ; δ = m; ιSi

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 24 / 60

Page 25: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Application of a completion rule

(p)

N

N

(p)

L

L

(p)

K

K

(p)

R

R

id id id

n

S

S

i

Si-1

imq

=

(δ,m) |= NAC if there does not exists an injective morphism q : N → Si with n; q = m such that the typing morphisms

ιN : N → αΣ(p) and ιSi: Si → Si−1 constitute a commuting square ιN ; δ = q; ιSi

.

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 25 / 60

Page 26: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Application of a completion rule

(p)

N

N

(p)

L

L

(p)

K

K

(p)

R

R

id id id

n

S

S

i

Si-1

im

S'i

Si-1

S*i

Si-1

m*q (PO1) (PO2)=

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 26 / 60

Page 27: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Example: Application of a completion rule

Caregiver Department

Ward

Patient

empDeps

depEmps

wardDeps

Bryan Emergency

:wardEmps

:wardDeps

dataAccess

wardEmps

wardPats

John

:wardPatsSi

con

stra

int,

injective morphism, m

Ward10

X Z

Y f

g

h

y :f:g

x z

X

Y

Z

g f

h

[comp]

([composite])

LHS (L)N RHS (R)

Typing

x

y

z

:f

:h

:g

x

y

z

:f:g

x

y

z

:f

:h

:g

x

y

z

:f:g

Glue (K)

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 27 / 60

Page 28: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Example: Application of a completion rule

Caregiver Department

Ward

Patient

empDeps

depEmps

wardDeps

Bryan Emergency

:wardEmps

:wardDeps

dataAccess

wardEmps

wardPats

John

:wardPatsSi

con

stra

int,

injective morphism, m

Ward10

X Z

Y f

g

h

y :f:g

x z

X

Y

Z

g f

h

[comp]

([composite])

LHS (L)N RHS (R)

Typing

x

y

z

:f

:h

:g

x

y

z

:f:g

x

y

z

:f

:h

:g

x

y

z

:f:g

Glue (K)

injective morphism, q

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 28 / 60

Page 29: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Example: Application of a completion rule

Caregiver Department

Ward

Patient

empDeps

depEmps

wardDeps

Bryan Emergency

:wardEmps

:wardDeps

dataAccess

wardEmps

wardPats

John

:wardPatsSi

con

stra

int,

injective morphism, m

Ward10

X Z

Y f

g

h

y :f:g

x z

X

Y

Z

g f

h

[comp]

([composite])

LHS (L)N RHS (R)

Typing

x

y

z

:f

:h

:g

x

y

z

:f:g

x

y

z

:f

:h

:g

x

y

z

:f:g

Glue (K)

injective morphism, q

:empDeps

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 29 / 60

Page 30: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Example: Application of a completion rule

Caregiver Department

Ward

Patient

empDeps

depEmps

wardDeps

Bryan Emergency

:wardEmps

:wardDeps

dataAccess

wardEmps

wardPats

John

:wardPatsSi

con

stra

int,

injective morphism, m

Ward10

X Yf

:fx y

LHS (L)N RHS (R)

Typing

Glue (K)

:empDeps

X Y

g

f

[INV]

([inverse])

x y

:f

:g

x y

:f

x y

:f

x y

:f

:g

g

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 30 / 60

Page 31: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Example: Application of a completion rule

Caregiver Department

Ward

Patient

empDeps

depEmps

wardDeps

Bryan Emergency

:wardEmps

:wardDeps

dataAccess

wardEmps

wardPats

John

:wardPatsSi

con

stra

int,

injective morphism, m

Ward10

X Yf

:fx y

LHS (L)N RHS (R)

Typing

Glue (K)

injective morphism, q

:empDeps

X Y

g

f

[INV]

([inverse])

x y

:f

:g

x y

:f

x y

:f

x y

:f

:g

g

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 31 / 60

Page 32: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Example: Application of a completion rule

Caregiver Department

Ward

Patient

empDeps

depEmps

wardDeps

Bryan Emergency

:wardEmps

:wardDeps

dataAccess

wardEmps

wardPats

John

:wardPatsSi

con

stra

int,

injective morphism, m

Ward10

X Yf

:fx y

LHS (L)N RHS (R)

Typing

Glue (K)

injective morphism, q

:empDeps

X Y

g

f

[INV]

([inverse])

x y

:f

:g

x y

:f

x y

:f

x y

:f

:g

g

:g:depEmps

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 32 / 60

Page 33: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Example: Application of a completion rule

Caregiver Department

Ward

Patient

empDeps

depEmps

wardDeps

Bryan Emergency

:wardEmps

:wardDeps

dataAccesswardEmps

wardPats

John

:wardPatsSi

Ward10

:empDeps

:depEmps:dataAccess

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 33 / 60

Page 34: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Example: Application of a completion rule that deleteselements

Caregiver Department

Ward

Patient

empDeps

depEmps

wardDeps

Bryan Emergency

:wardEmps

:wardDeps

dataAccess

wardEmps

wardPats

John

:wardPatsSi

con

stra

int,

injective morphism, m

Ward10

X

Y

f

f1x

y

LHS (L) RHS (R)

Typing

Glue (K)

:empDeps

X Yf [1..1]

([mult[n,m]])

x:X y:Yf1:f

:depEmps

z:Yf2:f

x:X y:Yf1:f

z:Y

x:X y:Yf1:f

z:Y

Cardiologyz

:wardDepsf2

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 34 / 60

Page 35: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Example: Application of a completion rule that deleteselements

Caregiver Department

Ward

Patient

empDeps

depEmps

wardDeps

Bryan Emergency

:wardEmps

:wardDeps

dataAccess

wardEmps

wardPats

John

:wardPatsSi

con

stra

int,

injective morphism, m

Ward10

X

Y

f

f1x

y

LHS (L) RHS (R)

Typing

Glue (K)

:empDeps

X Yf [1..1]

([mult[n,m]])

x:X y:Yf1:f

:depEmps

z:Yf2:f

x:X y:Yf1:f

z:Y

x:X y:Yf1:f

z:Y

Cardiologyz

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 35 / 60

Page 36: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Based on the principles adapted from layered graph grammars [Ehrig, 2006].Completion rules are distributed across different layers.Rules of a layer are applied as long as possible before going to the next layer.We generalize the layer conditions from [Ehrig, 2006] allowing deleting and non-deletingrules to reside in the same layer as long as the rules are loop-free.

Generalized layered approach

........

r1 r2 r3 ....

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 36 / 60

Page 37: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Based on the principles adapted from layered graph grammars [Ehrig, 2006].Completion rules are distributed across different layers.Rules of a layer are applied as long as possible before going to the next layer.We generalize the layer conditions from [Ehrig, 2006] allowing deleting and non-deletingrules to reside in the same layer as long as the rules are loop-free.

Generalized layered approach

Layer 1

Layer 2

r1 r7 ....

......

..

r2 r3 ....

r1 r2 r3 ....

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 37 / 60

Page 38: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Based on the principles adapted from layered graph grammars [Ehrig, 2006].Completion rules are distributed across different layers.Rules of a layer are applied as long as possible before going to the next layer.We generalize the layer conditions from [Ehrig, 2006] allowing deleting and non-deletingrules to reside in the same layer as long as the rules are loop-free.

Generalized layered approach

Layer 1

Layer 2

r1 r7 ....

S0

......

..

r2 r3 ....

r1 r2 r3 ....

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 38 / 60

Page 39: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Based on the principles adapted from layered graph grammars [Ehrig, 2006].Completion rules are distributed across different layers.Rules of a layer are applied as long as possible before going to the next layer.We generalize the layer conditions from [Ehrig, 2006] allowing deleting and non-deletingrules to reside in the same layer as long as the rules are loop-free.

Generalized layered approach

Layer 1

Layer 2

r1 r7 ....

S0 S1

......

..

r1

r2 r3 ....

r1 r2 r3 ....

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 39 / 60

Page 40: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Based on the principles adapted from layered graph grammars [Ehrig, 2006].Completion rules are distributed across different layers.Rules of a layer are applied as long as possible before going to the next layer.We generalize the layer conditions from [Ehrig, 2006] allowing deleting and non-deletingrules to reside in the same layer as long as the rules are loop-free.

Generalized layered approach

Layer 1

Layer 2

r1 r7 ....

S0 S1 S2

......

..

r1 r1

r2 r3 ....

r1 r2 r3 ....

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 40 / 60

Page 41: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Based on the principles adapted from layered graph grammars [Ehrig, 2006].Completion rules are distributed across different layers.Rules of a layer are applied as long as possible before going to the next layer.We generalize the layer conditions from [Ehrig, 2006] allowing deleting and non-deletingrules to reside in the same layer as long as the rules are loop-free.

Generalized layered approach

Layer 1

Layer 2

r1 r7 ....

S0 S1 S2 S3 .... Sn

......

..

r1 r1 r1 r7

r2 r3 ....

r1 r2

S0 S7 S8 S9 .... Sm

r1 r7 r7 r7

..............

r3 ....

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 41 / 60

Page 42: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Based on the principles adapted from layered graph grammars [Ehrig, 2006].Completion rules are distributed across different layers.Rules of a layer are applied as long as possible before going to the next layer.We generalize the layer conditions from [Ehrig, 2006] allowing deleting and non-deletingrules to reside in the same layer as long as the rules are loop-free.

Generalized layered approach

Layer 1

Layer 2

r1 r7 ....

S0 S1 S2 S3 .... Sn

......

..

r1 r1 r1 r7

r2 r3 ....

Sn S21 S22 S23 .... St

r2 r2 r3 r3

r1 r2

S0 S7 S8 S9 .... Sm

r1 r7 r7 r7

..............

Sm S33 S34 S35 .... Sv

r2 r3 r3 r3

..............

r3 ....

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 42 / 60

Page 43: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Our generalized layered approach is based on a necessary condition (C1∨C2∨C3) for looping,where:

C1: A rule ri that creates an element x of type t does not have a NAC that forbids theexistence of element of type t .

C2: If a rule ri creates an element x of type t and has a NAC that forbids the existence ofelement of type t , then there exists a rule rj that deletes an element of type t .

C3: If a rule ri deletes an element x of type t , then there exists a rule rj that creates anelement of type t .

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 43 / 60

Page 44: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Lemma 1. (C1 ∨ C2 ∨ C3) is a necessary condition for looping of a set of rules at layer k

Proof: Let G0 = Si be an initial graph typed by Si−1 where Si ,Si−1 are finite graphs. Let Rk be afinite set of rules at layer k . A rule r ∈ Rk can either

1 creates an element x of type t , wherea r does not have a NAC that forbids the existence of element of type t .

orb r has a NAC that forbids the existence of element of type t .and/or

2 deletes an element x′ of type t ′

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 44 / 60

Page 45: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Lemma 1. (C1 ∨ C2 ∨ C3) is a necessary condition for looping of a set of rules at layer k

Proof:A rule r ∈ Rk can either

1 creates an element x of type t , wherea r does not have a NAC that forbids the existence of element of type t .

orb r has a NAC that forbids the existence of element of type t .and/or

2 deletes an element x′ of type t ′

Consider case 1.(a):The rule r has finite number of injective matches cr = {(δ,m) | (δ,m) is a match for G0 B Si−1}.For each injective match of L → G0, application of r creates an element x of type t .The rule can be applied indefinitely in a loop during the derivation process of layer k since theapplication of rule r does not decreases the number of matches.Therefore C1 is a necessary condition for looping.

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 45 / 60

Page 46: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Lemma 1. (C1 ∨ C2 ∨ C3) is a necessary condition for looping of a set of rules at layer k

Proof:A rule r ∈ Rk can either

1 creates an element x of type t , wherea r does not have a NAC that forbids the existence of element of type t .

orb r has a NAC that forbids the existence of element of type t .and/or

2 deletes an element x′ of type t ′

Consider case 1.(b):The rule r has finite number of injective matches cr = {(δ,m) | (δ,m) is a match forG0 B Si−1 and (δ,m) |= NAC}. For each injective match of L → G0, application of r creates anelement x of type t .Therefore, the application of rule r decreases the number of matches.In order to apply r indefinitely in a loop during the derivation process of layer k , elements of typet must be deleted.Therefore C2 is a necessary condition for looping.

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 46 / 60

Page 47: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Lemma 1. (C1 ∨ C2 ∨ C3) is a necessary condition for looping of a set of rules at layer k

Proof:A rule r ∈ Rk can either

1 creates an element x of type t , wherea r does not have a NAC that forbids the existence of element of type t .

orb r has a NAC that forbids the existence of element of type t .and/or

2 deletes an element x′ of type t ′

Consider the first case 2:The rule r has finite number of injective matches cr = {(δ,m) | (δ,m) is a match forG0 B Si−1 and (δ,m) |= NAC}.In order to apply r indefinitely in a loop during the derivation process, new elements of type t ′

must be created.Therefore C3 is a necessary condition for looping.

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 47 / 60

Page 48: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Corollary 1. A sufficient condition for loop-free rules in layer k is the negation of (C1 ∨ C2 ∨ C3)

Generalized layered approach

r1

r2r3

r5r4

r6

r7

r8 .........

Rk

Rules that can beapplied indefinitelywithout stopping

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 48 / 60

Page 49: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Corollary 1. A sufficient condition for loop-free rules in layer k is the negation of (C1 ∨ C2 ∨ C3)

Generalized layered approach

r1

r2r3

r5r4

r6

r7

r8 .........

Rk

Rules that can beapplied indefinitelywithout stopping

Rules that satisfy the necessary condition

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 49 / 60

Page 50: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Corollary 1. A sufficient condition for loop-free rules in layer k is the negation of (C1 ∨ C2 ∨ C3)

Generalized layered approach

r1

r2r3

r5r4

r6

r7

r8 .........

Rk

Rules that always terminates

Rules that satisfy the necessary condition

Rules that satisfy the sufficient condition

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 50 / 60

Page 51: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteriaWe propose a loop detection algorithm that is based on the following sufficient conditions for loopfreeness. Let Rk be the set of rules of a layer k .

If a rule ri ∈ Rk creates an element x of type t , then ri must have an element of type t in itsNAC,

If a rule ri ∈ Rk creates an element x of type t , then there is no rule in rj ∈ Rk that deletesan element of type t ,

If a rule ri ∈ Rk deletes an element of type t , then there is no rule in rj ∈ Rk that creates anelement of type t

Generalized layered approach

X Y

f

g

x y

:f

:g

[inv]

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 51 / 60

Page 52: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteriaWe propose a loop detection algorithm that is based on the following sufficient conditions for loopfreeness. Let Rk be the set of rules of a layer k .

If a rule ri ∈ Rk creates an element x of type t , then ri must have an element of type t in itsNAC,If a rule ri ∈ Rk creates an element x of type t , then there is no rule in rj ∈ Rk that deletesan element of type t ,If a rule ri ∈ Rk deletes an element of type t , then there is no rule in rj ∈ Rk that creates anelement of type t

Generalized layered approach

X Y

f

g

x y

:f

:g

[inv] X Yf

h

x y:f

[r1]

z

:h

z

Figure : These rules may produce a non-terminating situation if they areexecuted in the same layer

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 52 / 60

Page 53: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteriaIf a rule ri ∈ Rk creates an element x of type t , then ri must have an element of type t in itsNAC,If a rule ri ∈ Rk creates an element x of type t , then there is no rule in rj ∈ Rk that deletesan element of type t ,If a rule ri ∈ Rk deletes an element of type t , then there is no rule in rj ∈ Rk that creates anelement of type t

Generalized layered approach

Ae1

e2

constraint,

X

f

X Y

g

f

[p1]

([p1])

x y

:f

:gg

BY

r1

NAC(e2) R(e2) NAC(e1) R(e1) NAC(A) R(A) NAC(B) R(B)

r1

C

e3

NAC(C)R(C)NAC(e3) R(e3)

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 53 / 60

Page 54: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteriaIf a rule ri ∈ Rk creates an element x of type t , then ri must have an element of type t in itsNAC,If a rule ri ∈ Rk creates an element x of type t , then there is no rule in rj ∈ Rk that deletesan element of type t ,If a rule ri ∈ Rk deletes an element of type t , then there is no rule in rj ∈ Rk that creates anelement of type t

Generalized layered approach

Ae1

e2

constraint,

X

f

X Y

g

f

[p1]

([p1])

x y

:f

:gg

BY

r1

NAC(e2) R(e2) NAC(e1) R(e1) NAC(A) R(A) NAC(B) R(B)

r1

C

e3

NAC(C)R(C)NAC(e3) R(e3)

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 54 / 60

Page 55: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteriaIf a rule ri ∈ Rk creates an element x of type t , then ri must have an element of type t in itsNAC,If a rule ri ∈ Rk creates an element x of type t , then there is no rule in rj ∈ Rk that deletesan element of type t ,If a rule ri ∈ Rk deletes an element of type t , then there is no rule in rj ∈ Rk that creates anelement of type t

Generalized layered approach

Ae1

e2

constraint,

X

f

X Y

g

f

[p1]

([p1])

x y

:f

:gg

BY

r1

NAC(e2) R(e2) NAC(e1) R(e1) NAC(A) R(A) NAC(B) R(B)

C

e3

NAC(C)R(C)NAC(e3) R(e3)

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 55 / 60

Page 56: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteriaIf a rule ri ∈ Rk creates an element x of type t , then ri must have an element of type t in itsNAC,If a rule ri ∈ Rk creates an element x of type t , then there is no rule in rj ∈ Rk that deletesan element of type t ,If a rule ri ∈ Rk deletes an element of type t , then there is no rule in rj ∈ Rk that creates anelement of type t

Generalized layered approach

Ae1

e2

constraint,

X

f

X Y

g

f

[p1]

([p1])

x y

:f

:gg

BY

r1

NAC(e2) R(e2) NAC(e1) R(e1) NAC(A) R(A) NAC(B) R(B)

r1

C

e3

NAC(C)R(C)NAC(e3) R(e3)

X Y

g

f

[p2]

([p2])

x y

:f

:g

r2

Z

h

z

:h

r2 X

Z

h

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 56 / 60

Page 57: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Termination criteria

Theorem 1. (termination of loop-free rules). An empty table obtained by loop free rule detectionanalysis for a set of rules E implies that the execution of E will terminate for any finite size initialgraph.

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 57 / 60

Page 58: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

Conclusion and Future work

SummaryCompletion rules are defined as coupled graph transformationrulesCompletion rules are reusableGeneralized termination analysis is based on layered approachWe have Implemented a proof-of-concept of the proposedapproach

Future WorkImprove performance of the transformation systemAutomatically construct completion rules by processing constraintsDevelop concrete graphical syntaxSupport collaborative development

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 58 / 60

Page 59: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

References

Atkinson, C. and Kuhne, T. (2001).

The essence of multilevel metamodeling.In Proceedings of the 4th International Conference on The Unified Modeling Language, Modeling Languages, Concepts,and Tools, UML; ’01, pages 19–33, London, UK, UK. Springer-Verlag.

Zinovy Diskin, Uwe Wolter:

A Diagrammatic Logic for Object-Oriented Visual Modeling. Electr. Notes Theor. Comput. Sci. 203(6): 19-41 (2008)

Adrian Rutle:

Diagram Predicate Framework: A Formal Approach to MDE. PhD thesis, Department of Informatics, University of Bergen,Norway, November 2010.

Gabriele Taentzer, Florian Mantz, Thorsten Arendt, Yngve Lamo:

Customizable Model Migration Schemes for Meta-model Evolutions with Multiplicity Changes. MoDELS 2013: 254-270

Hartmut Ehrig, Karsten Ehrig, Ulrike Prange, Gabriele Taentzer:

Fundamentals of Algebraic Graph Transformation. Monographs in Theoretical Computer Science. An EATCS Series,Springer 2006, ISBN 978-3-540-31187-4.

Annegret Habel, Reiko Heckel, Gabriele Taentzer:

Graph Grammars with Negative Application Conditions. Fundam. Inf., 1996 vol. 26, pp. 287–313.

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 59 / 60

Page 60: A generalization of termination conditions for partial ...icetcs.ru.is/nwpt2015/SLIDES/Rabbi.pdf · Ingrid Chieh Yu2 1Bergen University College, Bergen, Norway 2University of Oslo,

The End

Fazle Rabbi et al. (HiB, UiO) A generalization of termination conditions October 22, 2015 60 / 60