Sunteți pe pagina 1din 7

CXB 3104 Advanced Database Systems

Learning Outcomes

Lecture 5 EERM

Limitations of the basic ER modeling Model information through the use of EER diagrams using UML EER data modeling concepts

Limitations of ER Modeling

Enhanced ER Modeling
Semantic concepts are incorporated into the original ER model and called the Enhanced Entity-Relationship (EER) model Most useful additional data modelling concept of Enhanced ER (EER) model is called specialisation/ generalisation using UML EER still incorporates much of the same designing concepts when modelling an organisations database system. Eg, Entities (class), relationships, attributes (characteristics), multiplicity, etc but with enhanced features to reflect true realworld semantics. It focuses on true normalisation rules!

Basic concepts of ER modelling are not sufficient to represent requirements of newer, more complex applications Response is development of additional semantic modelling concepts

Specialization/Generalization
Specialisation Process of maximising differences between members of an entity by identifying their distinguishing characteristics. This is a top-down approach of identifying lower-level entities. Generalisation Process of minimising differences between entities by identifying their common characteristics. This is a bottom-up approach of identifying higher-level entities.

Superclass and Subclass


Superclass An entity type that includes one or more distinct subgroupings of its occurrences. Eg, University Staff Subclass A distinct subgrouping of occurrences of an entity type. Eg, Clerk, Lecturer, Sr Lecturer, Administration Staff, Security Guard, etc

Associations with entities


Superclasses and subclasses and the process of attribute inheritance
5 6

Specialization Specialization 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

Generalization

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

Example: {SECRETARY, ENGINEER, TECHNICIAN} is a specialization of EMPLOYEE based upon job type.
May have several specializations of the same superclass
7

Generalization

Specialization/Generalization

10

Specialization/Generalization
An entity in a subclass represents the same real world object as in superclass eg, the entity in the subclass is the same entity in the superclass, but has distinct role(s) or attributes Superclass/subclass relationship is one-to-one (1:1) Superclass may contain overlapping or distinct subclasses (see previous slide)

CLIENT with Subtype Entities

Not all members of a superclass need be a member of a subclass. (see previous slide)

11

12

Subclasses and Superclasses

Attribute Inheritance
An entity in a subclass represents same real world object as in superclass, and may possess subclass-specific attributes, as well as those associated with the superclass. Subclass entities inherit all common attributes from the superclass, eg, name, address, salary, etc Use to avoid describing different types of staff with possibly different attributes within a single entity.

13

14

All staff relation/table holding details of staff

EER with shared subclass

15

16

When to use EER


Avoids describing similar concepts more than once, therefore saving designers time and making ERM more readable Adds more semantic (real-world) information to the design Communicates significant semantic content in a concise form

Constraints on Specialization/Generalization Participation constraint


Determines whether every member in superclass must participate as a member of a subclass. May be mandatory or optional.
(similar to using the I (mandatory) and O (optional) symbol in basic ER)

Disjoint constraint (only applies when superclass has


many subclasses)

Describes relationship between members of the subclasses and indicates whether member of a superclass can be a member of one, or more than one, subclass. May be disjoint {Or} or nondisjoint {And}.
17 18

Displaying an attribute-defined specialization in EER diagrams

19

20

Constraints on Specialization and Generalization

Constraints on Specialization and Generalization

Disjointness 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

Completeness Constraint:
Whether an instance of a supertype must also be a member of at least one subtype Total specialization rule yes (double line) Partial allows an entity not to belong to any of the subclasses Shown in EER diagrams by a single line

Specified by d in EER diagram If not disjoint, specialization is overlapping:


that is the same entity may be a member of more than one subclass of the specialization

Specified by o in EER diagram


21 22

Figure 4-6 Examples of completeness constraints a) Total specialization rule

Figure 4-6 Examples of completeness constraints (cont.) b) Partial specialization rule

A patient must be either an outpatient or a resident patient

A vehicle could be a car, a truck, or neither

23

24

Constraints on Specialization and Generalization

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.
25

S-ar putea să vă placă și