Jan. 20131 Advanced Data Modeling Subclasses Superclasses Specialization Attribute inheritance Generalization Discriminator Lattice Category EER-to-Relational.

Slides:



Advertisements
Similar presentations
Relational Database Design : ER- Mapping
Advertisements

Mapping ER to Relational Model
Jan. 2013Dr. Yangjun Chen1 Chapter 21 (2nd. Edition) Advanced Data Modeling Subclasses Superclasses Specialization Attribute inheritance Generalization.
1 Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – EER Model –21th June.
Enhanced Entity-Relationship and Object Modeling (Ch 4) Jan R McFadyen1 Class/subclass relationships Inheritance Specialization Generalization.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 4- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 7- 1.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 4- 1.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 4 Enhanced Entity-Relationship (EER) Modeling.
ER-to-Relational Mapping Jan. 2012ACS-3902 Yangjun Chen1 ER-to-Relational Mapping Principles Specialization/Generalization -Superclass/Subclass Relationship.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- and EER-to-Relational Mapping.
1 Enhanced Entity Relationship Modelling EER Model Concepts Includes all basic ER modeling concepts Additional concepts: subclasses/superclasses specialization/generalization.
Database Systems Chapter 7 ITM 354. Chapter Outline ER-to-Relational Schema Mapping Algorithm –Step 1: Mapping of Regular Entity Types –Step 2: Mapping.
December 4, 2002 Data Modeling – James Cohen Enhanced Entity Relationship (EER) Model Presented by James Cohen.
Chapter 4 The Enhanced Entity-Relationship (EER) Model
© Shamkant B. Navathe CC METU Department of Computer Eng Ceng 302 Introduction to DBMS Enhanced Entity-Relationship (EER) Model by Pinar Senkul resources:
Chapter 41 Enhanced Entity-Relationship and Object Modeling.
EXTENDED-ER (EER) MODEL CONCEPTS. Enhanced-ER (EER) Model Concepts  Basic ER diagram + more concepts =EER model  Additional concepts:  Subclasses/superclasses.
Specialization and generalization
Database Systems ER and EER to Relational Mapping Toqir Ahmad Rana Database Management Systems 1 Lecture 18.
Enhanced Entity-Relationship and UML Modeling. Enhanced-ER (EER) Model Concepts Includes all modeling concepts of basic ER Additional concepts: subclasses/superclasses,
ER- and EER-to-Relational Mapping
Relational Database Design by ER- and EER-to-Relational Mapping
Entities and Attributes
1 CSE 480: Database Systems Lecture 4: Enhanced Entity-Relationship Modeling Reference: Read Chapter 8.1 – 8.5 of the textbook.
© Shamkant B. Navathe CC. © Shamkant B. Navathe CC Chapter 4 - Part I Enhanced Entity-Relationship and UML Modeling Copyright © 2004 Ramez Elmasri and.
Database Systems: Enhanced Entity-Relationship Modeling Dr. Taysir Hassan Abdel Hamid.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Relational Database Design by ER to Relational Mapping by Pinar Senkul resources: mostly.
Mapping from conceptual model (EER-M)
Relational Database Design by ER- and EERR-to-Relational Mapping.
Enhanced Entity-Relationship (EER) Modeling. Slide 4- 2 Chapter Outline EER stands for Enhanced ER or Extended ER EER Model Concepts Includes all modeling.
DatabaseIM ISU1 Chapter 7 ER- and EER-to-Relational Mapping Fundamentals of Database Systems.
1 CSBP430 – Database Systems Chapter 4: Enhanced Entity– Relationship and Object Modeling Elarbi Badidi College of Information Technology United Arab Emirates.
Exam 1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 4- 1.
Slide 4-1 Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Revised by IB & SAM, Fasilkom UI, 2005 Exercise 1. a property or description.
© Shamkant B. Navathe CC Enhanced Entity-Relationship Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Topic 4 - Part I Enhanced Entity-Relationship and UML Modeling
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 9 Relational Database Design by ER- and EERR-to-Relational Mapping Slide 9- 1.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 1.
Introduction to Database Systems
Relational Database Design by ER- and EER-to-Relational Mapping
Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping.
Lecture 3 A short revision of ER and EER modelling See R. Elmasri, S.B. Navathe. Fundamentals of Database Systems (third edition) Addison-wesley. Chapter.
Enhanced Entity-Relationship and UML Modeling. 2.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1.
Chapter 4_part2: The Enhanced Entity-Relationship (EER) Model.
Database Systems 主講人 : 陳建源 日期 :99/10/19 研究室 : 法 Chapter 4 Enhanced Entity-Relationship and Object Modeling.
Relational Database Design by ER- and ERR-to-Relational Mapping
Enhanced Entity-Relationship (EER) Model
Enhanced Entity-Relationship and Object Modeling Objectives
The Enhanced Entity- Relationship (EER) Model
Session 2 Welcome: The sixth learning sequence
Enhanced Entity-Relationship (EER) Modeling
ER- and EER-to-Relational
9/5/2018.
11/15/2018.
Outline: Database Basics
Chapter 8: Mapping a Conceptual Design into a Logical Design
EER to Relational Mapping
Sampath Jayarathna Cal Poly Pomona
Relational Database Design by ER- and EERR-to-Relational Mapping
4/11/2019.
ENHANCED ENTITY-RELATIONSHIP (EER) MODEL
Enhanced Entity-Relationship (EER) Modeling
Relational Database Design by ER- and EER-to-Relational Mapping
Enhanced Entity-Relationship (EER) Modeling
7/19/2019.
Presentation transcript:

Jan Advanced Data Modeling Subclasses Superclasses Specialization Attribute inheritance Generalization Discriminator Lattice Category EER-to-Relational Mapping Aggregation Association Hierarchy Classification Instantiation Identification Constraints

Jan Specialization FStarting with Employee FConsider the Job Type and Method of payment attributes FWe can specialize to create: engineer employee technician secretarysalaried-emphourly-emp method_of payment job type Specialization is the process of defining a set of sub-entities of some entity type.

Jan FAllows us to define a set of subclasses of an entity -in other words, helps us focus on distinguishing characteristics FAssociate additional specific characteristics with each subclass -helps us define attributes of each subclass FEstablish other relationships for subclassesSpecialization

Jan Freverse process of defining subclasses  bottom up approach Fbring together common attributes from similar entity types, and suppress the differences (to form a superclass) Fexample: suppose we begin with Cars and Trucks price Car TruckGeneralization maxspeed #passengers tonnage #axles plateno id plateno id price Generalization is the opposite approach/process of determining a supertype based on certain entities having common characteristics.

Jan Fwe generalize to get Vehicle VehicleGeneralization CarTruck maxspeed #passengers tonnage #axles plateno id price

Jan FThe entity in the subclass (secretary, engineer, technician) is said to play a specialized role FThe is used when you have more than one subclass based on the same defining attribute (e.g., Job type) FThe class/subclass relationship is shown using:Specialization

Jan Fsimilar to a 1:1 relationship except that it is between instances of the same entity type FA 1:1 relationship is between two different entity types FExample: employee/secretary/technician/engineer employee secretary technician engineer EERD with Class/SubClass Relationship

Jan FA 1:1 relationship is between two different entity types –Example: a manages relationship between employee and department employee EERD with Class/SubClass Relationship department manages secretary technician engineer

Jan Fto determine when an entity will become a member of subclass: FPredicate-defined system automatically enforces the constraint e.g JobType = ‘Secretary’ usually defined by an attribute value, a discriminator FUser-defined users decide the subclass for each entity not automatically enforcedConstraints

Jan FDisjoint –an entity can be a member of at most one subclass of a specialization FNotation FOverlap –the same entity may belong to more than one subclass of a specialization FNotation d Disjointness Constraint o

Jan FTotal Specialization –each entity of a superclass belongs to some subclass of a specialization FNotation FPartial Specialization –every entity of a superclass need not belong to a subclass of a specialization FNotation Completeness Constraint

Jan d Employee SecretaryTechnicianEngineer Job Type sin bdate jobtype engtype tgrade typespd disjoint constraint superclass/subclass relationship defining attribute Putting concepts together partial constraint

Jan o Part manu_part purchased-part part# supplier batch# overlapping constraint class/subclass relationship description price mandate total constraint Putting concepts together

Jan FDeleting an entity from a superclass implies that it is automatically deleted from all subclasses it belongs to FInserting an entity into a superclass implies that it is automatically inserted into all predicate-defined subclasses for which it satisfies the condition (Ex: Job Type = ‘secretary’) FInserting an entity into a superclass of a total specialization implies that it is automatically inserted into some subclass Insertion, Deletion Rule

Jan FHierarchy –where a subclass participates in only one class/subclass relationshipHierarchy Person StudentFaculty UndergraduateGraduate Every subclass participates, as a subclass, in exactly one superclass/subclass relationship

Jan FLattice –where a subclass participates in more than one class/subclass relationshipLattice Employee EngineerSecretary Engineering Manager A subclass participates, as a subclass, in more than one superclass/subclass relationship Manager

Jan FAttribute Inheritance –A subclass inherits attributes not only from its direct superclass, but also from all its predecessor superclasses all the way to the root Attribute Inheritance Person StudentFaculty UndergraduateGraduate A Graduate has all the attributes of a Student and a Person.

Jan FShared SubClass –a subclass with more than one superclass –leads to the concept of multiple inheritance: engineering manager inherits attributes of engineer, manager, and salaried employee engineer manager salaried-emp engineering-manager Shared Subclass Rule: an engineering- manager must be an engineer, a manager, and a salaried-emp. Rule: an engineer might be an engineering manager, etc.

Jan  Models a single class/subclass with more than one super class of different entity types person bank company U ownerCategories Rule: an owner is either a person, a bank, or a company. Rule: a person might be an owner, etc. Note: owner is a category Note: set union symbol

Jan Attribute inheritance is selective for categoriesCategories Owner may be either a person, bank, or company Owner entity is called a category Each owner inherits the attributes of either person, bank or company depending on the superclass to which it belongs - selective inheritance A category has two or more superclasses that represent distinct entity types person bank company U owner Person, Bank, and Company might have different keys

Jan FA category can be either total or partial company account-holder U partial categoryCategories Rule: an account holder is either a person or a company. Rule: a person may, or may not, be an account owner Rule: a company may, or may not, be an account holder person

Jan FA category can be either total or partial building property U total categoryCategories Rule: a property is either a building or a lot Rule: a building is a property Rule: a lot is a property Is there a similar generalization? lot

Jan FReview 7-step algorithm in Section 9.1 EER to relational 1. Create a relation for each strong entity type include all simple attributes choose a primary key 2. Create a relation for each weak entity type include primary key of owner (a FK) PK becomes owner’s PK + partial key 3. For each binary 1:1 relationship choose an entity and include the other’s PK in it as a FK

Jan For each binary 1:n relationship, choose the n-side entity and include a FK wrt the other entity. 5. For each binary M:N relationship, create a relation for the relationship include PKs of both participating entities and any attributes of the relationship PK is the catenation of the participating entity PKs 6. For each multi-valued attribute create a new relation include the PK attributes of the entity type PK is the PK of the entity type and the multi-valued attribute

Jan FStep 8 Conversion of Subclass/Superclasses FOption A –Create a table for the Superclass –Create a separate table for each subclass with primary key of superclass 7. For each n-ary relationship, create a relation for the relationship include PKs of all participating entities and any attributes of the relationship PK may be the catenation of the participating entity PKs (depends on cardinalities)

Jan d Employee Secretary TechnicianEngineer Job Type ssn bdate jobtype engtype tgrade typespd EER to relational Employee (SSN,Fname,Minit,Lname,Bdate,Address,JobType) Secretary ( SSN, typing Speed) Technician (SSN, Tgrade) Engineer (SSN, Engtype) Option A Works for any kind of constraint: disjoint, overlapping, partial or total

Jan FOption B –Create tables for each subclass, but not for the superclass –Move all the attributes of the superclass and include them as attributes of each subclass EER to relational Vehicle Car Truck maxspeed #passengers tonnage#axles plateno id price Option B Works well only for disjoint and total constraints d Car ( VehicleID, LicensePlateNo, Price, MaxSpeed, NoOfpassengers) Truck (VehicleID, LicensePlateNo, Price, noofaxles, tonnage)

Jan FOption C –Create a single relation with attributes of all the subclasses with a single type attribute as a discriminator –Only for disjoint subclasses EER to relational FOption D –Create a single relation with attributes of all the subclasses and include one flag per subclass –Only for overlapping subclasses

Jan Option C Works well for disjoint constraints Potential for generating large number of nulls EER to relational Employee (SSN, bdate, Address, JobType, Typing Speed, Tgrade, EngType) Employee Secretary Technician Engineer Job Type sin bdate jobtype tgrade typespd engtype d

Jan Option D Works well for overlapping constraints Option 8C and 8D are not recommended if many specific attributes are defined for the subclasses EER to relational Part ( PartNo, Descr, Mflag, DrawingNo, ManDate, BatchNo, Pflag, SupName, ListPrice) o Part manu_part purchased-part part# supplier batch# description price mandate

Jan FMapping of Categories FSuperclasses with different key (partial category) Specify a new key called surrogate key for the category FSuperclasses with the same keys (total category) No need of a surrogate key EER to relational

Jan FCategories - Superclasses with different keys EER to relational Note the Foreign Keys Person (SSN, DrLicNo, Name, Address, Ownerid) Bank (Bname, BAddress, Ownerid) Company (CName, CAddress, Ownerid) Owner (Ownerid) person bank company U owner Surrogate key

Jan FCategories - Superclasses with the same keys EER to relational Note there are no Foreign Keys Registered Vehicle (VehicleID, LicensePlateNo,) Car (VehicleID, Cstyle, CMake, CModel,CYear) Truck (VehicleID, TMake, TModel,TYear, Tonnage) car truck registered vehicle U VehicleId LicensePlateNo Tonnage Cstyle...

Jan FClassification - Process of systematically assigning similar objects to object classes –from employee objects to Employee Class FInstantiation - Refers to the generation and specific examination of distinct objects of a class –employee objects of the Employee Class FKnowledge based systems (KR) – Classes can be an instance of another class (meta-classes) FEERD –Only super/subclass association is possible Classification and Instantiation Opposites of one another

Jan FAggregation - Concept of building composite objects from their components FEERD: Aggregating attributes into an entity FAssociation - Associate objects from several independent classes F EERD: relationships between different entities FAggregation vs Association FDelete an aggregate object involves deleting its components –Deleting an association does not involve deleting its participating objects Aggregation and Association

Jan Aggregation: manufacturer model color DriveTrain body engine transmission names headquarters divisions names function location HPpower CCsize CylinderN chassis interior door Vehicle Company Division VehicleDriverTrain PistonEngine VehicleBody String Numeric String Numeric

Jan Aside: UML Unified Modeling Language (1994+) Booch, Rumbaugh, Rational Software for modeling systems concepts learned here apply to UML vehicle color make person name address …... car no_doors... boat no_of_motors... {disjoint} * drives Note: there are many modeling notations: Chen, IE, IDEF1X,UML