You are on page 1of 22

CHAPTER 4

ENHANCED ENTITY –RELATIONSHIP


AND OBJECT MODELING

Prepared by ELias B.
Outline
Subclass, Super-class and Inheritance

Specialization and Generalization

Chap 4
Constraints and Characteristics of Specialization and
Generalization
1
SUBCLASSES, SUPER CLASSES, AND INHERITANCE
 In many cases an entity type has numerous sub groupings or
subtypes of its entities that are meaningful and need to be
represented explicitly because of their significance to the database
application.

Prepared by ELias B.
 For example, the entities that are members of the EMPLOYEE
entity type may be distinguished further into SECRETARY,
ENGINEER,MANAGER,TECHNICIAN,SALARIED_EMPLOY
EE,HOURLY_EMPLOYEE, and so on.

Chap 4
 The set of entities in each of the latter groupings is a subset of the
entities that belong to the EMPLOYEE entity set, meaning that
every entity that is a member of one of these sub groupings is also
an employee.
 We call each of these sub groupings a subclass or subtype of the
EMPLOYEE entity type, and the EMPLOYEE entity type is2
called the super class or super type for each of these subclasses.
Prepared by ELias B. Chap 4
3
EXAMPLE
Relationships and attributes of super class
are inherited to subclass (in particular
primary key attribute(s)); subclass can

Prepared by ELias B.
have additional attributes and
relationships
 An entity cannot exist merely by being a

Chap 4
member of only a subclass.

4
SPECIALIZATION AND GENERALIZATION
1. Specialization is the process of defining a set of subclasses of
an entity type. (top-down)
 This entity type is called the super class of the specialization.

Prepared by ELias B.
 The set of subclasses that forms a specialization is defined on
the basis of some distinguishing characteristic of the entities in
the super class.
2. Generalization

Chap 4
 Reverse process of specialization (bottom-up);

 identify common features of entity types and generalize them


into single super class (including primary key)

5
DIAGRAMMATIC NOTATION FOR SPECIALIZATION

Prepared by ELias B.
Chap 4
6
CONT…
 HOURLY EMPS is a subclass of EMPLOYEES and thus
inherits its attributes and relationships (same for
CONTRACT EMPS).

Prepared by ELias B.
Chap 4
7
DIAGRAMMATIC NOTATION FOR GENERALIZATION

Prepared by ELias B.
Chap 4
8
DESIGN CONSTRAINTS ON A
SPECIALIZATION/GENERALIZATION

Constraint on which entities can be members of a given lower-


level entity set.
 condition-defined
 Example: all customers over 65 years are members of

Prepared by ELias B.
senior-citizen entity set; senior-citizen ISA person.
 user-defined

Constraint on whether or not entities may belong to more than one


lower-level entity set within a single generalization.

Chap 4
 Disjoint
 an entity can belong to only one lower-level entity set

 Noted in E-R diagram by having multiple lower-level

entity sets link to the same triangle


 Overlapping
9
 an entity can belong to more than one lower-level entity

set
CONT…
Completeness constraint -- specifies whether or not an entity in
the higher-level entity set must belong to at least one of the
lower-level entity sets within a generalization.

Prepared by ELias B.
 total: an entity must belong to one of the lower-level entity
sets
 partial: an entity need not belong to one of the lower-level
entity sets

Chap 4
Restricts the design of the Data Base Management System
Restricts the design of the Data Base Management System
Restricts the design of the Data Base Management System

10
EER MODEL
 EER is a high-level data model that incorporates the extensions to the
original ER model.

It is a diagrammatic technique for displaying the following concepts


 Sub Class and Super Class

 Specialization and Generalization

Prepared by ELias B.
 Union or Category

 Aggregation

 These concepts are used when the comes in EER schema and the resulting
schema diagrams called as EER Diagrams.

Chap 4
 Features of EER Model

 EER creates a design more accurate to database schemas.


 It reflects the data properties and constraints more precisely.
 It includes all modeling concepts of the ER model.
 Diagrammatic technique helps for displaying the EER schema.
 It includes the concept of specialization and generalization. 11
 It is used to represent a collection of objects that is union of objects of
different of different entity types.
A. SUB CLASS AND SUPER CLASS
 Sub class and Super class relationship leads the concept of
Inheritance.
 The relationship between sub class and super class is denoted with
symbol.
1. Super Class

Prepared by ELias B.
 Super class is an entity type that has a relationship with one or
more subtypes.
 An entity cannot exist in database merely by being member of

Chap 4
any super class. For example: Shape super class is having sub
groups as Square, Circle, Triangle.
2. Sub Class
 Sub class is a group of entities with unique attributes.

 Sub class inherits properties and attributes from its super


12
class. For example: Square, Circle, Triangle are the sub class
of Shape super class.
Prepared by ELias B. Chap 4
13
SUPERCLASS AND SUBCLASS
B. SPECIALIZATION AND GENERALIZATION

1. Generalization
 Generalization is the process of generalizing the
entities which contain the properties of all the
generalized entities.

Prepared by ELias B.
 It is a bottom approach, in which two lower level
entities combine to form a higher level entity.
 Generalization is the reverse process of

Chap 4
Specialization.
 It defines a general entity type from a set of
specialized entity type.
 It minimizes the difference between the entities by
14
identifying the common features.
For example:
Prepared by ELias B.
Chap 4
IN THE ABOVE EXAMPLE, TIGER, LION, ELEPHANT CAN ALL BE GENERALIZED AS ANIMALS . 15
2. SPECIALIZATION
 Specialization is a process that defines a group entities
which is divided into sub groups based on their
characteristic.
 It is a top down approach, in which one higher entity

Prepared by ELias B.
can be broken down into two lower level entity.
 It maximizes the difference between the members of
an entity by identifying the unique characteristic or
attributes of each member.

Chap 4
 It defines one or more sub class for the super class and
also forms the superclass/subclass relationship.
For example
16
Prepared by ELias B.
Chap 4
IN THE ABOVE EXAMPLE, EMPLOYEE CAN BE SPECIALIZED AS DEVELOPER OR
TESTER, BASED ON WHAT ROLE THEY PLAY IN AN ORGANIZATION. 17
C. CATEGORY OR UNION
 Category represents a single super class or sub class
relationship with more than one super class.
 It can be a total or partial participation.
For example Car booking, Car owner can be a person, a bank
(holds a possession on a Car) or a company. Category (sub

Prepared by ELias B.
class) → Owner is a subset of the union of the three super
classes → Company, Bank, and Person.
 A Category member must exist in at least one of its super
classes.

Chap 4
18
Prepared by ELias B. Chap 4
19
D. AGGREGATION
 Aggregation is a process that represent a
relationship between a whole object and its
component parts.

Prepared by ELias B.
 It abstracts a relationship between objects and
viewing the relationship as an object.
 It is a process when two entity is treated as a

Chap 4
single entity.

20
Prepared by ELias B.
Chap 4
IN THE ABOVE EXAMPLE, THE RELATION BETWEEN COLLEGE AND
COURSE IS ACTING AS AN ENTITY IN RELATION WITH STUDENT. 21
Prepared by ELias B. Chap 4
22
END

You might also like