Efficient Methods for Solving Finite Satisfiability Problems in UML Class Diagrams

Post on 06-Jan-2016

14 views 0 download

Tags:

description

Efficient Methods for Solving Finite Satisfiability Problems in UML Class Diagrams. Mira Balaban and Azzam Maraee. Motivation. What’s wrong with this ontology * ?. [Enzyme]  [Protein] . [Protein]  [Chemical].  [ Chemical]  [Reaction] . [Reaction] < [Enzyme]. - PowerPoint PPT Presentation

Transcript of Efficient Methods for Solving Finite Satisfiability Problems in UML Class Diagrams

Efficient Methods for Solving Finite Satisfiability Problems in UML Class Diagrams

Mira Balaban and Azzam Maraee

2

Motivation

[Enzyme] [Protein] [Protein] [Chemical] [Chemical] [Reaction]

[Reaction] < [Enzyme]

[Enzyme] < [Enzyme]What’s wrong with this ontology* ?

*Consistency Checking of Semantic Web OntologiesKenneth Baclawski, Mieczyslaw M. Kokar, Richard Waldinger, Paul A. Kogut

3

Agenda

• Background

• Reasoning Problems

• Previous works

• Research Contribution

•Conclusions and Future Work

4

UML

UML is now widely accepted as the standard modeling language for software construction.

UML 2.0 updates came from 54 companies.

Class diagrams are widely used

software and language.

specification, database.

ontology engineering

5

Class Diagram: Cardinality Constraint and Class Hierarchy

• Class: Advisor and University

• Association: Employment– Cardinality Constraint

• Class Hierarchy

UniversityAdvisorEmployment

+employer+employee

1..* 1

Master PhD

rami : Advisorrami : Master BGU : Universityemployment

+employee +employer

Legal Instance:mari : Advisor

employment

+employee

+employer

6

Class Diagram: Generalization Set Concept

UniversityAdvisorEmployment

+employer+employee

1..* 1

Master PhD

{disjoint, incomplete}{disjoint, complete}{overlapping,incomplete}{overlapping, complete}

rami : Master

jame : Advisor

BGU : Universityemployment

+employee +employer

mari : Master, PhD

jame : Master

Female

Male

7

Agenda

• Background

• Reasoning Problems

• Previous works

• Research Contribution– Finite Satisfiability Method:

• Class Hierarchy and Generalization Set Constraints

•Conclusions and Future Work

8

Reasoning Problems (1): Inconsistency

disjoint

• Emptiness

9

Reasoning Problems (2): Infinity Problem (1)• Consider the pervious example:

Advisor

PhDMaster

Advise

+ma

+advisor

2

1

10

Infinity Problem (2)john : Advisor

advise

+ma

+advise

advise

+ma

+advise

frank : Master jack : Master

advise

+advise

+ma

advise

+advice

+ma

rami : PhD sami : Master

advise

+ma

+advise

michael : Mastershreen : Master

advise

+advise

+ma

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

+ma

+advise

sharon : Mastermari : Master

+ma

+advise

: Master : Master

advise

+ma

+advsie

advise

+ma

+aadvise

11

Relevance of Reasoning

• It is important to guarantee that models provide a reliable support for the designed systems.

– Implementability : A class diagram is implemented

into a running system.

– Project cost: Early detection of problems.

– Used with MDA: Precise and consistent enough to be used within MDA.

12

Reasoning Needs (2)

• Current case tools do not support reasoning tasks.

• Need for powerful CASE tools

– with reasoning capabilities.

13

Consistency notions (1)

• Berardi et al (2005), distinguish two cases: – Consistency of class diagram – has an instantiation

with at-least one non-empty class extension.

– Class consistency – there is an instantiation in which the class extension is non-empty.

rest of the diagram

ConsistentThe whole class diagram is consistent

14

Consistency notions (2)

• All class consistency of a class diagram – every class is consistent.

• Full consistency of a class diagram – has an instance in which all class extensions are non-empty.

15

Finite satisfiability notions• All class finite satisfiability of a class diagram – every

class there is a finite instance in which the class extension is non-empty (strong satisfiability, Lenzerini and Nobili, 1990).

• Finite satisfiability of a class diagram – it has a finite instance in which all class extensions are non-empty.

Lenzerini & Nobili 92Research Contribution

UML Class Diagram

16

Agenda

• Background

• Reasoning Problems

• Previous works

• Research Contribution– Finite Satisfiability Method.

• Class Hierarchy and Generalization Set Constraints

•Conclusions and Future Work

17

Testing Finite Satisfiability

• Lenzerini and Nobili (92):– ER diagrams without class hierarchy.

• Calvanese and Lenzerini (94):– Extend with class hierarchy.

18

Lenzerini and Nobily (92).

Method:• Transform cardinality constraints into an

inequalities system.• Solve the system.

Result: The diagram is finitely satisfiable iff the inequalities system has a solution.

A BR

min1, max1min2, max2

r≥min1∙a , r≤max1∙a , r≥min2∙b , r≤max2∙b,a, b, r>0

Example

19

Reaction

1

2

depend

rdrd 1,1

rdrd 2,2

Example

20

Reaction

1

2

depend

rdrd 1,1

rdrd 2,2

0,0 rd

rd rd 2

rr 2

21

Calvanese and Lenzerini (94) – Extension

with class hierarchies (1) • Calvanese and Lenzerini extend the method of Lenzerini

and Nobily (92) to apply to schemata with class hierarchy.

• The expansion is based on the assumption that class extensions may overlap. – Compound Class. – Compound relationship:

22

Advisor,Master_Student Advisor,PhD_Student

Advisor

Advisor,Master_Student,PhD

Calvanese and Lenzerini (94) – Extension with class hierarchies (2)

23

Calvanese and Lenzerini (94) – Extension with class hierarchies (3)

Advisor

Advisor, Master, Ph.D

Advisor, PhD

Advisor, Master

Advisor,Master , Ph.D

Advisor: Master

24

Calvanese and Lenzerini (94) – Extension with class hierarchies (2)• For a class diagram with three classes and one

association: 12 variables and 26 inequalities

• An exponential number of variables.

25

Hardness of Finite Satisfiability

• Berardi et al (2005) showed :

• Lutz et al (2005) showed:

( ) ( ) ( )Sat ALC Sat UML Sat DLR EXPTIME complete

( ) ( )Sat UML Sat ALCQI EXPTIME complete

( ) ( )FSat UML FSat ALCQI EXPTIME complete

( )FSat UML EXPTIME complete

completeEXPTIMEALCSat )(

26

Agenda

• Background

• Reasoning Problems

• Previous works

• Research Contribution– Finite Satisfiability Method

•Conclusions and Future Work

27

Splitting the Problem

• Presents of Constraints:– Without – With

• Hierarchy Structure:• Tree Structure.• Acyclic Structure.• Graph Structure.

28

Splitting the Problem : Hierarchy Structure

• Tree Structure.

Advisor

PhDMaster

29

Splitting the Problem: Hierarchy Structure

• Tree Structure.• Acyclic Structure.

Municipal _Property

Street_Sign Police_Car

Car

Private_Car

30

Splitting the Problem: Hierarchy Structure

• Tree Structure• Acyclic Structure• Graph Structure.

31

Splitting the Problem

Tree

Acyclic

Graph

Hierarchy Structure GS Constraint

Without

With

32

Splitting the Problem

Tree

Acyclic

Graph

Hierarchy Structure GS Constraint

Without

WithLimited

33

Finite Satisfiabilty over Unconstrained Tree

Hierarchy

• Input:

– Tree class hierarchy.– Unconstrained generalization sets.– Binary associations.

• Method:– A reduction to the algorithm of Lenzerini Nobili:

34

Finite Satisfiabilty over Unconstrained Tree Hierarchy

sub0..1

sub0..1

supersuper 11

ISA1 ISA2

Class Diagram

without hierarchy

constraint

A class diagram

that includes binary

associations and

unconstrained tree

hierarchy

Create the Lenzerini

& Nobili inequalities

system and Solve.

35

The Inequalities Systems

Advisor Ma_Student Ph.DStudent Advice ISA_1 ISA_2

d m p ad isa1 isa2

1

2-3 = ( and )

4

5-6 ( and )

7-8 ( 2 and )

9-10 ( and )

11-15 0, 0, 0,

1

1 1 1

2

2 2 2

isa m

isa d isa d isa d

isa p

isa d isa d isa d

ad 2d ad d d 2d

ad m ad m d m

d m p i

0, 01 2sa isa

m=2d

d≥m

d≥2d

Finite Satisfiabilty over Unconstrained Tree Hierarchy

36

Claims• Claim [correctness]: A class diagram with

unconstrained tree hierarchy is finitely satisfiable iff there exists a solution to the inequalities system.

• Claim [Complexity]: Unconstrained Tree Hierarchy finite satisfiabilty method adds to the Lenzerini and Nobili method an O(n) time complexity, where n is the size of the class diagram (including associations, classes and class hierarchy constraints).

Finite Satisfiabilty over Unconstrained Tree Hierarchy

37

Proof [Correctness Claim]

Class Diagram

without hierarchy

constraint

Create the Lenzerini

& Nobili inequalities

system and Solve.

A class diagram that includes binary associations and unconstrained treehierarchy

CD CD’

It is sufficient to show a reduction of the finite satisfiability problem for CD to finite satisfiability problemfor CD’ without generalization sets.

CD: finitely satisfiable CD’: finitely satisfiable

Finite Satisfiabilty over Unconstrained Tree Hierarchy

38

Reduction Proof

I I’

CD’: finitely satisfiable CD: finitely satisfiable

CD CD’Lenzerini & Nobili

inequalities

Finite Satisfiabilty over Unconstrained Tree Hierarchy

39

Extensions of Finite Satisfiabilty Method

• Applies properly also to the rest of the unconstrained structured:

– Acyclic Structure.

– Graph Structure.

40

Splitting the Problem

Tree

Acyclic

Graph

Hierarchy Structure GS Constraint

Without

WithLimited

41

Finite Satisfiabilty Method:

Constrained Tree Hierarchy

J ane : Ph.D_Student

adviise

+ma

+advisor

sharon : Master

advice

+ma

+advisor

rafi : Master

Empty

Constrained Tree Hierarchy

advisor

ma

Master_Student

{disjoint, complete}

42

……………..

Const

0..10..1

11Const

…...

Class Diagram

without hierarchy

constraint.

1) Create the Lenzerini

and Nobili inequalities

system.

2) Expand the inequalities

and Solve.

A class diagram

that includes binary

associations and

constrained tree

structureOCL constraint: Const

Finite Satisfiabilty Method:

Constrained Tree Hierarchy

43

Class Diagram

without hierarchy

constraint

1) Create the Lenzerini

and Nobili inequalities

system.

2) Expand the inequalities

and Solve.

A class diagram that includes

binaryassociations and constrained tree structure OCL constraint: Const

Single Constraints

Finite Satisfiabilty Method :

Constrained Tree Hierarchy

44

• Claim [Correctness]: A class diagram with constrained tree structure is finitely satisfiable iff there exists a solution for the expanded inequalities system

• Claim [Complexity]: adds to the Lenzerini and Nobili method an O(n) time complexity, where n is the size of the class diagram (including associations, classes and class hierarchy constraints

Finite Satisfiabilty Method:

Constrained Tree Hierarchy

45

Correctness Claim (Intuition)

A class diagram that includes binaryassociations and constrained tree structure

Class Diagram

without hierarchy

constraint.

Expanded inequality system

OCL constraint: Const

I I’

CD: finitely satisfiable CD’: finitely satisfiable

46

Correctness Claim (Intuition)

A class diagram that includes binaryassociations and constrained tree structure

Class Diagram

without hierarchy

constraint.

Expanded inequality system

OCL constraint: Const

I’

CD’: finitely satisfiable

Solution

CD’: finitely satisfiable

47

Class Diagram

without hierarchy

constraint

1) Create the Lenzerini

and Nobili inequalities

system.

2) Expand the inequalities

and Solve.

A class diagram

that includes binary

associations and

[T-C]-GSOCL constraint: Const

Finite Satisfiabilty Method: Constrained Tree Hierarchy

48

No Exclusive Inequalities

Class Diagram

without hierarchy

constraint.

1) Create the Lenzerini

and Nobili inequalities

system.

2) Expand the inequalities

and Solve.

A class diagram that includes

binaryassociations and constrained tree structure OCL constraint: Const

49

The Inequalities System

1

2-3 = ( and )

4

5-6 = ( and )

7-8 ( and )

9-10 ( and )

11-15 , 0, 0, 0,

1

1 1 1

2

2 2 2

1

isa ad

isa m isa m isa m

isa ad

isa p isa p isa p

d ad ad d d d

d m ad m d m

ad d m p isa

0, 0.

16 > +

2isa

ad m p

Advisor Ma_Student Ph.DStudent Advice ISA_1 ISA_2

ad m p d isa1 isa2

50

Finite Satisfiabilty MethodStructure Extension

Tree

Acyclic

Graph

Hierarchy Structure GS Constraint

Without

WithLimited

51

Finite Satisfiabilty Method Extension to Graph Structure.

• Succeeds in determining non-finite satisfiabilty.

• Succeeds in determining finite satisfiabilty:– overlapping and incomplete

• Fails in:– Complete, disjoint

52

Exploring the Limits

• Infinity

A

B C D

disjoint

A

B C D

disjoint

E

R

1

1

53

The Inequalities System

1, 2, 3

1, 2, 3

a b c d

a isa a isa a isa

b isa c isa d isa

4, 5

4, 5

e isa e isa

c isa d isa

There is a solution

e c d

54

55

E

56

57

Implementation

LKJH

GFE

D

CB

A

Thesis_Example

{disjoint, incomplete}

rn1+ 1

rn2+

2..3

R

q1+

1

q2+

1..5

Q

{overlapping, complete}

{disjoint,complete}

{overlapping, incomplete}

h1+

1

h2+

1

H

t1+1

t2+2..4

T

58

Conclusion

• Introduced graph structure based methods.

• Have a complexity advantage over existing methods that require an exponential time in the worst case.

• Simplicity: Our methods are simple and sufficient for reducing the satisfiabilty problem.

59

Future Work • Extensions:

– Graph structure with disjoint, complete.– N-ary.– Qualifier.– Association class.– Aggregation.– Identification and Fixing (Sven Hartman, 2001)– integrate the implementation as add-in in existing case tool,

60