Database Systems - Chapter 3: Enhanced Entity-Relationship Model - Trương Quỳnh Chi
            1
Introduction to Enhanced-ER Model
2 Subclasses, Superclasses, and Inheritance
3 Specialization and Generalization
4 Constraints and Characteristics of Specialization and
Generalization Hierarchies
5 Categories
6 Design Choices, and Formal Definitions
        
        Introduction to Enhanced-ER Model
2 Subclasses, Superclasses, and Inheritance
3 Specialization and Generalization
4 Constraints and Characteristics of Specialization and
Generalization Hierarchies
5 Categories
6 Design Choices, and Formal Definitions
Bạn đang xem 20 trang mẫu của tài liệu "Database Systems - Chapter 3: Enhanced Entity-Relationship Model - Trương Quỳnh Chi", để tải tài liệu gốc về máy hãy click vào nút Download ở trên.
        
        File đính kèm:
 database_systems_chapter_3_enhanced_entity_relationship_mode.pdf database_systems_chapter_3_enhanced_entity_relationship_mode.pdf
Nội dung text: Database Systems - Chapter 3: Enhanced Entity-Relationship Model - Trương Quỳnh Chi
- Contents 1 Introduction to Enhanced-ER Model 2 Subclasses, Superclasses, and Inheritance 3 Specialization and Generalization Constraints and Characteristics of Specialization and 4 Generalization Hierarchies 5 Categories 6 Design Choices, and Formal Definitions 2
- Introduction to Enhanced-ER Model  Enhanced ER or Extended ER (EER) model  Created to design more accurate database schemas  More complex requirements than traditional applications  EER model includes all modeling concepts of the ER model. In addition, EER includes:  Subclasses and superclasses  Specialization and generalization  Category or union type  Attribute and relationship inheritance  EER diagrams  Diagrammatic technique for displaying these concepts in an EER schema 4
- Subclasses, Superclasses & Inheritance  Subtype or subclass of an entity type  Subgroupings of entities that are meaningful  Represented explicitly because of their significance to the database application  Terms for relationship between a superclass and any one of its subclasses  Superclass/subclass  Supertype/subtype  Class/subclass  A class/subclass relationship is often called an IS-A (IS-AN) relationship. 6
- EER diagram notation to represent subclasses & specialization 8
- Subclasses, Superclasses & Inheritance  Subclass entity inherits all attributes and relationships of superclass  Notice that a subclass, with its own specific (or local) attributes and relationships together with all the attributes and relationships it inherits from the superclass, can be considered an entity type in its own right. 10
- Specialization and Generalization  Specialization  Process of defining a set of subclasses of an entity type, called superclass  Defined on the basis of some distinguishing characteristic of the entities in the superclass  May have several specializations of the same entity type based on different distinguishing characteristics  Subclass can have its own:  Specific attributes (local attributes)  Specific relationship types 12
- Instances of a specialization 14
- Example of a Generalization 16
- Specialization and Generalization  Data Modeling with Specialization and Generalization  A superclass or subclass represents a set of entities  Shown in rectangles in EER diagrams (as are entity types)  Sometimes, all entity sets are simply called classes, whether they are entity types, superclasses, or subclasses 18
- Constraints and Characteristics of Specialization and Generalization Hierarchies  Constraints that apply to a single specialization or a single generalization  Differences between specialization/ generalization lattices and hierarchies 20
- Constraints on Specialization & Generalization  If we can determine exactly those entities that will become members of each subclass by a condition, the subclasses are called predicate-defined (or condition- defined) subclasses  Condition is a constraint that determines subclass members  Display a predicate-defined subclass by writing the predicate condition next to the line attaching the subclass to its superclass 22
- EER diagram notation for an attribute-defined specialization on JobType 24
- Constraints on Specialization & Generalization  Two basic conditions apply to a specialization/ generalization: disjointness and completeness constraints  Disjointness constraint  May be disjointed or overlap  Completeness (or totalness) constraint  May be total or partial  Disjointness and completeness constraints are independent 26
- Constraints on Specialization & Generalization  Completeness Constraint:  Total specifies that every entity in the superclass must be a member of some subclass in the specialization/ generalization: Shown in EER diagrams by a double line  Partial allows an entity not to belong to any of the subclasses: Shown in EER diagrams by a single line 28
- Example of Overlapping Total Specialization 30
- Case study: Identify superclass-subclass GROUP A GROUP B A system for course A system for a Library of a registration of Bach Khoa University University Hints: Students (Grad- Hints: Materials (Book, Student, undergrad- Journal, ), Borrowers student), Modules (for (Guest, Member) grad-student, for undergrad-students) 32
- Specialization and Generalization Hierarchies and Lattices  In a lattice or hierarchy, a subclass inherits attributes not only of its direct superclass, but also of all its predecessor superclasses  A subclass with more than one superclass is called a shared subclass  In case of multiple inheritance, if attribute (or relationship) originating in the same superclass inherited more than once via different paths in lattice  Included only once in shared subclass 34
- Utilizing Specialization and Generalization in Refining Conceptual Schemas  Specialization process  Start with entity type then define subclasses by successive specialization  Top-down conceptual refinement process  Bottom-up conceptual synthesis  Involves generalization rather than specialization 36
- Categories  Category or Union type  Represents a single superclass/subclass relationship with more than one superclass  Subclass represents a collection of objects that is a subset of the UNION of distinct entity types  Attribute inheritance works more selectively  Category can be total or partial  Some modeling methodologies do not have union types 38
- Two categories (union types): OWNER and REGISTERED_VEHICLE 40
- Category vs. Shared Subclass 42
- Category Shared Subclass A member entity of a category An member entity of a shared must exist in only one of its subclass must exist in all its superclasses (OR). superclasses (AND). • E.g.: An OWNER may be a COMPANY, a • E.g.: An engineering manager must be BANK, or a PERSON. an ENGINEER, a MANAGER, and a SALARIED_EMPLOYEE. A category is a subset of the A shared subclass is a subset of the union of its superclasses. intersection of its superclasses. • E.g.: OWNER is a subset of the union of • E.g.: ENGINEERING_MANAGER is a subset of the three superclasses. the intersection of the three superclasses. 44 Jan - 2015
- Specialization/Generalization vs. Union Type 46
- Contents 1 Introduction to Enhanced-ER Model 2 Subclasses, Superclasses, and Inheritance 3 Specialization and Generalization Constraints and Characteristics of Specialization and 4 Generalization Hierarchies 5 Categories 6 Design Choices, and Formal Definitions 48
- Design Choices for Specialization/Generalization  If all the subclasses of a specialization/ generalization have few specific attributes and no specific relationships  Can be merged into the superclass  Replace with one or more type attributes that specify the subclass or subclasses that each entity belongs to 50
- Formal Definitions for the EER Model Concepts  Class C  Set or collection of entities  Includes any of the EER schema constructs of group entities  Can be entity type, subclass, superclass, or category  Note: The definition of relationship type in ER/EER should have 'entity type' replaced with 'class‘ to allow relationships among classes in general 52
- Formal Definitions for the EER Model Concepts  Specialization Z: Z = {S1, S2, , Sn} is a set of subclasses with same superclass G;  G/Si is a superclass/subclass relationship, i=1 n  G is called a generalization of the subclasses {S1, S2, , Sn}  Z is total if:  S1 ∪ S2 ∪ ∪ Sn = G;  Otherwise, Z is partial  Z is disjoint if:  Si ∩ Sj empty-set for i ≠ j;  Otherwise, Z is overlapping 54
- Formal Definitions for the EER Model Concepts  Category or UNION type T  Class that is a subset of the union of n defining superclasses D1, D2, Dn, n>1: T ⊆ (D1 ∪ D2 ∪ ∪ Dn)  Can have a predicate pi on the attributes of Di to specify entities of Di that are members of T.  If a predicate is specified on every Di: T = (D1[p1] ∪ D2[p2] ∪ ∪ Dn[pn])  Relationship type  Any class can participate in a relationship 56
- Exercise 2 WV Bank has three different types of bank accounts available for their customers. Each customer may have any number of bank accounts, and all accounts have a unique account number. For Savings Accounts, WV Bank must keep track of the account’s balance, interest rate, and the date the account was opened. Checking Accounts pay no interest, so the bank keeps track of just the balance and date opened. The third type of account, Loans, requires tracking the date the loan was taken, the balance due, and the interest rate of the loan. Loan Accounts are also assigned to a Loan Officer, who keeps track of the account and ensures that the client is making their payments on-time. 60

