enhanced entity relationship models
play

Enhanced Entity-Relationship Models 1 / 10 Enahnced - PowerPoint PPT Presentation

Enhanced Entity-Relationship Models 1 / 10 Enahnced Entity-Relationship Models Enhanced ER models add inheritance to entity types superclasses and subclasses. Subclasses inherit all the attributes of their superclass(es). Subclasses can:


  1. Enhanced Entity-Relationship Models 1 / 10

  2. Enahnced Entity-Relationship Models Enhanced ER models add inheritance to entity types – superclasses and subclasses. Subclasses inherit all the attributes of their superclass(es). Subclasses can: ◮ be disjoint or overlapping; ◮ represent total or partial specialization. 2 / 10

  3. University Member Consider this model of a university member: ID Name Rank UNIV_MEMBER Major Position Salary ◮ Do faculty members have a major? ◮ Do students have a rank or salary? 3 / 10

  4. Employee and Student Subclasses Here we break the UNIV_MEMBER into two subtypes: ID Name UNIV_MEMBER O Emp_type EMPLOYEE STUDENT Position Hours Major Rank Salary Notice that the subclasses are overlapping, as denoted by the O in the circle under UNIV_MEMBER. That means that an entity can be both a STUDENT and an EMPLOYEE. But there’s more: ◮ What’s that Emp_type attribute? ◮ Can an emplyee have a salary and a number of hours? 4 / 10

  5. Faculty and Staff Subclasses ◮ The subclasses of EMPLOYEE are disjoint (D in the circle) – an employee is either ID Name SALARIED or HOURLY but UNIV_MEMBER not both. ◮ The double line from employee O Emp_type means total specialization – EMPLOYEE STUDENT there are no EMPLOYEE Salary Emp_type instances, only SALARIED or Major D HOURLY. ‘Hourly’ ‘Salaried’ SALARIED HOURLY The process of going from an entity type that has attributes that don’t Hours D apply to all entity instances to FACULTY STAFF subclasses that are specialized but inherit the common attributes is Rank Position called specialization (top-down). a a We’re not quite done, but we’ll return to this example. 5 / 10

  6. Cars and Trucks Let’s consider another model. VIN Seating VIN Seating Car Truck BodyType BedLength Notice the common attributes. We can factor those into a superclass. 6 / 10

  7. Vehicles The common attributes are in the superclass and the specialized attributes are in the subclass. VIN Seating VEHICLE O CAR TRUCK BodyType BedLength The process of factoring the common attributes of two or more entity types and creating superclasses to hold the common attributes is called generalization (bottom-up). 7 / 10

  8. Student Employees Remember our STUDENT - EMPLOYEE hierarchy: ID Name UNIV_MEMBER O Emp_type EMPLOYEE STUDENT Salary Emp_type Major D ‘Hourly’ ‘Salaried’ SALARIED HOURLY Hours D FACULTY STAFF Rank Position What about STUDENTS who are also HOURLY employees, like TAs and research assistants? 8 / 10

  9. Multiple Inheritance Our previous EER models have been inheritance trees – each subclass had only one superclass. We can create lattices with multiple inheritance: ID Name UNIV_MEMBER O Emp_type EMPLOYEE STUDENT Major Salary Emp_type D Hours ‘Salaried’ ‘Hourly’ SALARIED HOURLY STUD_EMP D D FACULTY STAFF RA TA Rank Position Project Course 9 / 10

  10. Fin Subclassses provide for more granular and precise modeling of entity types. Use sublcasses when: ◮ you want to represent commonality and differences between different entity types, ◮ you want to have different subsets of an enity type participate in different relationships (e.g., faculty participate in TEACHES relationships, HOURLY employees don’t). 10 / 10

Recommend


More recommend