Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Systems 主講人 : 陳建源 日期 :99/10/19 研究室 : 法 401 Chapter 4 Enhanced Entity-Relationship and Object Modeling.

Similar presentations


Presentation on theme: "Database Systems 主講人 : 陳建源 日期 :99/10/19 研究室 : 法 401 Chapter 4 Enhanced Entity-Relationship and Object Modeling."— Presentation transcript:

1 Database Systems 主講人 : 陳建源 日期 :99/10/19 研究室 : 法 401 Email: cychen07@nuk.edu.tw Chapter 4 Enhanced Entity-Relationship and Object Modeling

2 1. EER Model Concepts subclasses/superclasses specialization/generalization categories (UNION types) attribute and relationship inheritance 2. Constraints on Specialization/ Generalization 3. UNION Types Using Categories 4. An Example EER Schema Outline

3 Extended Entity-Relationship (EER)Model An extension of ER model includes the concepts of subclass and superclass specialization and generalization category attribute and relationship inheritance 1. EER Model Concepts

4 Subclass and Superclass In many cases an entity type has numerous subgroupings of its entities e.g., EMPLOYEE may be grouped into SECRETARY, ENGINEER, MANAGER, TECHNICIAN Each subgroup form a subclass of the entity type (superclass) e.g., SECRETARY ENGINEER MANAGER TECHNICIAN EMPLOYEE superclass subclass 1. EER Model Concepts

5 Class/subclass (IS-A/AN) relationship The relationship between a superclass and any one of its subclasses e.g., EMPLOYEE/MANAGER An entity being a member of a subclass must also be a member of the superclass e.g., a SECRETARY entity ‘Joan Logano’ is also the EMPLOYEE ‘Joan Logano’ A subclass entity is the same as that in the superclass, but in a distinct specific role 1. EER Model Concepts

6

7 Type inheritance A subclass entity inherits all the attributes of the entity as a member of the superclass all the relationships in which the superclass participates A subclass should have specific attributes and can participate in specific relationship types e.g., SECRETARY has attribute TypingSpeed 1. EER Model Concepts

8 Specialization The process of defining a set of subclasses of an entity type (superclass) based on some distinguishing characteristic, e.g., {SECRETARY, ENGINEER, TECHNICIAN} based on job type {SALARIED_EMPLOYEE, HOURLY_EMPLOYEE} based on method of pay 1. EER Model Concepts

9 EER Model Concepts (cont.)

10 Reasons for using (specialization) subclass Certain attributes may apply to some but not all entities of the superclass Some relationship types may be participated in only by entities that are members of the subclass 1. EER Model Concepts

11 Generalization The process of identifying the common features among several entity types, and generalizing them into a single superclass e.g., CAR and TRUCK can be generalized into VEHICLE Generalization can be viewed as the inverse of specialization 1. EER Model Concepts

12 ER Model Concepts (cont.)

13 Predicate-defined (or condition-defined) subclasses Placing a condition on the value the attribute that identify the subclasses e.g., SECRETARY subclass by the defining predicate JobType = ‘ Secretary ’ A constraint specifying that members of the subclass must satisfy the predicate 2. Constraints and Characteristics of Specialization/ Generalization

14 2. Constraints on Specialization/ Generalization

15 Attribute-defined specialization Specify that all subclasses having the membership condition on the same attribute of the superclass The attribute is called the defining attribute of the specialization, e.g., Job type 2. Constraints and Characteristics of Specialization/ Generalization

16 Disjointness constraint Specify that the subclasses of the specialization must be disjoint, i.e., an entity belongs to at most one subclass e.g., specialization {HOURLY_EMPLOYEE, SALARIED_EMPLOYEE} denoted as symbol If the subclasses are not disjoint, their sets of entities may overlap, denoted as symbol d o 2. Constraints and Characteristics of Specialization/ Generalization

17

18 Completeness constraint Total specialization constraint Specify that every entity in the superclass must be a member of some subclass in the specialization Partial specialization Allow an entity not to belong to any of the subclasses 2. Constraints and Characteristics of Specialization/ Generalization

19 Specialization Hierarchies and Lattices A subclass itself may have further subclasses specified on it, forming a hierarchy or a lattice of specializations For a specialization hierarchy every subclass participates in only one class/subclass For a specialization lattice a subclass can be a subclass in more than one class/subclass 2. Constraints and Characteristics of Specialization/ Generalization

20

21 A subclass with more than one superclass is called a shared subclass, leading to multiple inheritance e.g., ENGINEERING_MANAGER Any inherited attribute should be included only once in a shared subclass 2. Constraints and Characteristics of Specialization/ Generalization

22

23 Top-down conceptual refinement Start with an entity type and then define subclasses by successive specialization e.g., A university database schema PERSON => {EMPLOYEE, ALUMNUS, STUDENT} {STAFF, FACULTY, STUDENT_ASSISTANT} {RESEARCH_ASSISTANT, TEACHING_ASSISTANT} {GRADUATE_STUDENT,UNDERGRADUATE_STUDENT} 2. Constraints and Characteristics of Specialization/ Generalization

24 Bottom-up conceptual synthesis Start with entity types and then define superclasses by successive generalization e.g., {STAFF, FACULTY, ALUMNUS} EMPLOYEE Hybrid conceptual process A combination of the two processes 2. Constraints and Characteristics of Specialization/ Generalization

25 Union type (Category) Modeling a single superclass/subclass relationship with more than one superclass Superclasses can represent different entity types e.g., In a vehicle registration database, the vehicle owner can be a person, a bank, or a company => OWNER: a subclass of the UNION of COMPANY, BANK, and PERSON The union type (category) is specified via  symbol, called set union operation 3. UNION Types Using Categories

26

27

28 A category can be total or partial e.g., Fig 4.9[5th], Fig 7.27[6th], where c1 and c2 are predicate conditions that specify which COMPANY and PERSON entities are members of ACCOUNT_HOLDER The superclasses of a category may have different key attributes e.g., OWNER category of Fig 4.8[5th], Fig 7.26[6th] have the same key attribute e.g., REGISTERED_VEHICLE category 3. UNION Types Using Categories

29

30 Category vs shared subclass A category is a subset of the union of its superclasses An entity that is a member of a category must exist in only one of the superclasses e.g., an OWNER may be a COMPANY a BANK, or a PERSON 3. UNION Types Using Categories

31 A shared subclass is a subset of the intersection of the superclasses An entity that is a member of the shared subclass must exist in all superclasses e.g., An engineering manager must be an ENGINEER, a MANAGER, and a SALARIED_EMPLOYEE 3. UNION Types Using Categories

32 Category vs generalized superclass A total category can be represented as a specialization (or a generalization) A partial category cannot be represented as a partial specialization (or a generalization) e.g., category REGISTERED_VEHICLE (Fig 4.8[5 th ], Fig 7.26[6 th ]) and generalized superclass VEHICLE (Fig 4.3(b) [5 th ], Fig 7.21(b) [6 th ])) 3. UNION Types Using Categories

33

34 A UNIVERSITY Database Example Requirements: The database keeps track Students and their majors, transcripts, and registration The university ’ s course offerings The sponsored research projects of faculty and graduate students The advisor and thesis committee of each graduate student Colleges and their related departments 4. An Example EER Schema

35 Initial design Entity types STUDENT COURSE FACULTY GRADUATE_STUDENT GRANT (project) 4. An Example EER Schema

36 DEPARTMENT (student ’ s majors) SECTION (course offerings, student ’ s registration) COLLEGE Superclass/subclass STUDENT/GRAD_STUDENT SECTION/CURRENT_SECTION (for quarter system universities) 4. An Example EER Schema

37 Generalization PERSON: {FACULTY, STUDENT} Category (Union type) INSTRUCTOR_RESEARCHER: {FACULTY, GRAD_STUDENT} 4. An Example EER Schema

38 Iterative refinement Relationship types STUDENT CURRENT_SECTION STUDENT DEPARTMENT STUDENT SECTION FACULTY DEPARTMENT FACULTY GRAD_STUDENT FACULTY GRANT 4. An Example EER Schema

39 INSTRUCTOR_RESEARCHER SECTION GRANT INSTRUCTOR_RESEARCHER COURSE SECTION DEPARTMENT COURSE COLLEGE DEPARTMENT Structure constraints 4. An Example EER Schema

40 ER Conceptual Design (cont.)

41 Alternative Notation

42 Summary Introduced the EER model concepts Class/subclass relationships Specialization and generalization Inheritance These augment the basic ER model concepts introduced in Chapter 3 EER diagrams and alternative notations were presented


Download ppt "Database Systems 主講人 : 陳建源 日期 :99/10/19 研究室 : 法 401 Chapter 4 Enhanced Entity-Relationship and Object Modeling."

Similar presentations


Ads by Google