Sie sind auf Seite 1von 25

Enhanced Entity-

Relationship (EER)
Model
Class Presentations on Distributed Database System by Dr. Anand Singh Jalal
Enhanced Entity-Relationship (EER) Model

¨ The ER model concepts are sufficient for representing


many database schemas for traditional database
applications.
¨ However, designers of database applications have
tried to design more accurate database schemas that
reflect the data properties and constrains more
precisely
¨ In this section, we describe features that have been
proposed for semantic data models, and show how the
ER model can be enhanced to include these concepts.

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Enhanced Entity-Relationship (EER) Model

¨ Includes all modeling concepts of basic ER


¨ EER= E-R model + semantic data modeling concepts
¨ Additional concepts: subclasses/superclasses,
specialization/generalization, attribute inheritance
¨ The resulting model is called the Enhanced-ER or
Extended ER (EER) model
¨ It is used to model applications more completely and
accurately if needed
¨ It includes some object-oriented concepts, such as
inheritance

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Superclass/Subclass

¨ Subclasses
Ø Subgroupings of the entities of an entity type
Ø An entity type as a superclass of subclasses

Ø Examples
n EMPLOYEE {SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}
n PATIENT {OUTPATIENT, INPATIENT}
n STUDENT {FULL-TIME, PART-TIME}

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Superclass/Subclass
¨ “IS-A” relationship
Ø Members of a subclass must be members of the
superclass
§ A FULL-TIME STUDENT ISA STUDENT
Ø Not every entity in a superclass be a member of a
subclass
¨ Subclasses
§ Should have meaningful subgroupings
§ Should be related to database applications

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Entity Type Inheritance
¨ Type Inheritance among Classes
¨ Inherited Attributes
§ a subclass inherits the attributes of the superclass
§ HOURLY_EMPLOYEE (Name, SSN, Address)
¨ Local (Specific) Attributes
§ a subclass may have its own attributes
§ HOURLY_EMPLOYEE (Hourly_rate)
§ SALARIED_EMPLOYEE (Annual_salary)

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


EER: Example

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Specialization and Generalization
¨ Specialization
§ Process of defining subclasses of a superclass
§ Defined on the basis of some distinguishing characteristics of
the entities in the superclass.
§ A (super)class a set of subclasses
n Method of pay {SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}
n Job type {SECRETARY, ENGINEER, TECHICIAN}
• Why specialization
n Attributes applied to some but not all entities
n Only members of the subclass participate in a specific relationship
type

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Specialization and Generalization

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Specialization and Generalization
¨ Generalization
• Process of defining generalized entity type from giving
entity types by identifying common features (attributes)
• A set of (sub)classes a generalized superclass
• Reverse process of abstraction
• {CAR, TRUCK} VEHICLE

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Specialization and Generalization

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Constraints for Specialization and Generalization

¨ Attribute-defined specialization
Ø This constraint specifies that members of a subclass
must satisfy the predicate and that all entities of
the superclass entity type whose attribute value
satisfy the predicate condition must belong to the
particular subclass.
§ Based on values of a superclass attribute (defining
attribute)
§ All subclasses have their member condition on the same
attribute of the superclass
§ Predicate-defined (condition defined) subclass
§ JobType = ‘Engineer’ => defining predicate

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Constraints for Specialization and Generalization

Defining
attribute

Predicate condition

Predicate-defined
subclass

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Disjointness constraints

¨ Disjointness Constraints: Whether an instance of a


supertype may simultaneously be a member of two
(or more) subtypes
¤ Disjoint
Rule: An instance of the supertype can be only
ONE of the subtypes
¤ Overlap Rule: An instance of the supertype could be
more than one of the subtypes

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Disjointness constraints (cont’)

A part may be both


purchased and
manufactured

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Completeness Constraints

¨ Completeness Constraints: Whether an instance of a


supertype must also be a member of at least one
subtype
¨ Partial
§ An entity in a superclass may not belong to any of the
subclasses
§ {SECRETARY, ENGINEER, TECHNICIAN}
¨ Total
§ every entity in a superclass must belong to at least one of
the subclasses
§ {SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Completeness Constraints

Partial
total

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


EER Diagram: Example

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Aggregation

¨ One limitation of the E-R model is that it is not


possible to express relationships among
relationships.
¨ Aggregation is an abstraction through which
relations are treated as higher-level entities.
¨ We use aggregation technique to express
relationship among relationships.
¨ Aggregation allows us to treat a relationship set as
an entity set for purposes of participation in
(other) relationships.

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Aggregation
¨ Example- Consider a database which gives information about authors
who write books on different subjects, each book has title and
publisher’s name on it. There two relationship set:
¤ Belong_to
¤ Written_by

Belongs
BOOK SUBJECT
to

Written

by

E-R diagram with


AUTHOR redundant relationships
Class Presentations on Distributed Database System by Dr. Anand Singh Jalal
Aggregation

Belongs
BOOK SUBJECT
to

Written
by

AUTHOR

E-R diagram with aggregation

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Summary of Conceptual Design
¨ Conceptual design follows requirements analysis,
¤ Yields a high-level description of data to be stored
¨ ER model is popular for conceptual design
¤ Constructs are expressive, close to the way people think
about their applications.
¨ Basic constructs: entities, relationships, and attributes
(of entities and relationships).
¨ Some additional constructs: ISA hierarchies, and
Aggregation.

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Summary of Conceptual Design …

¨ Several kinds of integrity constraints can be


expressed in the ER model: key constraints,
participation constraints, and overlap/covering
constraints for ISA hierarchies. Some foreign key
constraints are also implicit in the definition of a
relationship set.

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Summary of Conceptual Design …

¨ ER design is subjective. There are often many ways


to model a given scenario! Analyzing alternatives
can be tricky, especially for a large enterprise.

¨ Ensuring good database design: resulting relational


schema should be analyzed and refined further. FD
information and normalization techniques are
especially useful.

Class Presentations on Distributed Database System by Dr. Anand Singh Jalal


Any Questions ?
Class Presentations on Distributed Database System by Dr. Anand Singh Jalal

Das könnte Ihnen auch gefallen