1 / 32

EER Diagram

EER Diagram. Prepared BY : Sir Syed Sarmad Ali. Subclasses, Superclasses , Inheritance. • Entity types represent both kinds of entities and sets of entities of that kind that exist in the database (e.g. entity type EMPLOYEE)

ataret
Download Presentation

EER Diagram

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EER Diagram Prepared BY : Sir Syed Sarmad Ali

  2. Subclasses, Superclasses, Inheritance • • Entity types represent both kinds of entities and sets of entities of that kind that exist in the database (e.g. entity type EMPLOYEE) • • Often an entity type has different subgroups of its entities that need to be represented explicitly in the database because of their significance (e.g. SECRETARY, ENGINNER, MANAGER, TECHNICIAN …) • • The set of entities in each of these subgroups is a subset of the EMPLOYEE entity set (every entity that is a member of one of these subgroups is also an EMPLOYEE entity)

  3. • Each of these subgroups is called a subclass of the EMPLOYEE entity type • • The EMPLOYEE entity type is called the superclass of each of these subclasses • • The relationship between a superclass and any one of its subclasses is called a superclass/subclass or class/subclass or IS-A (IS-AN) relationship (e.g. EMPLOYEE/SECRETARY EMPLOYEE/MANAGER)

  4. Why we need EER modeling? • ER modeling concepts discussed Chapter 3 are sufficient for representing many database schemas for "traditional" database applications, • Design more accurate database schemas that reflect the data properties and constraints more precisely. • Databases for engineering design • Manufacturing • Telecommunications • Complex software systems • Geographic Information Systems (GIs) • More complex requirements • Led to the development of additional semantic data modeling concepts Database Management Systems

  5. Enhanced-ER (EER) 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 with additional semantics • It includes some object-oriented concepts, such as inheritance Database Management Systems

  6. Subclasses and Superclasses (1) • An entity type may have additional meaningful subgroupings of its entities • Example: EMPLOYEE may be further grouped into SECRETARY, ENGINEER, MANAGER, TECHNICIAN, SALARIED_EMPLOYEE, HOURLY_EMPLOYEE,… • Each of these groupings is a subset of EMPLOYEE entities • Each is called a subclass of EMPLOYEE • EMPLOYEE is the superclass for each of these subclasses • These are called superclass/subclass relationships. • Example: EMPLOYEE/SECRETARY, EMPLOYEE/TECHNICIAN Database Management Systems

  7. Subclasses and Superclasses (2) • These are also called IS-A relationships (SECRETARY IS-A EMPLOYEE, TECHNICIAN IS-A EMPLOYEE, …). • Note: An entity that is member of a subclass represents the same real-world entity as some member of the superclass • The Subclass member is the same entity in a distinct specific role • An entity cannot exist in the database merely by being a member of a subclass; it must also be a member of the superclass • A member of the superclass can be optionally included as a member of any number of its subclasses • Example: A salaried employee who is also an engineer belongs to the two subclasses ENGINEER and SALARIED_EMPLOYEE • It is not necessary that every entity in a superclass be a member of some subclass Database Management Systems

  8. Example Database Management Systems

  9. Attribute Inheritance in Superclass / Subclass Relationships • An entity that is member of a subclass inherits all attributes of the superclass • It also inherits all relationships of the superclass Database Management Systems

  10. Subclasses and Superclasses • An entity type may have subclasses of its entities • Example: EMPLOYEE may be grouped into: • SECRETARY, ENGINEER, TECHNICIAN, … • Based on the EMPLOYEE’s Job • MANAGER • EMPLOYEEs who are managers • SALARIED_EMPLOYEE, HOURLY_EMPLOYEE • Based on the EMPLOYEE’s method of pay • EMPLOYEE is the superclass for each of these subclasses

  11. Subclasses and Superclasses (2) • Also called IS-A relationships • SECRETARY IS-A EMPLOYEE, TECHNICIAN IS-A EMPLOYEE, …. • An entity cannot exist in the database merely by being a member of a subclass; it must also be a member of the superclass • A member of the superclass can be optionally included as a member of any number of its subclasses

  12. Generalization and Specialization • The process of refining one entity types into subclass types is called specialization. • A top-down process • The process identifying commonalities among different entity types and define their superclass type is called generalization. • A bottom-up process • In real world, a database modeling process is typically mixed.

  13. Example of Sub-class , Super-class

  14. Condition-Defined Subclasses • Specialization based on conditions of superclass attributes. • Example: High-Pay-Male and High-Paid-Female • Drawing EMPLOYEE d salary100000, Sex=M salary100000, Sex=F   High-Pay-Male High-Pay-Female

  15. Discussions • d: means disjoint, each employee can belong to at most one of the subclass. • We do not require total participation: an employee may not be in either class • A special case of condition-defined specialization is when the condition is based on the value of a single attribute • This type specializations is called attribute-defined.

  16. An Attribute-defined Specialization • Doubled line suggests total participation: an employee must be either a male or female. EMPLOYEE Sex d F M   Male-EMP Female-EMP

  17. 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: • SECRETARY inherit the attributes Name, SSN, …, from EMPLOYEE • SECRETARY can have additional attributes specific to secretaries (typing speed, …)

  18. Additional attributes in subclasses

  19. Overlapping Specialization • In an overlapping specialization, indicated by an circled o, an entity in the superclass can belong to more than one subclasses. DEPARTMENT o Has a location in NY Has a location in DC   Located-in-DC Located-in-NY

  20. Further Discussions • A specialization can have only one subclass • Example: High-Pay-EMP EMPLOYEE salary100000  High-Pay-EMP

  21. Summary • Four types of specializations • Total (double-lined), disjoint (d) • Partial (single-lined), disjoint (d) • Total (double-lined), overlapping (o) • Partial (single-lined), overlapping (o) • A subclass may have its own (additional) attributes • A superclass may have more than one specialization.

  22. Example of Overlapping Total Specialization

  23. Multiple Specializations

  24. User-Defined Specialization/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 by the user • Example: A HANDICAPPED subclass of EMPLOYEE

  25. Specialization/Generalization Hierarchies, Lattices & Shared Subclasses (1) • A subclass may itself have further subclasses specified on it • forms a hierarchy or a lattice • Hierarchy has a constraint that every subclass has only one superclass (called single inheritance); this is basically a tree structure • In a lattice, a subclass can be subclass of more than one superclass (called multiple inheritance)

  26. Shared Subclass “Engineering_Manager”

  27. Categories (UNION TYPES) • With specialization, all subclasses are of the same type of super-classes. • SECTARY, MANAGER, and HOURLY_EMPLOYEE are all EMPLOYEEs • In some cases, we need to super-classes to be of different entity types • Such a subclass is called a category or UNION TYPE • A category member must exist in at least one of its superclasses

  28. Union example

  29. Two categories (UNION types): OWNER, REGISTERED_VEHICLE

  30. Difference b/w union and shared subclasses • In EER diagrams union types (categories) are • denoted by placing the letter U inside the circle and • the subset symbol on the line connecting the • subclass with the circle • Differences between union types & shared subclasses • An entity of a shared subclass must exist in all superclasses • An entity of a union type must exist in only one superclass • Entities in shared subclasses inherit attributes of all superclasses • Entities in union types inherit attributes of only one superclass

  31. EER diagram notation to represent subclasses and specialization Database Management Systems

  32. Summary • Introduced the EER model concepts • Class/subclass relationships • Specialization and generalization • Inheritance • These augment the basic ER model concepts introduced in Chapter 3 • EER diagrams and alternative notations were presented

More Related