Some entities have relationships that form hierarchies. For instance, Employee can be an hourly employee or contracted employee.
Enhanced ER Model
Specialization and Generalization AU: Dec- 19, Marks 7
• Some entities have relationships that form
hierarchies. For instance, Employee can be an hourly employee or contracted
employee.
• In this relationship hierarchies,
some entities can act as superclass and some other entities can act as
subclass.
• Superclass: An entity type that represents a general
concept at a high level, is called superclass.
• Subclass: An entity type that represents a specific concept at lower levels, is
called subclass.
• The subclass is said to inherit from
superclass. When a subclass inherits from one or more superclasses, it inherits
all their attributes. In addition to the inherited attributes, a subclass can also
define its own specific attributes.
• The process of making
subclasses from a general concept is called specialization. This is top-down
process. In this process, the sub-groups are identified within an entity set
which have attributes that are not shared by all entities.
• The process of making
superclass from subclasses is called generalization. This is a bottom up
process. In this process multiple sets are synthesized into high level
entities.
• The symbol used for specialization/ Generalization
is,
• For example - There can be two subclass entities namely
Hourly_Emps and Contract_Emps which are subclasses of Empoyee class. We might
have attributes hours_worked and hourly wage defined for Hourly_Emps and an
attribute contractid defined for ContractEmps.
Therefore, the attributes defined for an
Hourly_Emps entity are the attributes for Employees plus Hourly_Emps. We say
that the attributes for the entity set Employees are inherited by the entity
set Hourly_Emps and that Hourly-Emps ISA (read is a) Employees. It can be
represented by following Fig. 2.4.1.
There are four types of constraints on specialization/generalization
relationship. These are -
1) Membership constraints: This is a kind of
constraints that involves determining which entities can be members of a given
lower-level entity. There are two types of TO S membership constraints –
i) Condition
defined: In
condition-defined lower-level entity sets,membership is evaluated on the basis
of whether or not an entity satisfies an explicit condition or predicate. For
example - Consider the high-level entity Set Employee that has attribute
Employee_type. All Employee entities are evaluated on defining Employee_type
attribute. All entities that satisfy the condition student type = "ContractEmployee" are
included in Contracted Employee. Since all the lower-level entities are
evaluated on the basis of the same attribute this type of generalization is
said to be attribute-defined.
ii) User defined: This is kind of entity set that in which the
membership is manually
defined.
2) Disjoint constraints: The disjoint constraint
only applies when a superclass has more than one subclass. If the subclasses are disjoint, then an
entity occurrence can be a member of only one of the subclasses. For
entity Student has either Postgraduate Student entity or Undergraduate Student
3) Overlapping: When some entity can be a member of more than
one subclasses. For example - Person can be both a Student or a Staff. The And
can be used to représent this constraint.
4) Completeness: It 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 the generalization/specialization. This constraint may be
one of the following –
i) Total
generalization or specialization: Each higher-level entity must belong to a
lower-level entity set. For example - Account in the bank must either Savings
account or Current Account. The mandatory can be used to represent this constraint.
ii)
Partial generalization or specialization: Some higher-level entities may not belong to
any lower-level entity set.
A feature of the entity relationship model that allows a relationship
set to participate in another relationship set. This is indicated on an ER
diagram by drawing a dashed box around the aggregation.
For example - We treat the relationship set work and the entity sets
employee and project as a higher-level entity set called work.
Review Question
1. Explain with suitable example, the constraints
of specialization and generalization in ER modeling. AU: Dec. 19, Marks 7
Database Management System: Unit II: Databases Design : Tag: : Databases Design - Database Management System - Enhanced ER Model
Database Management System
CS3492 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation