Database Systems - Lec 3: EER Model - Nguyen Thanh Tung

§Limitations of Basic Concepts of the ER Model

§Enhanced-ER (EER) Model Concepts

§Subclasses and Superclasses

§Specialization and Generalization

§Specialization / Generalization Hierarchies, Lattices and Shared Subclasses

§Categories

§Formal Definitions of EER Model

§Database Design Modeling Tools

§Reading:

•[1]: Chapter 4, [2]: Chapter 12

ppt 36 trang xuanthi 02/01/2023 920
Bạn đang xem 20 trang mẫu của tài liệu "Database Systems - Lec 3: EER Model - Nguyen Thanh Tung", để tải tài liệu gốc về máy hãy click vào nút Download ở trên.

File đính kèm:

  • pptdatabase_systems_lec03_eer_model_nguyen_thanh_tung.ppt

Nội dung text: Database Systems - Lec 3: EER Model - Nguyen Thanh Tung

  1. Outline ▪ Limitations of Basic Concepts of the ER Model ▪ Enhanced-ER (EER) Model Concepts ▪ Subclasses and Superclasses ▪ Specialization and Generalization ▪ Specialization / Generalization Hierarchies, Lattices and Shared Subclasses ▪ Categories ▪ Formal Definitions of EER Model ▪ Database Design Modeling Tools ▪ Reading: • [1]: Chapter 4, [2]: Chapter 12 2
  2. Enhanced-ER Model Concepts ▪ Includes all modeling concepts of basic ER ▪ Additional concepts: subclasses/superclasses, specialization/generalization, categories, attribute inheritance ▪ The resulting model is called the Enhanced-ER or Extended ER (E2R or EER) model ▪ It is used to model applications more completely and accurately if needed ▪ It includes some object-oriented concepts, such as inheritance 4
  3. EER diagram notation to represent subclasses & specialization 6
  4. Inheritance in Superclass/Subclass Relationships ▪ An entity that is a member of a subclass inherits all attributes of the entity as a member of the superclass ▪ It also inherits all relationships 8
  5. Example of a Specialization 10
  6. Generalization ▪ The reverse of the specialization process ▪ 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 12
  7. Specialization and Generalization ▪ Diagrammatic notation sometimes used to distinguish between generalization and specialization • Arrow pointing to the generalized superclass represents a generalization • Arrows pointing to the specialized subclasses represent a specialization • We do not use this notation because it is often subjective as to which process is more appropriate for a particular situation • We advocate not drawing any arrows in these situations ▪ Data Modeling with Specialization and Generalization • A superclass or subclass represents a set of entities • Shown in rectangles in EER diagrams (as are entity types) • Sometimes, all entity sets are simply called classes, whether they are entity types, superclasses, or subclasses 14
  8. Constraints on Specialization and Generalization ▪ If all subclasses in a specialization have membership condition on same attribute of the superclass, specialization is called an attribute defined-specialization • Attribute is called the defining attribute of the specialization • Example: JobType is the defining attribute of the specialization {SECRETARY, TECHNICIAN, ENGINEER} of EMPLOYEE 16
  9. Constraints on Specialization and Generalization ▪ If no condition determines membership, the subclass is called user-defined • Membership in a subclass is determined by the database users by applying an operation to add an entity to the subclass • Membership in the subclass is specified individually for each entity in the superclass by the user 18
  10. Constraints on Specialization and Generalization ▪ Completeness Constraint: • Total specifies that every entity in the superclass must be a member of some subclass in the specialization/ generalization: Shown in EER diagrams by a double line • Partial allows an entity not to belong to any of the subclasses: Shown in EER diagrams by a single line 20
  11. Example of Overlapping Total Specialization 22
  12. Specialization / Generalization Hierarchies, Lattices and Shared Subclasses ▪ A subclass may itself have further subclasses specified on it, forming a hierarchy or a lattice ▪ Hierarchy has a constraint that every subclass has only one superclass (called single inheritance) ▪ In a lattice, a subclass can be subclass of more than one superclass (called multiple inheritance) ▪ In a lattice or hierarchy, a subclass inherits attributes not only of its direct superclass, but also of all its predecessor superclasses ▪ A subclass with more than one superclass is called a shared subclass ▪ Can have specialization hierarchies or lattices, or generalization hierarchies or lattices 24
  13. Categories ▪ All of the superclass/subclass relationships we have seen thus far have a single superclass ▪ A shared subclass is subclass in more than one distinct superclass/subclass relationships, where each relationships has a single superclass (multiple inheritance) ▪ In some cases, need to model a single superclass/subclass relationship with more than one superclass ▪ Superclasses represent different entity types ▪ Such a subclass is called a category or UNION TYPE 26
  14. Two categories (union types): OWNER and REGISTERED_VEHICLE 28
  15. Formal Definitions of EER Model ▪ Specialization Z: Z = {S1, S2, , Sn} is a set of subclasses with same superclass G; hence, G/Si is a superclass/subclass relationship for i = 1, , n • G is called a generalization of the subclasses {S1, S2, , Sn} • Z is total if we always have: →S1 ∪ S2 ∪ ∪ Sn = G; →Otherwise, Z is partial • Z is disjoint if we always have: →Si ∩ Sj empty-set for i ≠ j; →Otherwise, Z is overlapping 30
  16. Formal Definitions of EER Model ▪ Category or UNION type T • A class that is a subset of the union of n defining superclasses D1, D2, Dn, n>1: →T ⊆ (D1 ∪ D2 ∪ ∪ Dn) • Can have a predicate pi on the attributes of Di to specify entities of Di that are members of T. • If a predicate is specified on every Di: T = (D1[p1] ∪ D2[p2] ∪ ∪ Dn[pn]) 32
  17. Database Design Modeling Tools COMPANY TOOL FUNCTIONALITY Embarcadero ER Studio Database Modeling in ER and IDEF1X Technologies DB Artisan Database administration and space and security management Oracle Developer 2000 and Database modeling, application development Designer 2000 Popkin Software System Architect 2001 Data modeling, object modeling, process modeling, structured analysis/design Platinum Technology Platinum Enterprice Data, process, and business component modeling (Computer Modeling Suite: Erwin, Associates) BPWin, Paradigm Plus Persistence Inc. Pwertier Mapping from O-O to relational model Rational (IBM) Rational Rose Modeling in UML and application generation in C++ and JAVA Rogue Ware RW Metro Mapping from O-O to relational model Resolution Ltd. Xcase Conceptual modeling up to code maintenance Sybase Enterprise Application Data modeling, business logic modeling Suite Visio (Microsoft) Visio Enterprise Data modeling, design and reengineering Visual Basic and Visual C++ 34
  18. Q&A 36