0
Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

# Jarrar: Subtype Relations and Constraints

810

Published on

Lecture video by Mustafa Jarrar at Birzeit University, Palestine. …

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

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
810
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
12
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. Jarrar &#xA9; 2011 1 Subtype Relations &amp; Other Constraints Knowledge Engineering (SCOM7348) Lecture Notes on Subtype Relations &amp; Other Constraints Birzeit University 2011 Dr. Mustafa Jarrar University of Birzeit mjarrar@birzeit.edu www.jarrar.info (Chapter 6)
• 2. Jarrar &#xA9; 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, &amp; schema engineering issues
• 3. Jarrar &#xA9; 2011 3 Outline &#x2022; Quick Math background &#x2022; Value Constraints &#x2022; Set Constrains o Subset o Equality o Exclusion &#x2022; Subtype relations &#x2022; Frequency constraints Information adapted from [1]
• 4. Jarrar &#xA9; 2011 4 Mathematical Background Hypothetical Euler diagrams for set comparisons.
• 5. Jarrar &#xA9; 2011 5 Venn diagrams for three set-forming operations. Mathematical Background
• 6. Jarrar &#xA9; 2011 6 Mathematical Background Venn diagrams for (a) A is a proper subset of B and (b) four sets.
• 7. Jarrar &#xA9; 2011 7 Outline &#x2022; Quick Math background &#x2022; Value Constraints &#x2022; Set Constrains o Subset o Equality o Exclusion &#x2022; Subtype relations &#x2022; Frequency constraints
• 8. Jarrar &#xA9; 2011 8 Value Constraint Called Value Constraint A set of values, from which the value of the MedalKind is limited to
• 9. Jarrar &#xA9; 2011 9 Value Constraint The value of sex should be one of {&#x2018;M&#x2019;, &#x2018;F&#x2019;}
• 10. Jarrar &#xA9; 2011 10 Value Constraint Value constraints may list the possible values of a value type. &#xF0E8; Who can give more examples?
• 11. Jarrar &#xA9; 2011 11 Outline &#x2022; Quick Math background &#x2022; Value Constraints &#x2022; Set Constrains o Subset o Equality o Exclusion &#x2022; Subtype relations &#x2022; Frequency constraints
• 12. Jarrar &#xA9; 2011 12 Role subset/equality constraint Subset constraint: Every Member booked an Hour should play sport. Equality constraint: Every Member &#x2018;has&#x2019; ReactionTime should &#x2018;has&#x2019; HeartRate, and every Member &#x2018;has&#x2019; HeartRate should &#x2018;has&#x2019; ReactionTime.
• 13. Jarrar &#xA9; 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).
• 14. Jarrar &#xA9; 2011 14 Role equality constraint Also this quality constraint is implied, and should be removed.
• 15. Jarrar &#xA9; 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)
• 16. Jarrar &#xA9; 2011 16 Role Exclusion Constraint Exclusion constraint: Every Employee is allocated a ParkingSpace should not claim MoneyAmt.
• 17. Jarrar &#xA9; 2011 17 Role Exclusion Constraint
• 18. Jarrar &#xA9; 2011 18 Role Exclusion Constraint Each partner must be either a husband or wife (but not both at the same time). Called &#x201C;Exclusive-or&#x201D;
• 19. Jarrar &#xA9; 2011 19 Exclusive-or (another example) Each Account must be OwnedBy a Person or a Company, but not both.
• 20. Jarrar &#xA9; 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
• 21. Jarrar &#xA9; 2011 21 Pair Exclusion Constraint How can we restrict that a person can drive a car only if he owns that car.
• 22. Jarrar &#xA9; 2011 22 Pair-subset constraint An example of a tuple-subset constraint between sequences of three roles.
• 23. Jarrar &#xA9; 2011 23 Equality Constraint
• 24. Jarrar &#xA9; 2011 24 Pair Exclusion Constraint Same person can &#x2018;own&#x2019; and &#x2018;wants to buy&#x2019; the same car?
• 25. Jarrar &#xA9; 2011 25 What is Wrong? &#xF0FB; &#xF0FC; Implies &#xF0FB; &#xF0FC; ImpliesImplies &#xF0FB;
• 26. Jarrar &#xA9; 2011 26 Outline &#x2022; Quick Math background &#x2022; Value Constraints &#x2022; Set Constrains o Subset o Equality o Exclusion &#x2022; Subtype relations &#x2022; Frequency constraints
• 27. Jarrar &#xA9; 2011 27 Subtypes Person Male Female &#x2022; Generalization/Specialization hierarchy. &#x2022; Subtype inherits the properties of its supertype.
• 28. Jarrar &#xA9; 2011 28 Subtypes Person Australian Female Female Australian * * The indirect subtype connection is implied, so it should be omitted
• 29. Jarrar &#xA9; 2011 29 Subtypes
• 30. Jarrar &#xA9; 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
• 31. Jarrar &#xA9; 2011 31 Subtypes What is Inherited?
• 32. Jarrar &#xA9; 2011 32 What is Wrong?
• 33. Jarrar &#xA9; 2011 33 Outline &#x2022; Quick Math background &#x2022; Value Constraints &#x2022; Set Constrains o Subset o Equality o Exclusion &#x2022; Subtype relations &#x2022; Frequency constraints also called &#x201C;Occurrence constraints&#x201D;
• 34. Jarrar &#xA9; 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.
• 35. Jarrar &#xA9; 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
• 36. Jarrar &#xA9; 2011 36 Compound Frequency Constraint The values of (Year and City) must occur exactly three times
• 37. Jarrar &#xA9; 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 papers Each Paper can be refereed by at least two Experts.
• 38. Jarrar &#xA9; 2011 38 Discussion Summarize what you learned? And what you think about it? Compare what you learned with EER and UML? Questions &amp; Suggestions?
• 39. Jarrar &#xA9; 2011 39 References 1. Terry Halpin, Tony Morgan: Information Modeling and Relational Databases, Second Edition. Second Edition. The Morgan Kaufmann Series in Data Management Systems. ISBN: 0123735688