You are on page 1of 35

Advance Database

Management System
Unit – 1 .The Extended Entity Relationship Model and Object Model
.
Index

▪ The ER Model revisited


▪ Motivation for complex data types
▪ User defined abstract data types and structured types
▪ Subclasses and Superclasses
▪ Inheritance
▪ Specification and Generalisation
▪ Relationship types of degree higher than two
3 level of abstraction in dbms
The ER Model revisited

▪ Conceptual design: (ER Model is used at this


stage.)
– What are the entities and relationships in the
enterprise?
– What information about these entities and relationships
should we store in the database?
– What are the integrity constraints or business rules that
hold?
– A database `schema’ in the ER Model can be
represented pictorially (ER diagrams).
– An ER diagram can be mapped into a relational schema.
ER Model Basics
▪ Entity Type: It is collection of entity having common
attribute.
– table is an entity type
▪ Entity: Real-world object distinguishable from other
objects.
– An entity is described using a set of attributes.
–  each tuple in the table is an entity.
▪ Entity Set: A collection of similar entities. E.g., all
employees.
– It is a set of entities of same entity type
– Each entity set has a key.
– Each attribute has a domain.
ER Model Basics continued…

▪ Key and key attributes:


– Key: a unique value for an entity
– Key attributes: a group of one or more attributes that uniquely identify
an entity in the entity set
▪ Super key, candidate key, and primary key
– Super key: a set of attributes that allows to identify a entity uniquely in
the entity set
– Candidate key: subset of super key
▪ There can be many candidate keys
– Primary key: a candidate key chosen by the designer
▪ Denoted by underlining in ER attributes
ER Model Basics name

ssn lot
continued…

since Employees
name dname
super- subor-
ssn lot did budget visor dinate
Reports_To
Employees Works_In Departments

▪ Relationship: Association among two or more entities. e.g., Jack


works in Pharmacy department.
▪ Relationship Set: Collection of similar relationships.
– A set of relationships of similar type is called a relationship set. Like entities, a
relationship too can have attributes. These attributes are called descriptive
attributes.
– Same entity set could participate in different relationship sets, or in different “roles” in
same set.
since
Mapping name dnam
ssn lot did e budget

▪ Consider Works_In:
Employees Works_in Departments
An employee can
work in many
departments; a dept
can have many
employees.
▪ In contrast, each dept
has at most one
manager, according to
the key constraint on
Manages. 1-to-1 1-to Many Many-to-1 Many-to-Many
Types of attributes

▪ Single valued Attributes 


▪ Multi valued Attributes
▪ Compound Attribute/Composite Attribute 
▪ Simple Attributes/Atomic Attributes 
▪ Stored Attribute
▪ Derived Attribute 
▪ Complex Attributes
▪ Key Attribute
▪ Non Key Attributes
▪ Optional Attribute/Null Value Attribute
Sample ER schema
Motivation for complex data types

▪ Most relational DBMS support only a few data types.


▪ Recent years have seen an increasing number of technological and economical
developments that affect the way in which database systems are used.
▪ Data warehousing , data mining , geographical  and other information systems
have added new requirements with respect to data modelling and processing
performance.
▪ More complex applications—such as engineering design, medical information
systems, and telecommunications—require additional concepts if we want to
model them with greater accuracy.
▪ Many business applications require large amounts of complex data such as
images, audio, and video.
▪ The need to integrate complex data with simple data drives the demand for
object database technology.
User defined abstract data types and structured types

▪ The concept of user-defined abstract data types is


relatively recent
▪ A data type can be considered abstract when it is defined
in terms of operations on it, and its implementation is
hidden
▪ Programming language they are called structures, in
data structure theory they are called abstract data types
(ADT's), while in the marketplace they are referred to as
user-defined data types.
▪ A benefit of information hiding is increased reliability
and integrity of the object
The Enhanced Entity-Relationship (EER)
Model

▪ Enhanced ER (EER) model


– Created to design more accurate database schemas
▪ Reflect the data properties and constraints more
precisely
– More complex requirements than traditional applications
▪ It adds more semantic clarity to design
▪ Minimizes Null values
Subclasses and Superclasses

▪ EER model includes all modeling concepts of


the ER model
▪ In addition, EER includes:
– Subclasses and Superclasses
– Specialization and Generalization
– Category or union type
– Attribute and relationship inheritance
Subclasses and Superclasses

▪ An entity type may have additional meaningful subgroupings of its


entities
▪ Example: EMPLOYEE may be further grouped into SECRETARY,
ENGINEER, MANAGER, TECHNICIAN, SALARIED_EMPLOYEE,
HOURLY_EMPLOYEE,…
– Each of these groupings is a subset of EMPLOYEE entities
– Each is called a subclass of EMPLOYEE
– EMPLOYEE is the superclass for each of these subclasses

▪ These are called superclass/subclass relationships.


▪ Example: EMPLOYEE/SECRETARY, EMPLOYEE/TECHNICIAN
Subclasses and Superclasses Continued…

▪ These are also called IS-A relationships (SECRETARY IS-A


EMPLOYEE, TECHNICIAN IS-A EMPLOYEE, …).
▪ An entity that is member of a subclass represents the same
real-world entity as some member of the superclass
– The Subclass member is the same entity in a distinct specific role

– An entity cannot exist in the database merely by being a member of a subclass; it


must also be a member of the superclass

– A member of the superclass can be optionally included as a member of any


number of its subclasses
▪ Example: A salaried employee who is also an engineer belongs to the two
subclasses ENGINEER and SALARIED_EMPLOYEE
Attribute Inheritance in Superclass /
Subclass Relationships

▪ An entity that is member of a subclass inherits all attributes


of the entity as a member of the superclass
▪ It also inherits all relationships
Specialization (Top Down
design)
▪ Is the process of defining a set of subclasses of a superclass
▪ The set of subclasses is based upon some distinguishing characteristics of the
entities in the superclass
▪ Example: {SECRETARY, ENGINEER, TECHNICIAN} is a specialization of
EMPLOYEE based upon job type.
– May have several specializations of the same superclass
▪ Example: Another specialization of EMPLOYEE based in method of pay is
{SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}.
– Superclass/subclass relationships and specialization can be
diagrammatically represented in EER diagrams
– Attributes of a subclass are called specific attributes. For example,
TypingSpeed of SECRETARY
– The subclass can participate in specific relationship types. For example,
BELONGS_TO of HOURLY_EMPLOYEE
Example of a Specialization
Generalization (Bottom- up design)

▪ The reverse of the specialization process


▪ Several classes with common features are generalized into a
superclass; original classes become its subclasses
▪ Example: CAR, TRUCK generalized into VEHICLE; both CAR, TRUCK
become subclasses of the superclass VEHICLE.
– We can view {CAR, TRUCK} as a specialization of VEHICLE
– Alternatively, we can view VEHICLE as a generalization of CAR and TRUCK
Constraints on Specialization and
Generalization
▪ Two other conditions apply to a specialization/generalization:
▪ Dis-jointness Constraint:
– Specifies that the subclasses of the specialization must be disjointed (an entity can be
a member of at most one of the subclasses of the specialization)
– Specified by d in EER diagram
– If not disjointed, overlap; that is the same entity may be a member of more than one
subclass of the specialization
– Specified by o in EER diagram

▪ 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
Constraints on Specialization and
Generalization (3)

▪ Hence, we have four types of specialization/generalization:


– Disjoint, total
– Disjoint, partial
– Overlapping, total
– Overlapping, partial
▪ Note: Generalization usually is total because the superclass is derived from the
subclasses.
Example of disjoint partial
Specialization
overlapping(non disjoint) specialization.
Rules…
▪ Certain insertion and deletion rules apply to specialization (and
generalization) as a consequence of the constraints specified earlier. Some of
these rules are as follows:
▪ Deleting an entity from a superclass implies that it is automatically deleted
from all the subclasses to which it belongs.
▪ Inserting an entity in a superclass implies that the entity is mandatorily
inserted in all predicate-defined (or attribute-defined) subclasses for which
the entity satisfies the defining predicate.
▪ Inserting an entity in a superclass of a total specialization implies that the
entity is mandatorily inserted in at least one of the subclasses of the
specialization.
Specialization / Generalization
Hierarchies, Lattices and Shared Subclasses
▪ A subclass may itself have further subclasses
specified on it forms a hierarchy or a lattice
▪ Hierarchy has a constraint that every subclass
has only one superclass (called single
inheritance)
▪ In a lattice, a subclass can be subclass of more
than one superclass (called multiple
inheritance)
▪ In a lattice or hierarchy, a subclass inherits attributes not only of its direct
superclass, but also of all its predecessor superclasses
▪ A subclass with more than one superclass is called a shared subclass
▪ Can have specialization hierarchies or lattices, or generalization hierarchies or
lattices
▪ In specialization, start with an entity type and then define subclasses of the
entity type by successive specialization (top down conceptual refinement
process)
▪ In generalization, start with many entity types and generalize those that have
common properties (bottom up conceptual synthesis process)
▪ In practice, the combination of two processes is employed
Specialization / Generalization
Lattice Example (UNIVERSITY)
Categories (UNION TYPES)

▪ All of the superclass/subclass relationships we have seen thus far have


a single superclass

▪ A shared subclass is subclass in more than one distinct


superclass/subclass relationships, where each relationships has a single
superclass (multiple inheritance)

▪ Superclasses represent different entity types

▪ Such a subclass is called a category or UNION TYPE


▪ Example: Database for vehicle registration, vehicle owner can be a
person, a bank (holding a lien on a vehicle) or a company.
– Category (subclass) OWNER is a subset of the union of the three
superclasses COMPANY, BANK, and PERSON
– A category member must exist in at least one of its superclasses
▪ Note: The difference from shared subclass, which is subset of the
intersection of its superclasses (shared subclass member must exist
in all of its superclasses).
Example of categories
(UNION TYPES)
Important Questions
1. Define the following terms: entity, attribute, attribute value, relationship instance, composite
attribute, multivalued attribute, derived attribute, complex attribute, key attribute, and value set
(domain).
2. What is an entity type? What is an entity set? Explain the differences among an entity, an
entity type, and an entity set.
3. What is meant by a recursive relationship type? Give some examples of recursive relationship
types.
4. When is the concept of a weak entity used in data modelling?
5. What is a subclass? When is a subclass needed in data modelling?
6. Define the following terms: superclass of a subclass, superclass/subclass relationship, IS-A
relationship, specialization, generalization, category, specific (local) attributes, and specific
relationships.
7. Discuss the mechanism of attribute/relationship inheritance. Why is it useful?
8. Discuss the two main types of constraints on specializations and generalizations.
9. What is the difference between a specialization hierarchy and a specialization

You might also like