代写代考

Copyright © 2016 and Shamkant B. Navathe

Copyright By PowCoder代写 加微信 powcoder

Enhanced Entity-Relationship
(EER) Modeling
Slide 1- *

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Subclasses and Superclasses (1)
An entity type may have additional meaningful subgroupings of its entities
Example: EMPLOYEE may be further grouped into:
SECRETARY, ENGINEER, TECHNICIAN, …
Based on the EMPLOYEE’s Job
EMPLOYEEs who are managers (the role they play)
SALARIED_EMPLOYEE, HOURLY_EMPLOYEE
Based on the EMPLOYEE’s method of pay
EER diagrams extend ER diagrams to represent these additional subgroupings, called subclasses or subtypes

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Subclasses and Superclasses

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Subclasses and Superclasses (2)
Each of these subgroupings is a subset of EMPLOYEE entities
Each is called a subclass of EMPLOYEE
EMPLOYEE is the superclass for each of these subclasses
These are called superclass/subclass relationships:
EMPLOYEE/SECRETARY
EMPLOYEE/TECHNICIAN
EMPLOYEE/MANAGER

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Subclasses and Superclasses (3)
These are also called IS-A relationships
SECRETARY IS-A EMPLOYEE, TECHNICIAN IS-A EMPLOYEE, ….
Note: An entity that is member of a subclass represents the same real-world entity as some member of the superclass:
The subclass member is the same entity in a distinct specific role
An entity cannot exist in the database merely by being a member of a subclass; it must also be a member of the superclass
A member of the superclass can be optionally included as a member of any number of its subclasses

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Subclasses and Superclasses (4)
A salaried employee who is also an engineer belongs to the two subclasses:
ENGINEER, and
SALARIED_EMPLOYEE
A salaried employee who is also an engineering manager belongs to the three subclasses:
ENGINEER, and
SALARIED_EMPLOYEE
It is not necessary that every entity in a superclass be a member of some subclass

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Representing Specialization in EER Diagrams

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Attribute Inheritance in Superclass / Subclass Relationships
An entity that is member of a subclass inherits
All attributes of the entity as a member of the superclass
All relationships of the entity as a member of the superclass
In the previous slide, SECRETARY (as well as TECHNICIAN and ENGINEER) inherit the attributes Name, SSN, …, from EMPLOYEE
Every SECRETARY entity will have values for the inherited attributes

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Specialization (1)
Specialization is the process of defining a set of subclasses of a superclass
The set of subclasses is based upon some distinguishing characteristics of the entities in the superclass
Example: {SECRETARY, ENGINEER, TECHNICIAN} is a specialization of EMPLOYEE based upon job type.
Example: MANAGER is a specialization of EMPLOYEE based on the role the employee plays
May have several specializations of the same superclass

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Specialization (2)
Example: Another specialization of EMPLOYEE based on method of pay is {SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}.
Superclass/subclass relationships and specialization can be diagrammatically represented in EER diagrams
Attributes of a subclass are called specific or local attributes.
For example, the attribute TypingSpeed of SECRETARY
The subclass can also participate in specific relationship types.
For example, a relationship BELONGS_TO of HOURLY_EMPLOYEE

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Specialization (3)

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Generalization
Generalization is the reverse of the specialization process
Several classes with common features are generalized into a superclass;
original classes become its subclasses
Example: CAR, TRUCK generalized into VEHICLE;
both CAR, TRUCK become subclasses of the superclass VEHICLE.
We can view {CAR, TRUCK} as a specialization of VEHICLE
Alternatively, we can view VEHICLE as a generalization of CAR and TRUCK

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Generalization (2)

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Generalization and Specialization (1)
Diagrammatic notations are sometimes used to distinguish between generalization and specialization
Arrow pointing to the generalized superclass represents a generalization
Arrows pointing to the specialized subclasses represent a specialization
We do not use this notation because it is often subjective as to which process is more appropriate for a particular situation
We advocate not drawing any arrows

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Generalization and Specialization (2)
Data Modeling with Specialization and Generalization
A superclass or subclass represents a collection (or set or grouping) of entities
It also represents a particular type of entity
Shown in rectangles in EER diagrams (as are entity types)
We can call all entity types (and their corresponding collections) classes, whether they are entity types, superclasses, or subclasses

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
Alternative diagrammatic notations
ER/EER diagrams are a specific notation for displaying the concepts of the model diagrammatically
DB design tools use many alternative notations for the same or similar concepts
One popular alternative notation uses UML class diagrams
see next slides for UML class diagrams and other alternative notations

Copyright © 2016 and Shamkant B. Navathe

Slide 4- *
UML Example for Displaying Specialization / Generalization

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com