Objectives: Chapter (4) Enhanced Entity-Relationship and Object Modeling
Objectives: Chapter (4) Enhanced Entity-Relationship and Object Modeling
Objectives
• Concepts of subclass and superclass and the related concepts of
specialization and generalization.
• Concept of category, which is used to represent a collection of objects that
is the union of objects of different entity types.
• Concepts is the important mechanism of attribute and relationship
inheritance.
• Diagrammatic technique for displaying these concepts when they arise in an
EER schema (enhanced-ER or EER diagrams).
• Object Data Modeling methodologies.
An entity type is used to represent both a type of entity, and the entity set or
collection of entities of that type that exist in the database. In many cases an
entity type has numerous subgroupings of its entities that are meaningful and
need to be represented explicitly because of their significance to the database
application.
1
Subclasses, Superclasses, and Inheritance
An entity may have subgrouping of its entities that are meaningful. That may be
due to their significance to the database application.
2
Subclasses, Superclasses, and Inheritance
An entity in the subclass represents the same real-world entity from the
superclass, it should posses values for its specific attributes as well as values of
its attributes as a member of the superclass.
We say that an entity that is a member of a subclass inherits all the attributes of
the entity as a member if superclass. The entity in the subclass also inherits all
the relationships in which the superclass participates. 3
Specialization and Generalization
Specialization is the process of defining a set of subclasses of an entity type; this
entity type is called the superclass of the specialization.
We may have several specializations of the same entity type based on different
distinguishing characteristics.
A subclass may have additional attributes, which are called specific attributes or
local attributes of the subclass. Also, a subclass may participate in additional
relationship type (specific relationship types).
There are two main reasons for including class/subclass relationships and
specialization in a data model:
1) Certain attributes may apply to some but not all entities of the
superclass,
2) Some relationship types may be participated only by entities that are
members of the subclass. 4
5
Specialization and Generalization
The specialization process allows us to do the following:
• Define a set of subclasses of an entity type,
• Establish additional specific attributes with each subclass,
• Establish additional specific relationship types between each subclass and
other entity types or other subclasses.
6
7
8
Constraints and Characteristics of Specialization and
Generalization
How do we determine exactly the entities that will become members of each
subclass?
For example the EMPLOYEE entity may have an attribute called JobType. Then
for a SECRETARY subclass we predicate (JobType = ‘Secretary’), which we call
the defining predicate of the subclass. This condition is satisfied in both the
EMPLOYEE and SECRETARY, how?
Each membership is specified individually for each entity by the user, NOT by any
condition that may be evaluated automatically.
Note: a superclass that was identified through the generalization process usually is
total, Why?
Because the superclass is derived from the subclasses.
12
Constraints and Characteristics of Specialization and
Generalization
Rules that apply to insertion and/or deletion of specialization (or generalization):
A subclass with more than one superclass is called a shared subclass. Example:
If every engineer must be a SALRIED_EMPLOYEE and MANAGER, then
ENGINEERING-MANAGER should be a shared subclass of all three subclasses.
In such cases the shared subclass may inherit several attributes and relationships
from multiple classes, this is called multiple inheritance.
13
14
15
16
Utilizing Specialization and Generalization in Conceptual
Data Modeling
In specialization process, we typically start with an entity type and then define
subclasses of the entity type by successive specialization. This successive
specialization corresponds to a top-down conceptual refinement process.
17
Modeling of UNION Types using categories
In such a case the subclass will represent a collection of objects that is the UNION
of distinct entity types. We call such a subclass a union type or a category.
A category has two or more superclasses that may represent distinct entity types,
whereas other superclass/subclass relationships always have a single superclass.
19
Utilizing Specialization and Generalization in Conceptual
Data Modeling
Attribute inheritance works more selectively in the case of categories.
A category such as OWNER entity inherits the attributes of COMPANY, a
PERSON, or a BANK, depending on the superclass to which the entity belongs.
20
21
An Example – UNIVERSITY Database (Fig 4.10)
Requirements:
For each person, that database maintain information on the person’s Name
[name], social security number [Ssn], address [Address], sex [Sex], and birth date
[BDate].
FACULTY should have attributes for rank [Rank], office [Office], office phone
[FPhone], and salary [Salary]. All faculty BELONGS to one or more departments.
STUDENT should have attributes for class [Class]. Students are related to their
MAJOR or MINOR , to the course sections [REGISTERED], and to the course
completed [TRANSCRIPT]. Each TRANSCRIPT instance includes the grade
student received [Grade] in the course section.
An academic department has the attribute name [DName], telephone … I let you
fill the rest …
23
24
Universal Modeling Language (UML)
A class is displayed as a box with three partitions:
Top Part: Name of the entity
Middle Part: Attributes
Bottom Part: Operations allowed
Relation types are called associations. Relationship instances are called links.
26
It was: Schema Diagram of COMPANY
27
28