1 csbp430 – database systems chapter 4: enhanced entity– relationship and object modeling elarbi...

Post on 21-Jan-2016

217 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

CSBP430 – Database Systems

Chapter 4: Enhanced Entity–Relationship and Object Modeling

Elarbi BadidiCollege of Information TechnologyUnited Arab Emirates Universityebadidi@uaeu.ac.ae

2

In these chapter, you will learn:

Subclasses, Superclasses, and Inheritance

Specialization and Generalization

3

PROBLEM with ER notation (Chapter 4, pp. 73–89, 93-95)

Different databases have become commonplace (engineering manufacturing, multimedia, GIS, database for indexing the WWW, bioinformatics). We (DB designers) need to use additional semantic data modeling concepts to represent these requirements as accurately and clearly as possible.

THE ENTITY RELATIONSHIP MODEL IN ITS ORIGINAL FORM DID NOT SUPPORT THE GENERALIZATION ABSTRACTION.

4

Extended Entity-Relationship (EER) Model

Incorporates Set-subset relationshipsIncorporates Generalization Hierarchies

NEXT SECTION OF THIS Presentation ILLUSTRATES HOW THE ER MODEL CAN BE EXTENDED WITH

Set-subset relationships and Generalization Hierarchies and how we can impose further notation on them.

5

Entity Subclasses, Superclasses, and Inheritance

Superclass/subclass, class/subclass relationship

The relationship between a superclass and any one of its subclasses.

• Employee/secretary, employee/technical.

Entity that is a member of a subclass inherits all the attributes of the entity.Supertype has shared attributesSubtypes have unique attributes

6

Specialization and Generalization

Specialization is the process of defining a set of subclasses of an entity type.Define a set of subclasses of an entity type.

Based on job type: secretary, engineer, technician.Based on method of pay: salaried-employee, hourly-employee. Fig 4.1.

• Car and truck as a specialization of vehicle.

Establish additional specific attributes with each subclass.

Secretary subclass has an attribute TypingSpeed. Engineer subclass has an attribute EngineerType.

7

8

9

Specialization and Generalization

Generalization, reverse process in which defining a generalized entity type from the given entity types.

vehicle as a generalization of car and truck. Fig 4.3.

10

11

Constraints on Specialization/Generalization

Specialization may consists of multiple subclasses (circle notation) or a single subclass (no circle notation).Disjointness Constraint.

Entity must be a member of at most one of the subclasses. It uses (d) notation.

Overlap Constraint.Entity may be a member of more than one subclass. It uses (o) notation.

Total Specialization.Every entity in the superclass MUST be a member of some subclass. It uses double line notation.

Partial Specialization.Entity does not have to belong to any of the subclasses. Employee does not belong to secretary, engineer, technician.

12

13

Specialization/Generalization Hierarchies and Lattices

Specialization Hierarchy.A subclass participates as a subclass in only one class/subclass relationship.

Specialization Lattice.A subclass can be a subclass in more than one class/subclass relationship.

Leaf Node. Class that has no subclass of its own.

Shared Subclass.Subclass with more than one superclass (Fig 4.6).

Multiple InheritanceEntity inherits attributes and relationships from multiple classes.

14

15

MULTIPLE INHERITANCE

In a specialization hierarchy, every subclass has only one superclass.In a specialization lattice, a subclass can have more than one superclass.

The subclass is referred to as a shared subclass.A specialization lattice demonstrates multiple inheritance. A shared subclass must satisfy the multiple inheritance intersection constraint, where each instance of the shared subclass is an instance of all of its superclasses.

16

MULTIPLE INHERITANCE

EMPLOYEE

ENGINEERSECRETARY

ENGINEERING MANAGER

MANAGER

ENGINEERING MANAGER (shared subclass) is a MANGER and an ENGINEER

U

U

UU

U

17

Utilizing Specialization and Generalization in Conceptual Data Modeling

Top-down Conceptual Refinement Process (Fig 4.7) Bottom-up Conceptual Process.

18

19

Modeling of UNION Types Using Categories

Union Type/Category is a class which represent a collection of objects.

Single superclass/subclass relationship with more than one superclass, where the superclasses represent different entity types. Use (U) notation.

An owner of a vehicle can be a person, a bank, or a company (Fig 4.8).

20

Categories

PERSON BANK COMPANY

U

OWNER

The category, OWNER, is a subclass of the union of PERSON, BANK, and COMPANY. OWNER is either a PERSON or a BANK or a COMPANY

U

21

Constraints on categorization

Total categorization - Every instance of a superclass must be an instance of the category.

Partial categorization - An instance of a superclass is not required to be an instance of the category.

C = A B F (D E)

22

Example: Partial Categorization of Sponsor

23

Conceptual Object Modeling Using UML Class Diagrams

Universal/Unified Modeling Language (UML) is

usually used for software design.

UML has many diagrams (Class, Composite,

Deployment, State, Sequence, Activity,

Communication, Use Case, Package).

Class diagram is displayed as a box with three

sections: class name, attributes, operations.

Class diagram is similar to EER.

24

Conceptual Object Modeling Using UML Class Diagrams

Component Diagram

Deployment Diagram

Structure Diagram

Class Diagram

Sequence DiagramUse Case Diagram

25

Conceptual Object Modeling Using UML Class Diagrams (Fig 4.11)

EER UML

Entity Class

Week Entity Qualified association/Qualified

aggregation)

Composite attribute Structured domain

Multivalue attribute Separate class

Relationship Associations

(min, max) Multiplicities

top related