Fundamentals of database
HARAMBE UNIVERSITY
COLLAGE OF COMPUTING
COMPUTER SCINCE DEPARTMENT
Chapter 4: Enhanced Entity –Relationship and Object modeling
6/22/2024 1
Lesson Outline
 Subclass,
 Super-class and Inheritance
 Specialization
 Generalization
 Constraints and Characteristics of Specialization and
Generalization
6/22/2024 2
Cont…
Subclass
Class: Set or collection of entities
Subclass is Class whose entities must always be a subset
of the entities in another class
 An entity type may have additional meaningful sub
groupings of its entities
• Example: student may be further grouped into:
Regular student, extension student, summer student
Undergraduate student, master student, PHD
student
 EER diagrams extend ER diagrams to represent these
additional sub groupings, called subclasses or subtypes
6/22/2024 3
Cont…
 Each of these sub groupings is a subset of student entities
 Each is called a subclass of student
o These are also called IS-A/IS-AN relationships
i.e. Regular student IS-A student, summer student IS-A
student).
 Super class - Is the term used to describe the Entity that
contains a subclass(s). Student is the super class for each
of these subclasses
 These are called super class/subclass relationships:
 student/regular student
 student/extention student
 student/summar
6/22/2024 4
Cont…
Generalization, Specialization, and Inheritance
1.Specialization
Is a process of defining a set of subclasses of an entity
type, this entity type is called supper class of entity type.
It is a top-down conceptual refinement process
Example: the set of subclass (regular student, summer
student, extension student) is a specialization of the
supper class student.
2.Generalization
Generalization derives from the fact that the super class
generalizes the subclasses. making generalization by
standing from the subclass into single supper
class/process of defining a generalized entity type.
6/22/2024 5
Cont…
Example: all regular students, summer students and
extension students are subclasses of the generalized
supper class student.
Inheritance
Is the mechanism for sharing attributes, operations, and
associations via the generalization/specialization
relationship.
Example:
 Masters student share some attribute from student,
 Regular student share some attribute from supper class
student,
 Summer student share some attribute from student.
6/22/2024 6
Cont…
Constraints of Specialization and Generalization
• If we can determine exactly those entities that will become
members of each subclass by a condition, the subclasses are
called predicate-defined (or condition-defined) subclasses
o Condition is a constraint that determines subclass
members
o Display a predicate-defined subclass by writing the
predicate condition next to the line attaching the subclass
to its super class
6/22/2024 7
Cont…
• If all subclasses in a specialization have membership
condition on same attribute of the super class,
specialization is called an attribute-defined
specialization.
Attribute is called the defining attribute of the
specialization
Example: Job Type is the defining attribute of the
specialization {SECRETARY, TECHNICIAN,
ENGINEER} of EMPLOYEE
NB: job type same with student type
• If no condition determines membership, the subclass is
called user-defined
– Membership in a subclass is determined by the
database users by applying an operation to add an
entity to the subclass
– Membership in the subclass is specified individually
6/22/2024 8
Cont…
6/22/2024 9
Cont…
Two basic constraints can apply to a
specialization/generalization:
– Disjointness Constraint:
– Completeness Constraint:
• Disjointness Constraint: Specifies that the subclasses
of the specialization must be disjoint:
• meaning-an entity can be a member of at most one of the
subclasses of the specialization
– Specified by d in EER diagram
– If not disjoint, specialization is overlapping: meaning -
the same entity may be a member of more than one
subclass of the specialization
6/22/2024 10
Cont…
employee
Student
job
6/22/2024 11
Cont…
• Completeness Constraint:
– Total specifies that every entity in the superclass must
be a member of some subclass in the
specialization/generalization
– Shown in EER diagrams by a double line
– Partial allows an entity not to belong to any of the
subclasses
– Shown in EER diagrams by a single line
6/22/2024 12
THANK YOU
6/22/2024 13

dataabase administration for computer cs

  • 1.
    Fundamentals of database HARAMBEUNIVERSITY COLLAGE OF COMPUTING COMPUTER SCINCE DEPARTMENT Chapter 4: Enhanced Entity –Relationship and Object modeling 6/22/2024 1
  • 2.
    Lesson Outline  Subclass, Super-class and Inheritance  Specialization  Generalization  Constraints and Characteristics of Specialization and Generalization 6/22/2024 2
  • 3.
    Cont… Subclass Class: Set orcollection of entities Subclass is Class whose entities must always be a subset of the entities in another class  An entity type may have additional meaningful sub groupings of its entities • Example: student may be further grouped into: Regular student, extension student, summer student Undergraduate student, master student, PHD student  EER diagrams extend ER diagrams to represent these additional sub groupings, called subclasses or subtypes 6/22/2024 3
  • 4.
    Cont…  Each ofthese sub groupings is a subset of student entities  Each is called a subclass of student o These are also called IS-A/IS-AN relationships i.e. Regular student IS-A student, summer student IS-A student).  Super class - Is the term used to describe the Entity that contains a subclass(s). Student is the super class for each of these subclasses  These are called super class/subclass relationships:  student/regular student  student/extention student  student/summar 6/22/2024 4
  • 5.
    Cont… Generalization, Specialization, andInheritance 1.Specialization Is a process of defining a set of subclasses of an entity type, this entity type is called supper class of entity type. It is a top-down conceptual refinement process Example: the set of subclass (regular student, summer student, extension student) is a specialization of the supper class student. 2.Generalization Generalization derives from the fact that the super class generalizes the subclasses. making generalization by standing from the subclass into single supper class/process of defining a generalized entity type. 6/22/2024 5
  • 6.
    Cont… Example: all regularstudents, summer students and extension students are subclasses of the generalized supper class student. Inheritance Is the mechanism for sharing attributes, operations, and associations via the generalization/specialization relationship. Example:  Masters student share some attribute from student,  Regular student share some attribute from supper class student,  Summer student share some attribute from student. 6/22/2024 6
  • 7.
    Cont… Constraints of Specializationand Generalization • If we can determine exactly those entities that will become members of each subclass by a condition, the subclasses are called predicate-defined (or condition-defined) subclasses o Condition is a constraint that determines subclass members o Display a predicate-defined subclass by writing the predicate condition next to the line attaching the subclass to its super class 6/22/2024 7
  • 8.
    Cont… • If allsubclasses in a specialization have membership condition on same attribute of the super class, specialization is called an attribute-defined specialization. Attribute is called the defining attribute of the specialization Example: Job Type is the defining attribute of the specialization {SECRETARY, TECHNICIAN, ENGINEER} of EMPLOYEE NB: job type same with student type • If no condition determines membership, the subclass is called user-defined – Membership in a subclass is determined by the database users by applying an operation to add an entity to the subclass – Membership in the subclass is specified individually 6/22/2024 8
  • 9.
  • 10.
    Cont… Two basic constraintscan apply to a specialization/generalization: – Disjointness Constraint: – Completeness Constraint: • Disjointness Constraint: Specifies that the subclasses of the specialization must be disjoint: • meaning-an entity can be a member of at most one of the subclasses of the specialization – Specified by d in EER diagram – If not disjoint, specialization is overlapping: meaning - the same entity may be a member of more than one subclass of the specialization 6/22/2024 10
  • 11.
  • 12.
    Cont… • Completeness Constraint: –Total specifies that every entity in the superclass must be a member of some subclass in the specialization/generalization – Shown in EER diagrams by a double line – Partial allows an entity not to belong to any of the subclasses – Shown in EER diagrams by a single line 6/22/2024 12
  • 13.