Title: ENHANCED ENTITY RELATIONSHIP EER MODELING
1ENHANCED ENTITY RELATIONSHIP (EER) MODELING
2- EER model attempts to include the concepts of
semantic data models in the ER model. - Such concepts include class/sub class
relationship, attribute inheritance,
specialization and generalization, category or
union type. - The resulting schema diagrams are called Enhanced
ER or EER diagrams.
3SUBCLASSES, SUPERCLASSES, AND INHERITANCE
- An entity type is used to represent a type of
entity and the entity set or collection of
entities of that type that exist in the database.
- The entity EMPLOYEE in the COMPANY database may
have some sub groupings, such as SECRETARY,
ENGINEER, MANAGER, TECHNICIAN, SALARIED_EMPLOYEE,
and HOURLY_EMPLOYEE. - The set of entities in each of these sub groups
is a subset of the EMPLOYEE entity set. - Every entity in any of these groupings belongs to
the EMPLOYEE entity.
4SUBCLASSES, SUPERCLASSES, AND INHERITANCE
- Each of these subgroupings is called a subclass
of the EMPLOYEE entity type - The EMPLOYEE entity is called the superclass for
each of these subclasses. - The relationship is called superclass/ subclass
relationship or class/ subclass relationship
5SUBCLASSES, SUPERCLASSES, AND INHERITANCE
- An Entity can not exist by just being a member of
the subclass. It must also be a member of the
superclass, but not all entities of the
superclass may belong to a subclass. - A member of the superclass can be optionally
included as a member of any number of its
subclasses. - An entity can be a member of more than one
subclass. - 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
6Type Inheritance
- An entity that is member of a subclass inherits
all attributes of the entity as a member of the
superclass. - It also inherits all the relationships in which
the superclass participates. - The subclass with its own (local) attributes and
relationships, together with the attributes and
relationships inherited from the superclass, can
be considered an entity type in its own rights
7SPECIALIZATION
- This 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.
8SPECIALIZATION
- It is possible to have several specializations of
the same entity type. Another specialization
could be SALARIED_EMPLOYEE, HOURLY_EMPLOYEE,
which is based on method of pay. - In EER diagrams, the subclasses that defines a
specialization are attached by lines to a circle
that represents the specialization, which is
connected to the superclass. - The subset symbol on each line connecting a
superclass to the circle indicates the direction
of the superclass/ subclass relationship.
9SPECIALIZATION
- Attributes that apply only to entities of a
particular subclass are called specific
attributes or local attributes. For example,
TypingSpeed of SECRETARY - The subclass can participate in specific
relationship types. For example, HOURLY_EMPLOYEE
subclass can participate in BELONGS_TO
relationship
10SPECIALIZATION
- Define a set of subclasses for 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(No Transcript)
12(No Transcript)
13GENERALIZATION
- process of defining a generalized entity type
from given entity types. - It is a reverse of the specialization process.
- The differences among several entity types are
suppressed, while identifying their common
features, to generalize them into a single
superclass of which the original entity types are
special subclasses. - Several classes with common features are
generalized into a superclass original classes
become its subclasses.
14GENERALIZATION
- Example CAR, TRUCK generalized into VEHICLE
- 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. - Also EMPLOYEE is a generalization of SECRETARY,
TECHNICIAN, and ENGINEER.
15(No Transcript)
16Data Modeling with Specialization and
Generalization
- A superclass or subclass represents a set of
entities - Shown in rectangles in EER diagrams (as are
entity types) - Sometimes, all entity sets are simply called
classes, whether they are entity types,
superclasses, or subclasses
17Constraints on Specialization and Generalization
- The following constraints may apply to
specialization - Defining predicate constraint
- Disjointness constraint
- Completeness constraint
18Defining Predicate Constraint
- In some specializations, it is possible to
determine the exact entities that will become
members of each subclass by imposing a condition
on the value of the attributes of the subclass. - Such subclasses are called predicate-defined (or
condition-defined) subclasses. - The predicate condition is defined as a
constraint on the subclass. For example, the
condition (JobTypeSecretary can be defined as
a constraint on the SECRETARY subclass in the
EMPLOYEE superclass. -
- A predicate-defined subclass is defined by
writing the predicate condition next to the line
attaching the subclass to its superclass .
19Defining Predicate Constraint
- If all subclasses in a specialization have
membership condition on same attribute of the
superclass, specialization is called an attribute
defined-specialization - The attribute is called the defining attribute of
the specialization. - The attribute defined specialization is displayed
by placing the defining attribute name next to
the arc from the circle to the superclass - Example JobType is the defining attribute of the
specialization SECRETARY, TECHNICIAN, ENGINEER
of EMPLOYEE - When there is no condition for determining
membership in a subclass, the membership is
specified individually for each entity by the
user. Such a subclass is said to be user defined
20EER diagram notation for an attribute defined
specialization on JobType
-
.
21Disjointness Constraint
- This constraint specifies that the subclasses of
the specialization must be disjoint - An entity can be a member of at most one of the
subclasses of the specialization. - The notation d is used to specify that user
defined subclass of a specialization must be
disjoint. - If the subclasses are not constrained to be
disjoint, then their set of entities may overlap,
that is, the same real world entity may be a
member of more than one subclass in the same
specialization. - The letter o is placed in the circle to indicate
that the subclasses can overlap and this is the
default.
22Completeness Constraint
- This constraint can either be total or partial.
-
- The total completeness constraint specifies that
every entity in the superclass must be a member
of at least, one specialization. - E.g. every EMPLOYEE must be HOURLY_EMPLOYEE or
SALARIED_EMPLOYEE - The specialization HOURLY_EMPLOYEE,
SALARIED_EMPLOYEE is a total specialization of
EMPLOYEE. - Double line is used to connect the superclass to
the circle.
23Completeness Constraint
- Partial completeness constraint allows an entity
in the superclass not to belong to any subclass. - E.g. if any of the EMPLOYEES does not belong to
any of the subclasses SECRETARY, TECHNICIAN,
ENGINEER, then that specialization is partial. - A single line is used to connect the superclass
to the circle in the EER diagram.
24(No Transcript)
25(No Transcript)
26Insertion and deletion rules that apply to
specialization and generalization
- Deleting an entity from a superclass implies that
it is automatically deleted from all the
subclasses to which it belongs. - Inserting an entity in the superclass implies
that the entity is automatically inserted in all
subclasses that are attribute defined (or
predicate defined), for which the entity
satisfies the defining predicate. - Inserting an entity in a total specialization
implies that the entity is automatically inserted
in at least one of the subclasses in the
specialization.
27Specialization and Generalization Hierarchies and
Lattices
- A subclass may itself have further subclasses
specified on it, thereby forming a hierarchy or
a lattice. - E.g. ENGINEER could be a subclass of EMPLOYEE,
and a superclass of ENGINEERING_MANAGER. - The real world constraint is that every
engineering manager must be an engineer.
28Specialization and Generalization Hierarchies and
Lattices
- Specialization Hierarchy has a constraint that
every subclass has only one superclass (called
single inheritance), thereby forming a tree
structure. - On the other hand, in a lattice, a subclass can
be subclass of more than one superclass (called
multiple inheritance)
29(No Transcript)
30(No Transcript)
31MODELING UNION TYPES USING CATEGORIES
- There may be the need to model a single
superclass/subclass relationship with more than
one superclass, where the superclasses represent
different entity types. -
- In this case, the subclass will represent a
collection of objects that is a subset of the
UNION of different entity types. - Such a subclass is called a category or UNION
TYPE
32MODELING UNION TYPES USING CATEGORIES
- 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 - The superclasses COMPANY, BANK, and PERSON are
connected to the circle with U symbol (U stands
for UNION operation). An arc, with the subset
symbol connects the circle to the subclass
(OWNER) category
33(No Transcript)
34MODELING UNION TYPES USING CATEGORIES
- A category can either be total or partial.
- Total category holds the union of all entities in
its superclasses - Partial category can hold a subset of the union.
- A total category is represented by a double line
connecting the category and the circle, whereas,
a partial category is represented using single
lines.
35CONSTRAINTS ON TERNARY (OR HIGHER DEGREE)
RELATIONSHIPS
- Two constraints are defined for the n-ary
relationships, based on earlier defined
notations. - The first constraint is based on the cardinality
ratio notation of binary relationships. - Here, 1, N, or M is specified on each
participating arc. - 1 specifies that a particular relationship
combination can only appear at most once in the
relationship set (e.g. for a project-part
combination, if only one supplier supplies part
to a particular project). - Both M and N stand for many and any number of
appearances in the relationship set.
36CONSTRAINTS ON TERNARY (OR HIGHER DEGREE)
RELATIONSHIPS
- The second constraint is based on the (min, max)
notation for binary relationships - This specifies that each entity participates in
at least min and at most max relationship
instances in the relationship set. - places restrictions on how many relationship
instances each entity can participate in.
37DATA ABSTRACTION CONCEPTS
- Classification and Instantiation
- Classification involves assigning similar
entities/objects to object classes/ entity types.
- Collections of objects share same types of
attributes, relationships and constraints. - For example, John Smith, Sheela Patel, and Peter
Wang are all employees. They are all members of a
class EMPLOYEE class.
38DATA ABSTRACTION CONCEPTS
- Classification and Instantiation
- Instantiation is the reverse of classification.
- It involves the generation of distinct objects of
a class. - An object instance is related to its object class
by the IS-AN-INSTANCE-OF or IS-A-MEMBER-OF
relationship. - An instance may itself, be another class,
allowing multiple level classification schemes.
39DATA ABSTRACTION CONCEPTS
- Classification and Instantiation
40DATA ABSTRACTION CONCEPTS
- Identification
- Identification is an abstract process that makes
objects and classes uniquely identifiable, by
means of an identifier. - The identifier identifies one concept (an
instance of it) from another concept.
Identification is needed at two levels - To distinguish among database objects and classes
- To identify database objects and to relate them
to their real world counterparts
41(No Transcript)
42DATA ABSTRACTION CONCEPTS
- Specialization and Generalization
- Specialization classifies a class of objects into
more specialized sub-classes. - Generalization on the other hand, is the inverse
process of generalizing several classes into a
higher level abstract class that includes all the
objects in all the sub-classes. - Generalization defines a set-subset relationship
between a class and a set of member classes. - Specialization establishes a mapping (or a
relationship) from the generic class to the
member class (or subclass, or subset class).
43GENERIC CLASS EMPLOYEEMEMBER CLASS Engineer,
Staff, ManagerThis implies that all properties
associated with the Employee class are inherited
by the three leaf classes.
Generalization establishes an IS-A relationship,
or IS-A-SUBCLASS-OF relationship(e.g. An Engineer
IS-A-SUBCLASS-OF Employee)
44DATA ABSTRACTION CONCEPTS
- Aggregation and Association
- Aggregation is the process of building composite
objects from their component objects. - It defines a new class from a set of classes
which are identified as components of the root
class.