DBMS - Enhanced ER (EER) Model



The ER model is used to visually represent the process of designing a database. There are several components in an ER diagram. We can extend this ER model to some extent to make them more versatile.

The Enhanced Entity-Relationship (EER) model extends the basic ER model, by adding advanced concepts to represent more complex data structures. This improvement is particularly valuable for modeling databases in fields that demand greater precision. For example engineering, telecommunications, and geographic information systems.

In this chapter, we will have a look at the main elements of the EER model. In addition, we will touch upon the basics of subclasses, superclasses, inheritance, and specialization. We will cover them in greater detail in the subsequent chapters of this tutorial.

Basics of the Enhanced ER Model

The ER model offers foundational tools for creating database schemas. This is useful in many business and industrial applications. But, as database applications evolved, so did the need for more sophisticated modelling tools. That could be represented through complex relationships and data constraints with higher accuracy. The EER model can meet these needs by adding new features such as subclasses, superclasses, inheritance, and union types.

Subclasses and Superclasses

The EER Model uses concepts such as subclasses and superclasses which are normally used in OOPs programming. A superclass represents a general entity type, while a subclass is a more specific grouping of that entity.

For instance, consider the EMPLOYEE entity type. Within a company, the EMPLOYEE category could include distinct groups such as SECRETARY, ENGINEER, TECHNICIAN, and MANAGER. Now each of these subgroups forms a subclass of EMPLOYEE.

Example Diagram − The EER diagram uses a circle to connect subclasses and their superclass. Lines link these entities, illustrating the relationship. In this case, EMPLOYEE is the superclass, while SECRETARY, ENGINEER, and TECHNICIAN are subclasses.

Subclasses and Superclasses

Here, the relationship between a superclass and its subclasses is often described as an "IS-A" relationship. This type of relationship means that any instance of a subclass is inherently also an instance of the superclass. Like a SECRETARY entity is also an EMPLOYEE entity in the database. This relationship indicates that a subclass can access all attributes and relationships defined in its superclass.

Inheritance of Attributes and Relationships

Inheritance is a popular feature from OOPs programming that allows the entities in a subclass to inherit attributes and relationships from their superclass. For instance, the EMPLOYEE entity type could have common attributes called Name, Ssn, and Address. The SECRETARY subclass may inherit these attributes while adding its own, such as Typing_speed.

Inheritance applies to relationships as well. If the EMPLOYEE entity participates in a PROJECT relationship, the SECRETARY subclass will inherit this participation, ensuring a consistent data structure.

Specialization and Generalization in EER Model

Specialization and generalization are two related processes in the EER model that refine how entities are categorized.

Specialization in EER Model

Specialization shows how to define subsets of an entity type based on distinct attributes or characteristics. In our example, we could create subclasses of EMPLOYEE like HOURLY_EMPLOYEE and SALARIED_EMPLOYEE based on the payment method. This can be done with Pay_scale attribute used for relevant subclass.

So, the subclasses created through specialization may have specific attributes and relationships that do not apply to the superclass.

Generalization in EER Model

Generalization is the opposite of specialization. It combines similar entity types into a broader superclass by identifying shared characteristics. For example, entity types CAR and TRUCK with attributes like License_plate_no and Price could be generalized into a superclass called VEHICLE.

The entity-specific attributes, such as No_of_axles for TRUCK and Max_speed for CAR, would be retained in their respective subclasses while inheriting common attributes from VEHICLE.

Constraints in Specialization and Generalization

Specialization and generalization can include constraints that define how entities belong to subclasses. The two main constraints are explained below –

  • Disjointness Constraint − The disjointness constraint indicates that an entity can be a member of only one subclass. If subclasses are disjoint, the EMPLOYEE cannot be both a SECRETARY and an ENGINEER. This is represented in diagrams by a "d" in the circle connecting subclasses to the superclass. Take a look at the figure below.
  • Completeness Constraint − The completeness constraint is used if an entity must belong to at least one subclass (total specialization) or if it can exist without being in any subclass (partial specialization). There could be a double line between the superclass and the circle to denote a total specialization, while a single line indicates a partial specialization.

Example − Take a look at the following figure. In Figure 8.1, the specialization {HOURLY_EMPLOYEE, SALARIED_EMPLOYEE} is disjoint and total. Every EMPLOYEE must be either hourly or salaried, but not both.

Constraints in Specialization and Generalization

Using Specialization and Generalization in EER Diagrams

In practice, database designers often use specialization to start with a general entity type and create specific subtypes to handle particular attributes or relationships. Conversely, they may use generalization to combine existing entity types when commonalities are found.

Advanced Features: Union Types and Categories

Sometimes, a subclass may need to inherit from more than one superclass. This type of structure is known as a category or union type. This is used when an entity type shares attributes across multiple parent classes. For instance, an OWNER of a vehicle in a registration database might be a PERSON, a BANK, or a COMPANY. The OWNER subclass would be connected to all these superclasses. In the above figure, we are using the "" symbol to represent union relationships.

Conclusion

In this chapter, we learned the Enhanced ER model that extends the traditional ER model by incorporating subclasses, superclasses, type inheritance, and specialization or generalization processes. We also reviewed how these features enable more precise and flexible database schemas. We also touched upon constraints such as disjointness and completeness and looked at union types for complex relationships.

Advertisements