CS340 · Annotated SlidesChapter 3 — The Enhanced ER (EER) Model
Chapter 3 · Annotated slides

The Enhanced ER (EER) Model

Subclasses and superclasses, attribute inheritance, specialization and generalization, attribute-defined specialization, disjoint vs. overlapping and total vs. partial constraints, hierarchies and lattices, categories (union types) and aggregation.

Slide text Study notes Highlight: key words Tips, tricks & traps Seen again elsewhere How it can come up

The Enhanced Entity–Relationship (EER) Model

CS340 · Chapter 3
1

LEARNING GOALS

CLO2: Develop conceptual modeling concepts and notations using Entity-Relationship or UML diagrams to analyze and design complex database applications. (Cognitive Skill) Chapter objectives:

Define 3 new concepts:

Sub-classes/Super-classes

Specialization/Generalization

Categories (UNION types)

2
Exam weight Low

    DATABASES SO FAR

    We learned that databases are useful but need to be carefully designed.

    We learned how to design conceptual models using Entity Relationship diagrams We will extend ER diagrams to support some new features.

    3
    Exam weight Low

      TOPICS DISCUSSED IN CHAPTER 3

      ER Model Concepts

      Entities and Attributes

      Entity Types 

      Strong Entity

      Weak Entity Types

      Various Types of Attributes 

      Simple, Composite, Multi-valued, Derived, Key Attributes

      Relationships and Relationship Types

      Constraints on relationships

      Roles and Attributes in Relationship Types

      4
      Exam weight Low

        EER

        W H Y E N H A N C E D E R M O D E L ?

        The traditional ER Model concepts were difficult to use for database modelling of complex data. Hence some improvements or enhancements were made to the existing ER Model to make it able to handle the complex applications better.

        EER is a high-level data model that incorporates the extensions to the original ER model.

        5
        Exam weight Low
          Slide 6: CHAPTER OUTLINE
          Exam weight Low

            SUB CLASSES AND SUPER CLASSES

            An entity type may have additional meaningful subgroupings of its entities meaningful to the organization  Example: EMPLOYEE may be further grouped into:

             SECRETARY, ENGINEER, TECHNICIAN, ...

             Based on the EMPLOYEE’s Job

             MANAGER

             EMPLOYEEs who are managers (the role they play)

             SALARIED_EMPLOYEE, HOURLY_EMPLOYEE

             Based on the EMPLOYEE’s method of pay

            EER diagrams extend ER diagrams to represent these additional subgroupings, called subclasses or subtypes

            7
            Exam weight Low
            1. A subclass is a subset of a superclass (SECRETARY ⊂ EMPLOYEE): IS-A relationship.
            Slide 8: SUB CLASSES AND SUPER CLASSES
            Exam weight Low
              Slide 9: SUB CLASSES AND SUPER CLASSES
              Exam weight Low
                Slide 10: SUB CLASSES AND SUPER CLASSES
                Exam weight Low
                  Slide 11: SUB CLASSES AND SUPER CLASSES
                  Exam weight Low

                    SUB CLASSES AND SUPER CLASSES

                    A member of the superclass can be optionally included as a member of any number of its subclasses Examples:

                    A salaried employee who is also an engineer belongs to the two subclasses:

                     ENGINEER, and  SALARIED_EMPLOYEE

                    A salaried employee who is also an engineering manager belongs to the three subclasses:

                     MANAGER,  ENGINEER, and  SALARIED_EMPLOYEE

                    12
                    Exam weight Low
                      Slide 13: BASIC NOTATION
                      Exam weight Low

                        ATTRIBUTE INHERITANCE IN SUPERCLASS / SUBCLASS RELATIONSHIPS

                        An entity that is member of a subclass inherits:

                        All attributes of the entity as a member of the superclass

                        All relationships of the entity as a member of the superclass

                        Example:

                        In the previous slide, SECRETARY (as well as TECHNICIAN and ENGINEER) inherit the attributes Name, SSN, ..., from EMPLOYEE

                        Every SECRETARY entity will have values for the inherited attributes

                        14
                        Exam weight Low
                        1. A subclass inherits all attributes and relationships of its superclass, and can add its own.

                        WHEN IS IT NECESSARY TO INCLUDING SUPERCLASS/SUBCLASS RELATIONSHIP?

                        There are two reasons for including superclass/subclass relationship in data model:

                        Certain attributes may apply to some but not to all entities of the superclass. Thus, a subclass is defined to group the entities to which these attributes apply.

                        Some relationship types can only allow certain sub-types to participate.

                        15
                        Exam weight Low
                          Slide 16: SPECIALIZATION
                          Exam weight Low
                          1. Specialization: top-down, define subclasses of a superclass by distinguishing characteristics.
                          Slide 17: GENERALIZATION
                          Exam weight High
                          1. Generalization: bottom-up, find a common superclass for existing entity types (CAR, TRUCK → VEHICLE).
                          🎯 How this can come up · 1 question
                          MCQ

                          Combining CAR and TRUCK into a VEHICLE superclass is:

                          GENERALIZATION

                          Generalization is 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

                          18
                          Exam weight Low
                            Slide 19: GENERALIZATION
                            Exam weight Low

                              ATTRIBUTE-DEFINED SPECIALIZATION IN EER DIAGRAMS

                              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 or Discriminator.

                              Example: Job Type is the defining attribute of the specialization

                              {SECRETARY,

                              TECHNICIAN,

                              ENGINEER} of EMPLOYEE

                              20
                              Exam weight Low
                              1. Attribute-defined (predicate-defined) specialization: membership decided by an attribute value (JobType).
                              Slide 21: DISPLAYING AN ATTRIBUTE- DEFINED SPECIALIZATION IN EER DIAGRAMS
                              Exam weight Low
                                Slide 22: CONSTRAINTS ON SPECIALIZATION AND GENERALIZATION
                                Exam weight High
                                1. Disjointness: d = disjoint (at most one subclass), o = overlapping (may be in several). Completeness: total (double line, must be in one) or partial.
                                Memory trickTwo independent questions: "can it be in two?" (d/o) and "must it be in one?" (total/partial).
                                🎯 How this can come up · 1 question
                                MCQ

                                A person can be both a STUDENT and an EMPLOYEE, and some people are neither. The specialization is:

                                Slide 23: CONSTRAINTS ON SPECIALIZATION AND GENERALIZATION
                                Exam weight Low

                                  it

                                  CONSTRAINTS ON SPECIALIZATION AND GENERALIZATION (3) Completeness (Exhaustiveness) Constraint:

                                  Total

                                  specifies that every entity in the superclass must be a

                                  member of some subclass in the specialization/generalization

                                  The same as total participation constraint in ER

                                  double line

                                  Shown in EER diagrams by a

                                  Partial allows an entity not to belong to any of the subclasses

                                  Shown in EER diagrams by a single line

                                  24
                                  Exam weight Low
                                    Slide 25: CONSTRAINTS ON SPECIALIZATION & GENERALIZATION
                                    Exam weight Low

                                      EXAMPLE OF DISJOINT & TOTAL PARTICIPATION

                                      TOTAL PARTICIPATION

                                      26
                                      Exam weight Low
                                        Slide 27: EXAMPLE OF DISJOINT & PARTIAL PARTICIPATION
                                        Exam weight Low
                                          Slide 28: EXAMPLE OF OVERLAPPING & TOTAL PARTICIPATION
                                          Exam weight Low

                                            EXAMPLE OF OVERLAPPING & PARTIAL PARTICIPATION

                                            P A R T I A L P A R T I C I P A T I O N

                                            29
                                            Exam weight Low
                                              Slide 30: CONSTRAINTS ON SPECIALIZATION & GENERALIZATION
                                              Exam weight Low
                                                Slide 31: ANOTHER EXAMPLE OF DISJOINT & OVERLAPPING
                                                Exam weight Low
                                                  Slide 32: HIERARCHIES, LATTICES, & SHARED SUB-CLASSES
                                                  Exam weight High
                                                  1. Hierarchy: each subclass has one superclass. Lattice: a shared subclass has several superclasses (multiple inheritance).
                                                  🎯 How this can come up · 1 question
                                                  MCQ

                                                  A STUDENT_ASSISTANT that is both an EMPLOYEE and a STUDENT is a:

                                                  Slide 33: HIERARCHIES, LATTICES & SHARED SUB-CLASSES
                                                  Exam weight Low

                                                    LATTICE EXAMPLE (UNIVERSITY)

                                                    The requirements for this UNIVERSITY database are the following:

                                                    1. The database keeps track of three types of persons: employees, alumni, and students. A person can belong to one, two, or all three of these types. Each person has a name, SSN, sex, address, and birth date.
                                                    2. Every employee has a salary, and there are three types of employees: faculty, staff, and student assistants. Each employee belongs to exactly one of these types. For each alumnus, a record of the degree or degrees that he or she earned at the university is kept, including the name of the degree, the year granted, and the major department. Each student has a major
                                                    34
                                                    Exam weight Low

                                                      LATTICE EXAMPLE (UNIVERSITY)

                                                      The requirements for this UNIVERSITY database are the following:

                                                      1. Each faculty has a rank, whereas each staff member has a staff position. Student assistants are classified further as either research assistants or teaching assistants, and the percent of time that they work is recorded in the database. Research assistants have their research project stored, whereas teaching assistants have the current course they work on.
                                                      2. Students are further classified as either graduate or undergraduate, with the specific attributes degree program (M.S., Ph.D.,

                                                      M.B.A., and so on) for graduate students and class (freshman, sophomore, and so

                                                      35
                                                      Exam weight Low
                                                        Slide 36: CATEGORIES (UNION TYPES)
                                                        Exam weight High
                                                        1. Category (union type): a subclass of the UNION of different superclasses (OWNER is a PERSON or BANK or COMPANY). Inherits from only the one it belongs to.
                                                        Exam trapShared subclass = in ALL its superclasses (intersection). Category = in ONE of them (union).
                                                        Slide 37: CATEGORIES (UNION TYPES)
                                                        Exam weight Low
                                                          Slide 38: CATEGORIES (OWNER, AND REGISTERED_VE HICLE)
                                                          Exam weight Low
                                                            Slide 39: CATEGORIES (OWNER, AND REGISTERED_VE HICLE)
                                                            Exam weight Low
                                                              Slide 40: CATEGORIES INHERITANCE
                                                              Exam weight Low

                                                                CATEGORIES (UNION TYPES)

                                                                The super-classes of a category may have different key attributes, as demonstrated by the OWNER category, or they may have the same key attribute, as demonstrated by the REGISTERED_VEHICLE category.

                                                                Notice that if a category is total (not partial), it may be represented alternatively as a total specialization (or a total generalization). In this case, the choice of which representation to use is subjective.

                                                                e

                                                                If the two classes represent the same type of entities and share numerous attributes, including the same key attributes, specialization/generalization is preferred; otherwise, categorization (union type) is more appropriate.

                                                                41
                                                                Exam weight Low

                                                                  ACTIVITY

                                                                  Consider a University Database System used at PSU, which stores information about the:

                                                                   Student Club identified by ClubName, President, and NumofMembers.

                                                                   Sports team identified by the TeamName, Coach, and the SportsName.

                                                                   Department identified by the DeptName and OfficeNum.

                                                                   A Sponsor of an event is identified by SponsorID. A sponsor may be a team, a department, or a

                                                                  club. Each sponsor entity instance is a member of one of these superclasses, so Sponsor is a subclass of Team, Dept, Club. Not every Club, Team, or Dept must be a sponsor.

                                                                   A sponsor holds one or many CampusWide Events. However, an event must be organized by one

                                                                  sponsor. CampusWide Events are identified by EventName, Date and time. CampusWideEvents can be of two types: Concerts and Fair. A Concert has a performer, and a Fair can also be described by Theme and Charity.

                                                                  Draw an ER Diagram for the above scenario, showing cardinality and participation for all

                                                                  42
                                                                  Exam weight Low
                                                                    Slide 43: SOLUTION
                                                                    Exam weight Low
                                                                      Slide 44: AGGREGATIO N (BRIEFLY)
                                                                      Exam weight Low
                                                                      1. Aggregation: treat a relationship as a higher-level entity so it can join other relationships.

                                                                      SUMMARY OF EER CONCEPTS

                                                                       Super-classes and sub-classes (Generalization and specialization)  Categories or Union types  Aggregation All of these concepts improve the expressive power of ER diagrams and enable us to design very complex database applications.

                                                                      Next, we will see how to create logical designs and dive into the relational model.

                                                                      45
                                                                      Exam weight Low

                                                                        PROJECT FIRST STEPS

                                                                        1. Form a team of 3 or 4
                                                                        2. Find a relational database management system that you want to use and start preparing by:
                                                                        3. Installing the DBMS somewhere.
                                                                        4. Making sure the installation is working.
                                                                        5. Letting me know which system you will be using.
                                                                        6. Make a team decision on the technology you will use.
                                                                        7. Start thinking about the data and domain you will explore. I can provide some ideas if you need.
                                                                        46
                                                                        Exam weight Low