Enhanced: Entity Relationship Modelling
Enhanced: Entity Relationship Modelling
Relationship Modelling
Dr. Enosha Hettarachchi
(Enhanced) Entity Relationship Modelling
2
Superclasses and Subclasses
Subclasses and Superclasses
– a subclass entity type is a specialised type of superclass entity
type
– a subclass entity type represents a subgrouping of superclass
entity type’s instances
e.g. undergraduates and postgraduates are subclasses of the
student superclass
3
Superclasses and Subclasses
The relationship between a superclass and any one of its
subclasses is called superclass/subclass relationship.
4
Basic notation for supertype/subtype
relationships- Traditional EER notation
5
Employee supertype with three
subtypes
6
Inheritance
An important concept associated with subclass is that of
type inheritance.
7
Inheritance
We say that an entity that is a member of a subclass
inherits all the attributes of the entity as a member of the
superclass.
8
Specialisation
Specialisation
– the process of defining a set of more specialised entity types of
an entity type
e.g. the set of subclasses {secretary, engineer, technician} is a
specialization of the super class Employee.
9
Specialisation
Employee
TypingSpeed
TGrade EngType
10
Specialisation
Specialization process allows to do followings
– Define a set of sub classes 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.
11
Generalisation
Generalisation
– The process of defining a generalised entity type from a set of
entity types
– Suppresses the differences among several entity types, identify
their common features and generalize them into a single
superclass.
- Inverse of the specialization process.
12
Generalisation
NoOfAxels Tonnage
MaxSpeed NoOfPassengers
Price TRUCK
Price CAR
Vehicleid LicensePlateNo
Vehicleid LicensePlateNo
Price
d
NoOfPassengers NoOfAxels
– Disjoint
the same entity instance may be a member
of only one subclass of the specialization
(eg: An employee cant be both a secretary and an engineer -
14
Both can’t function at the same time)
Constraints on Specialisation &
Generalisation
Overlap
Person
Employee Student
salary Department
15
Constraints on Specialisation &
Generalisation
Disjoint
Employee
TypingSpeed
TGrade EngType
17
Disjoint rule
18
Constraints on Specialisation &
Generalisation
Completeness
– Total
every entity instance in the superclass must
be a member of some subclass in the
specialization
– Partial
an entity instance in the superclass need
not be a member of any subclass in the
specialisation
20
Examples of completeness constraints
Total specialization rule
21
Partial specialization rule
22
Constraints on Specialisation &
Generalisation
Disjointness and completeness are independent and
therefore we have the following four possible constraints
on specialisation
– Disjoint, total
– Disjoint, partial
– Overlapping, total
– Overlapping, partial
23
Category
BName
BANK
PERSON COMPANY
personid compid
U
24
OWNER
END