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

25
1 CSBP430 Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates University [email protected]

Upload: terence-norris

Post on 21-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

1

CSBP430 – Database Systems

Chapter 4: Enhanced Entity–Relationship and Object Modeling

Elarbi BadidiCollege of Information TechnologyUnited Arab Emirates [email protected]

Page 2: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

2

In these chapter, you will learn:

Subclasses, Superclasses, and Inheritance

Specialization and Generalization

Page 3: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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.

Page 4: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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.

Page 5: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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

Page 6: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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.

Page 7: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

7

Page 8: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

8

Page 9: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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.

Page 10: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

10

Page 11: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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.

Page 12: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

12

Page 13: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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.

Page 14: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

14

Page 15: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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.

Page 16: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

16

MULTIPLE INHERITANCE

EMPLOYEE

ENGINEERSECRETARY

ENGINEERING MANAGER

MANAGER

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

U

U

UU

U

Page 17: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

17

Utilizing Specialization and Generalization in Conceptual Data Modeling

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

Page 18: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

18

Page 19: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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

Page 20: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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

Page 21: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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)

Page 22: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

22

Example: Partial Categorization of Sponsor

Page 23: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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.

Page 24: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

24

Conceptual Object Modeling Using UML Class Diagrams

Component Diagram

Deployment Diagram

Structure Diagram

Class Diagram

Sequence DiagramUse Case Diagram

Page 25: 1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates

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