pal gov.tutorial1.session5.subtyperelationsandotherconstraints

43
1 PalGov © 2011 فلسطينيةلكترونية الديمية الحكومة ا أكاThe Palestinian eGovernment Academy www.egovacademy.ps Session 5 Subtype Relations and Other Constraints Tutorial 1: Data and Business Process Modeling Prof. Mustafa Jarrar Sina Institute, University of Birzeit [email protected] www.jarrar.info Reviewed by Prof. Marco Ronchetti, Trento University, Italy

Upload: mustafa-jarrar

Post on 07-Dec-2014

439 views

Category:

Education


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

1PalGov © 2011

أكاديمية الحكومة اإللكترونية الفلسطينية

The Palestinian eGovernment Academy

www.egovacademy.ps

Session 5

Subtype Relations and Other Constraints

Tutorial 1: Data and Business Process Modeling

Prof. Mustafa Jarrar

Sina Institute, University of Birzeit

[email protected]

www.jarrar.info

Reviewed by

Prof. Marco Ronchetti, Trento University, Italy

Page 2: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

2PalGov © 2011

About

This tutorial is part of the PalGov project, funded by the TEMPUS IV program of the

Commission of the European Communities, grant agreement 511159-TEMPUS-1-

2010-1-PS-TEMPUS-JPHES. The project website: www.egovacademy.ps

University of Trento, Italy

University of Namur, Belgium

Vrije Universiteit Brussel, Belgium

TrueTrust, UK

Birzeit University, Palestine

(Coordinator )

Palestine Polytechnic University, Palestine

Palestine Technical University, PalestineUniversité de Savoie, France

Ministry of Local Government, Palestine

Ministry of Telecom and IT, Palestine

Ministry of Interior, Palestine

Project Consortium:

Coordinator:

Dr. Mustafa Jarrar

Birzeit University, P.O.Box 14- Birzeit, Palestine

Telfax:+972 2 2982935 [email protected]

Page 3: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

3PalGov © 2011

© Copyright Notes

this material, or part of it, but should properly useEveryone is encouraged to

(logo and website), and the author of that part. cite the project

in any form or by any reproduced or modified No part of this tutorial may be

from the project, who have the full written permissionmeans, without prior

copyrights on the material.

Attribution-NonCommercial-ShareAlike

CC-BY-NC-SA

This license lets others remix, tweak, and build upon your work non-

commercially, as long as they credit you and license their new creations

under the identical terms.

Page 4: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

4PalGov © 2011

Tutorial Map

Topic Time

Module I: Conceptual Data Modeling

Session 0: Outline and Introduction

Session 1.1: Information Modeling 1

Session 1.2: Conceptual Data Modeling using ORM 1

Session 1.3: Conceptual Analyses 1

Session 2: Lab- Conceptual Analyses 3

Session 3.1: Uniqueness Rules 1.5

Session 3.2: Mandatory Rules 1.5

Session 4: Lab- Uniqueness & Mandatory Rules 3

Session 5: Subtypes and Other Rules 3

Session 6: Lab- Subtypes and Other Rules 3

Session 7.1: Schema Equivalence &Optimization 1.5

Session 7.2: Rules Check &Schema Engineering 1.5

Session 8: Lab- National Student Registry 3

Module II: Business Process Modeling

Session 9: BP Management and BPMN: An Overview 3

Session 10: Lab - BP Management 3

Session 11: BPMN Fundamentals 3

Session 12: Lab - BPMN Fundamentals 3

Session 13: Modeling with BPMN 3

Session 14: Lab- Modeling with BPMN 3

Session 15: BP Management & Reengineering 3

Session 16: Lab- BP Management & Reengineering 3

Intended Learning ObjectivesModule 1 (Conceptual Date Modeling)

A: Knowledge and Understanding

11a1: Demonstrate knowledge of conceptual modeling notations and concepts

11a2: Demonstrate knowledge of Object Role Modeling (ORM) methodology.

11a3: Explain and demonstrate the concepts of data integrity & business rules

B: Intellectual Skills

11b1: Analyze application and domain requirements at the conceptual level,

and formalize it using ORM.

11b2: Analyze entity identity at the application and domain levels.

11b4: Optimize, transform, and (re)engineer conceptual models.

11b5: Detect &resolve contradictions & implications at the conceptual level.

C: Professional and Practical Skills

11c1: Using ORM modeling tools (Conceptual Modeling Tools).

Module 2 (Business Process Modeling)

A: Knowledge and Understanding

12a1: Demonstrate knowledge of business process modeling notations and concepts.

12a2: Demonstrate knowledge of business process modeling and mapping.12a3: Demonstrate understand of business process optimization and re-engineering.

B: Intellectual Skills

12b1: Identify business processes.

12b2: Model and map business processes.

12b3: Optimize and re-engineer business processes.

C: Professional and Practical Skills

12c1: Using business process modeling tools, such as MS Visio.

Page 5: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

5PalGov © 2011

Session ILOs

After completing this session students will be able to:

11a3: Explain and demonstrate the concepts of data integrity and

business rules.

11b1: Analyze application and domain requirements at the

conceptual level, and formalize it using ORM.

11b2: Analyze entity identity at the application and domain levels.

Page 6: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

6PalGov © 2011

Conceptual Schema Design Steps

1. From examples to elementary facts

2. Draw fact types and apply population check

3. Combine entity types

4. Add uniqueness constraints

5. Add mandatory constraints

6. Add subtype relations and other constraints

7. Final checks, & schema engineering issues

Page 7: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

7PalGov © 2011

Outline

• Quick Math background

• Value Constraints

• Set Constrains

o Subset

o Equality

o Exclusion

• Subtype relations

• Frequency constraints

Page 8: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

8PalGov © 2011

Mathematical Background

Hypothetical Euler diagrams for set comparisons.

Page 9: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

9PalGov © 2011

Mathematical Background

Venn diagrams for three set-forming operations.

Page 10: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

10PalGov © 2011

Mathematical Background

Venn diagrams for (a) A is a proper subset of B and (b) four sets.

Page 11: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

11PalGov © 2011

Outline

• Quick Math background

• Value Constraints

• Set Constrains

o Subset

o Equality

o Exclusion

• Subtype relations

• Frequency constraints

Page 12: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

12PalGov © 2011

Value Constraint

Called Value Constraint

A set of values, from

which the value of

the MedalKind is

limited to

Page 13: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

13PalGov © 2011

Value Constraint

The value of sex should be one of {„M‟, „F‟}

Page 14: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

14PalGov © 2011

Value Constraint

Value constraints may list the possible values of a value type.

Who can give more examples?

Page 15: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

15PalGov © 2011

Outline

• Quick Math background

• Value Constraints

• Set Constrains

o Subset

o Equality

o Exclusion

• Subtype relations

• Frequency constraints

Page 16: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

16PalGov © 2011

Role subset/equality constraint

Subset constraint:

Every Member booked an Hour

should play sport.

Equality constraint:

Every Member „has‟ ReactionTime

should „has‟ HeartRate, and every

Member „has‟ HeartRate should

„has‟ ReactionTime.

Page 17: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

17PalGov © 2011

Role subset constraint

Notice that this subset constraint is

implied, and should be removed.

That is, there is no need to say that every A

playing r2 must also play r1 (subset), because the

mandatory constraint here means that every A

must play r1 (the Mandatory implies the subset).

Page 18: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

18PalGov © 2011

Role equality constraint

Also this quality constraint is implied,

and should be removed.

Page 19: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

19PalGov © 2011

Implication

Who can explain the difference?

The two constraints in the first model say: each A must play r1 or r2 (or

both), and that if A plays r2 then it must play r1. This means that r1 must

be always played (which is the second model)

Page 20: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

20PalGov © 2011

Role Exclusion Constraint

Exclusion constraint:

Every Employee is allocated a

ParkingSpace should not claim

MoneyAmt.

Page 21: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

21PalGov © 2011

Role Exclusion Constraint

Page 22: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

22PalGov © 2011

Role Exclusion Constraint

Each partner must be either a husband

or wife (but not both at the same time).

Called “Exclusive-or”

Page 23: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

23PalGov © 2011

Exclusive-or (another example)

Each Account must be

OwnedBy a Person or a

Company, but not both.

Page 24: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

24PalGov © 2011

Role Exclusion Constraint

Each person has at most one of three vices. i.e., from 0 to 3 vices.

It can be written also as

Page 25: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

25PalGov © 2011

Pair Exclusion Constraint

How can we restrict that a

person can drive a car only if

he owns that car.

Page 26: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

26PalGov © 2011

Pair-subset constraint

An example of a tuple-subset constraint between sequences of three roles.

Page 27: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

27PalGov © 2011

Equality Constraint

Page 28: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

28PalGov © 2011

Pair Exclusion Constraint

Can the same person „own‟ and „wants to buy‟ the same car?

Page 29: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

29PalGov © 2011

What is Wrong?

Implies

ImpliesImplies

Page 30: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

30PalGov © 2011

Outline

• Quick Math background

• Value Constraints

• Set Constrains

o Subset

o Equality

o Exclusion

• Subtype relations

• Frequency constraints

Page 31: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

31PalGov © 2011

Subtypes

Person

Male Female

• Generalization/Specialization hierarchy.

• A subtype inherits the properties of its supertype.

Page 32: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

32PalGov © 2011

Subtypes

Person

Australian Female

Female

Australian

*

* The indirect subtype connection is implied, so it should be omitted

Page 33: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

33PalGov © 2011

Subtypes

Page 34: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

34PalGov © 2011

Subtypes

Person

Male Female

There is no person that

can be Male and Female

at the same time.

Person

Male Female

Every person must be a

Male or a female.Every person must be

either a Male or a Female

Person

Male Female

Page 35: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

35PalGov © 2011

Subtypes

What is

Inherited?

Page 36: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

36PalGov © 2011

What is Wrong?

Page 37: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

37PalGov © 2011

Outline

• Quick Math background

• Value Constraints

• Set Constrains

o Subset

o Equality

o Exclusion

• Subtype relations

• Frequency constraints also called “Occurrence constraints”

Page 38: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

38PalGov © 2011

Frequency constraints

To indicate that each entry in a fact column must occur there exactly ntimes, the number n is written beside the role.

Each city in the first

column must occur

three times.each drive kind in the

Second column must

appear there twice

A compound transaction is needed to initially populate this fact type

requiring at least six facts to be added.

Page 39: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

39PalGov © 2011

Frequency constraints

Each member of pop(r) occurs there exactly n times.

n must be a positive integer.

A r

n

A r

1

A r

If n = 1, this is equivalent to a uniqueness constraint

Page 40: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

40PalGov © 2011

Compound Frequency Constraint

The values of (Year and City) must occur exactly three times

Page 41: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

41PalGov © 2011

Ranged Frequency Constraint

Examples of minimum and maximum frequency constraints.

Each name of panel must occur at least 4

and at most 7 times. That is, each panel

must include 4 to 7 experts

Each expert can referee 5 papers

Each paper can be refereed by at least two experts.

Page 42: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

42PalGov © 2011

Discussion

Summarize what you learned? And what you think about it?

Compare what you learned with EER and UML?

Questions & Suggestions?

Page 43: Pal gov.tutorial1.session5.subtyperelationsandotherconstraints

43PalGov © 2011

References

1. Information Modeling and Relational Databases: From Conceptual Analysis to Logical Design, Terry Halpin (ISBN 1-55860-672-6) – Chapter 6.