Professional Documents
Culture Documents
Chapter 02 Data Model
Chapter 02 Data Model
Staff Preference
clientNo (PK)
name states
fName
lName
composite entity:
1) it is composed of the primary keys of each of the entities to
be connected
2) It may also contain additional attributes that play no role in
the connective process
when to use it?
If M : N relationships are connected, we must create a bridge
between the entities that display such relationships
relationship: a set of meaningful associations among
participating entities
each relationship is given a name that describes its function
for example: an Actor entity is associated with the Role
entity through a relationship called Plays
1 1
Staff manages Branch
one-to-many (1:M) relationships
1) a branch has members staff
each member of staff works at one branch
each branch has one or more staff
1 1…*
Branch has Staff
many-to-many (M:N) relationships
1) newspapers advertise properties for rent
each property for rent is advertised in zero or more
newspapers
each newspapers advertises one or more properties
for rent
1…* 1…*
Newspaper advertises PropertyForRent
multiplicity = cardinality + participation
cardinality: describes the maximum of number of possible
relationship occurrences for an entity participating in a
given relationship type
participation: determines whether all or only some entity
occurrences participate in a relationship
connection traps
It occurs due to a misinterpretation of the meaning of
certain relationships
to identify connection traps we must ensure that the
meaning of relationship (and the business rule that it
represents) is fully understood and clearly defined
2 main types:
1) fan traps
2) chasm traps
fan trap: where a model represents a relationship between
entity types, but the pathway between certain entity
occurrences is ambiguous
fan traps can be resolved by restructuring the original Entity
Relationship (ER) model to represent the correct
association between the involved entities
chasm trap: where a model suggest the existence of a
relationship between entity types, but the pathway does
not exist between certain entity occurrences
It may occur where there are one or more relationships with
a minimum multiplicity of zero forming part of the pathway
between related entities
chasm traps can be resolved by adding a relationship
between related entities
super-classes:
an entity type that includes one or more distinct sub-
groupings of its occurrences, which require to be
represented in a data model
sub-classes:
an distinct sub-grouping of occurrences of an entity
type, which require to be represented in a data model
each member of a subclass is also a member of the super-
class;
but has a distinct role
for example:
Staff (super-class) / Manager (sub-class)
concepts of super-class & sub-class is important:
reasons:
1) to avoid describing similar concepts more than once
thereby more readable and saving time
2) it adds more semantic information to the design in a
form that is familiar to many people
for example:
1) “Manager IS-A member of staff”
2) “Flat IS-A type of property”
attribute inheritance:
is a process by which a member of a subclass may
posses subclass-specific attributes, and inherit those
attributes associated with the super-class
attribute inheritance:
for example:
a member of the SalesPersonnel subclass inherits all
the attributes of the Staff superclass such as staffNo,
name, position and salary and;
specially associated with the SalesPersonnel subclass
such as salesArea, and carAllowance
specialization:
the process of maximizing the differences between
members of an entity by identifying their distinguishing
characteristics
top-down approach
try to identify differences between members of the
entity such as members with unique attributes and / or
relationships
generalization:
the process of minimizing the differences between
entities by identifying their common characteristics
bottom-up approach
try to identify similarities between the entities such as
common attributes and relationships
constraints on specialization / generalization:
2 types of constraints:
1) participation constraint
2) disjoint constraint
participation constraint
determine whether every occurrence in the super-class
must participate as a member of a subclass
it may be mandatory or optional
participation constraint:
it specifies that every entity occurrence in the super-
class must also be a member of a subclass
example:
1) vehicle specialization /generalization (Van, Bus, and
Car) has mandatory participation
which means that every vehicle must be a van, bus
or car
participation constraint:
example:
2) job role specialization /generalization has optional
participation
which means that a member of staff need not
have an additional job role such manager,
secretary or sales personnel
disjoint constraint:
describes the relationship between members of the
subclasses and indicates whether it’s possible for a
member of a super-class to be a member of one, or
more than one, subclass
only applies when a super-class has more than one
subclass
It may disjoint or non-disjoint
example of disjoint:
if the subclasses of the contract of employment
specialization/generalization is disjoint, which means
that a member of staff must have a full-time
permanent or a part-time temporary contract, but
not both
disjoint constraint:
example of non-disjoint:
if the job role specialization / generalization is non-
disjoint, which means that an entity occurrence can
be a member of both the Manager, SalesPersonnel
and Secretary subclasses
identify the super-class as the parent entity and the
subclass as the child entity
Example:
Tables to represent the Staff specialization/ generalization
Staff superclass
Staff(staffNo, name, position, salary, branchNo)
Primary Key staffNo
Foreign Key branchNo references Branch(branchNo)
Staff subclasses
AllStaffSubclasses(subclassStaffNo, bonus, salesArea,
carAllowance, typingSpeed, staffNo)
Primary Key subclassStaffNo
Foreign Key subclassStaffNo references Staff(staffNo)
Guidelines to represent super-class/ subclass
relationship
Participation Disjoint constraint Table required
constraint
Mandatory Nondisjoint {And} Single table