Advanced Data Modelling: CTI2F3

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

1

CTI2F3
Database Modelling & Implementation

Advanced
Data Modelling
2

Learning Outcomes
Students are able to model or develop relational data
from case studies
3

Topics
Supertype and Subtype Representation
4

Supertype and Subtype


Representation
5

Basic Concept
• Subtype
• A subgrouping of the entities in an entity type that is meaningful to the organization and
that shares common attributes or relationships distinct from other subgroupings.
• Supertype
• A generic entity type that has a relationship with one or more subtypes.
• Example
• STUDENT is an entity type in a university. Two subtypes of STUDENT are GRADUATE
STUDENT and UNDERGRADUATE STUDENT. In this example, we refer to STUDENT as
the supertype
Notation 6

The U-shaped symbol on each line connecting a


subtype to the circle emphasizes that the subtype is a
subset of the supertype.
It also indicates the direction of the subtype/ supertype
relationship.
This U is optional because the meaning and direction of
the supertype/subtype relationship is usually obvious.

Attributes that are shared by all entities (including the


identifier) are associated with the supertype. Attributes
that are unique to a particular subtype are associated
with that subtype. The same is true for relationships.
Fig-1. Basic notation for supertype/subtype
relationships
7

Example
• A property by which subtype entities
inherit values of all attributes and
instances of all relationships of their
supertype. It’s called as attribute
inheritance.

• When to use supertype/subtype


relationships?
1. There are attributes that apply to some
(but not all) instances of an entity type.
2. The instances of a subtype participate
in a relationship unique to that subtype.
Fig-2. Example for supertype/subtype relationships
8

Generalization & Specialization


• Generalization
• The process of defining a more general entity type from a set of more specialized entity
types. Thus generalization is a bottom-up process.
• Specialization
• The process of defining one or more subtypes of the supertype and forming
Supertype/subtype relationships. Specialization is a top-down process, the direct reverse
of generalization.

• Specialization and generalization are both valuable techniques for developing


supertype/subtype relationships.
9

Completeness Constraints
• A completeness constraint addresses the question of whether an instance of
a supertype must also be a member of at least one subtype.
• The completeness constraint has two possible rules: total specialization and
partial specialization.
• The total specialization rule specifies that each entity instance of the
supertype must be a member of some subtype in the relationship.
• The partial specialization rule specifies that an entity instance of the
supertype is allowed not to belong to any subtype
10

Examples

Fig-3. Example for total specialization rule


Fig-4. Example for partial specialization rule
11

Disjointness Constraint
• A disjointness constraint addresses whether an instance of a supertype may
simultaneously be a member of two (or more) subtypes.
• The disjointness constraint has two possible rules: the disjoint rule and the
overlap rule
• The disjoint rule specifies that if an entity instance (of the supertype) is a
member of one subtype, it cannot simultaneously be a member of any other
subtype.
• The overlap rule specifies that an entity instance can simultaneously be a
member of two (or more) subtypes
12

Examples

Fig-6. Example for overlap rule

Fig-5. Example for disjoint rule

PURCHASED PART doesn’t have any attribute.


WHY??!!
13

Subtype Discriminator
• A subtype discriminator is an attribute of a supertype whose values
determine the target subtype or subtypes.
• a simple mechanism to consider the problem of inserting a new instance of a
supertype, which of the subtypes (if any) should instance be inserted, when
there is given a supertype/subtype relationship.
Disjoint Subtype (Discriminator)
14

• Notice that the following constraints have


been added to this figure:
total specialization and disjoint subtypes.
Thus, each employee must be either hourly,
salaried, or a consultant.
• A new attribute (Employee Type) has been
added to the supertype to serve as a
subtype discriminator.
Fig-7. Example for disjoint subtype • When a new employee is added to the
supertype, this attribute is coded with one
pay attention to how to write the notation above of three values, as follows: “H” (for Hourly),
“S” (for Salaried), or “C” (for Consultant).
Depending on this code, the instance is then
assigned to the appropriate subtype.
Overlapping Subtype (Discriminator)
15

• When subtypes overlap, a slightly


modified approach must be applied
for the subtype discriminator.
• An example of this situation is
shown in Fig-6 for PART and its
overlapping subtypes.
• A new attribute named Part Type has
been added to PART.
• Part Type is a composite attribute with
components Manufactured? and
Purchased?
• Each of these attributes is a Boolean
variable (i.e., it takes on only the values
yes, “Y,” and no, “N”).

Fig-8. Example for overlap subtype


16

Supertype/Subtype Hierarchies
• It is possible for any of the subtypes
in these examples to have other
subtypes defined on it.
• A supertype/subtype hierarchy is a
hierarchical arrangement of
supertypes and subtypes, where
each subtype has only one
supertype (Elmasri and Navathe,
1994)

Fig-9. Example for supertype/subtype hierarchies


ENTITY CLUSTERING
17

• Entity clustering (Teorey, 1999) is a useful way to present a data model for a
large and complex organization.
• An entity cluster is a set of one or more entity types and associated
relationships grouped into a single abstract entity type.
• Because an entity cluster behaves like an entity type, entity clusters and
entity types can be further grouped to form a higher-level entity cluster.
• Entity clustering is a hierarchical decomposition of a macro-level view of the
data model into finer and finer views, eventually resulting in the full, detailed
data model
• Examples of entity
18

Fig-10. Example for entity clustering

The example above is using Microsoft Visio modeling


19

Reference
Hoffer, Jeffrey A., et.al., "Modern Database Management", Twelfth Edition,
Pearson, 2016. Chapter 2

Recommended Link:
https://www.codeproject.com/Articles/878359/Data-Modelling-using-ERD-wit
h-Crow-Foot-Notation
https://www.youtube.com/watch?v=xzQQW0NiAMM
20

THANK
YOU

You might also like