Top Banner
Jarrar © 2011 1 Subtype Relations and Constraints Knowledge Engineering (SCOM7348) © Mustafa Jarrar Lecture Notes, Knowledge Engineering (SCOM7348) University of Birzeit 1 st Semester, 2011 Dr. Mustafa Jarrar University of Birzeit [email protected] www.jarrar.info (Chapter 6)
38

Jarrar: Subtype Relations and Constraints

Dec 22, 2014

Download

Technology

Mustafa Jarrar

Lecture video by Mustafa Jarrar at Birzeit University, Palestine.
See the course webpage at: http://jarrar-courses.blogspot.com/2011/09/knowledgeengineering-fall2011.html
and http://www.jarrar.info

and on Youtube:
http://www.youtube.com/watch?v=3_-HGnI6AZ0&list=PLDEA50C29F3D28257
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: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 1

Subtype Relations and Constraints

Knowledge Engineering (SCOM7348)

© Mustafa JarrarLecture Notes, Knowledge Engineering (SCOM7348)

University of Birzeit1st Semester, 2011

Dr. Mustafa JarrarUniversity of [email protected]

www.jarrar.info

(Chapter 6)

Page 2: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 2

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 3: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 3

Outline

• Quick Math background

• Value Constraints

• Set Constrains

o Subset

o Equality

o Exclusion

• Subtype relations

• Frequency constraints

Page 4: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 4

Mathematical Background

Hypothetical Euler diagrams for set comparisons.

Page 5: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 5

Venn diagrams for three set-forming operations.

Mathematical Background

Page 6: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 6

Mathematical Background

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

Page 7: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 7

Outline

• Quick Math background

• Value Constraints

• Set Constrains

o Subset

o Equality

o Exclusion

• Subtype relations

• Frequency constraints

Page 8: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 8

Value Constraint

Called Value Constraint

A set of values, from which the value of the MedalKind is limited to

Page 9: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 9

Value Constraint

The value of sex should be one of {‘M’, ‘F’}

Page 10: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 10

Value Constraint

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

Who can give more examples?

Page 11: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 11

Outline

• Quick Math background

• Value Constraints

• Set Constrains

o Subset

o Equality

o Exclusion

• Subtype relations

• Frequency constraints

Page 12: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 12

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 13: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 13

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 14: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 14

Role equality constraint

Also this quality constraint is implied, and should be removed.

Page 15: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 15

Implication

Who can explain the difference?

The two constraints in the first model says: 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 16: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 16

Role Exclusion Constraint

Exclusion constraint:Every Employee is allocated a ParkingSpace should not claim MoneyAmt.

Page 17: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 17

Role Exclusion Constraint

Page 18: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 18

Role Exclusion Constraint

Each partner must be either a husband or wife (but not both at the same time).

Called “Exclusive-or”

Page 19: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 19

Exclusive-or (another example)

Each Account must be OwnedBy a Person or a Company, but not both.

Page 20: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 20

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 21: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 21

Pair Exclusion Constraint

How can we restrict that a person can drive a car only if he owns that car.

Page 22: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 22

Pair-subset constraint

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

Page 23: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 23

Equality Constraint

Page 24: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 24

Pair Exclusion Constraint

Same person can ‘own’ and ‘wants to buy’ the same car?

Page 25: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 25

What is Wrong?

Implies

ImpliesImplies

Page 26: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 26

Outline

• Quick Math background

• Value Constraints

• Set Constrains

o Subset

o Equality

o Exclusion

• Subtype relations

• Frequency constraints

Page 27: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 27

Subtypes

Person

Male Female

• Generalization/Specialization hierarchy.• Subtype inherits the properties of its supertype.

Page 28: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 28

Subtypes

Person

Australian Female

FemaleAustralian

*

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

Page 29: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 29

Subtypes

Page 30: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 30

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 31: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 31

Subtypes

What is Inherited?

Page 32: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 32

What is Wrong?

Page 33: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 33

Outline

• Quick Math background

• Value Constraints

• Set Constrains

o Subset

o Equality

o Exclusion

• Subtype relations

• Frequency constraints also called “Occurrence constraints”

Page 34: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 34

Frequency constraints

To indicate that each entry in a fact column must occur there exactly n times, 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 35: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 35

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 36: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 36

Compound Frequency Constraint

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

Page 37: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 37

Ranged Frequency Constraint

Examples of minimum and maximum frequency constraints.

Each name of Panl must occur at least 4 and at most 7 times. That is, each Expert must on 4 to 7 Panels

Each Expert can referee 5 papersEach Paper can be refereed by at least two Experts.

Page 38: Jarrar: Subtype Relations and Constraints

Jarrar © 2011 38

Discussion

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

Compare what you learned with EER and UML?

Questions & Suggestions?