Lecture Slides available: PDF PowerPoint Advanced ER MappingContents
Overview
Mapping parallel relationshipsParallel relationships occur when there are two or more relationships between two entity types (e.g. employees own and service cars).
Employee(employee_no,...) Vehicle(registration_no,...)
Employee(employee_no,...)
Vehicle(registration_no,owner_no,serviced_by,...)
Mapping 1:m in unary relationships
Employee(employee_no,manager_no, name,...)
Mapping superclasses and subclassesThere are three ways of implementing superclasses and subclasses and it depends on the application which will be the most suitable. Only the first method is a true reflection of the superclasses and subclasses and if either of the other methods is preferential then the model should not have subclasses.
Example
Staff(staff_no,name,address,dob) Manager(bonus) Secretary(wp_skills) Sales_personnel(sales_area, car_allowance) One relation for the superclass and one relation for each subclass: Staff(staff_no,name,address,dob) Manager(staff_no,bonus) Secretary(staff_no,wp_skills) Sales_personnel(staff_no,sales_area, car_allowance) The primary key of the superclass is mapped into each subclass and becomes the subclasses primary key. This represents most closely the EER model. However it can cause efficiency problems as there needs to be a lot of joins if the additional information is often needed for all staff. One relation for each subclass: Manager(staff_no,name,address,dob,bonus) Secretary(staff_no,name,address,dob,wp_skills) Sales_personnel(staff_no,name,address,dob,sales_area, car_allowance) All attributes are mapped into each subclass. It is equivalent to having three separate entity types and no superclass. It is useful if there are no overlapping entities and there are no relationships between the superclass and other entity types. It is poor if the subclasses are not disjoint as there is data duplication in each relation which can cause problems with consistency. One relation for the superclass:
Staff(staff_no,name,address,dob, bonus, wp_skills, sales_area, car_allowance)
This represents a single entity type with no subclasses. This is no good if the subclasses are not disjoint or if there are relationships between the subclasses and the other entities. In addition, there will be many null fields if the subclasses do not overlap a lot. However, it avoids any joins to get additional information about each member of staff.
|
|