EER model is basically the enhanced version of E-R model which includes all the basic concepts of E-R model with capability to support additional semantic concepts of complex applications. These additional concepts are :
- Specialization
- Generalization
- Categorization.
Before discussing the concepts of specialization, generalization, and categorization two another entity types superclass (supertype) and subclass (subtype) are described.
1. Superclass and Subclass Entity Types
The most important new modeling construct introduced by EER was superclass and subclass entity types. These are also known as supertype and subtype entities respectively. By using these two entity types E-R model can be divided into more specialized sub-models or can join some sub-models to make a generalized E-R model.
- Superclass Entity Type (Supertype) : A superclass entity type is a generic entity type that includes one or more distinct subclasses that require to be represented in a data It means members belong to subclass are same as the entity in the superclass. The relationship between a superclass and subclass is a one-to-one (1 : 1) relationship. In some cases, a superclass can have overlapping subclasses.
- Subclass Entity Type (Subtype) : A subclass entity type is a more specialized entity type that has a distinct role in the A subclass is a member of superclass. It is one of the data-modeling abstractions used in EER. A subclass may be further divided and in that case it acts as superclass for its subclasses.
The superclass/subclass relationship is shown in Figure 2.14.
Consider the example of a Bank as shown in Figure 2.15 in which PERSON entity is superclass entity type which is further divided into EMPLOYEE and CUSTOMER entities. Here EMPLOYEE and CUSTOMER entities are subclass entity type.
Basic concept is that by E-R model, a person belongs to a Bank is known, and by EER, how it belongs to Bank is known means, what is the exact relationship between Bank and that person? A person may be an employee or customer which can be further categorized into Manager, Staff or Investor, Borrower and so on.
2. Specialization
Specialization includes subgrouping of entities within an entity set having some distinct nature then other entities. If deep information is needed then go towards specialization. In other words Specialization is a process by which any existing entity set is divided into smaller entity sets according to the distinct or different nature of entities.
Consider the example of Bank in Figure 2.15. Person is an entity set of all people who belongs to bank. Further Person is classified into Employees and Customers of bank. So, Person entity set is divided into Employee entity set and Customer entity set. Employees are further classified into two categories full time employees and part time employees and so on. Customers are also classified into Investors and Borrowers and so on.
3. Generalization
Generalization is a process by which two or more entity sets can be combined into a single entity set by determining similarities between the entities. Its an abstract view of any Enterprise. Generalization proceeds from the recognization that a number of entity sets share some common features. If an abstract view of information is needed then go towards generalization.
Consider the example in Figure 2.15. Here Investor and Borrower are two entity sets. They have common feature that both are Customer of the Bank. Similarly, Employee entity set and Customer entity set can be combined into Person entity set.
4. Attribute Inheritance
Specialization and generalization leads to attribute inheritance between higher level entity set and lower level entity set. Inheritance is a process by which lower level entity set inherits (or taken) some properties of its higher level entity set.
Consider the Figure 2.15. Here entity sets Employee and Customer inherits attributes Person_ID, Name, Address, Age from Person entity set.
5. Aggregation
Aggregation is an abstraction process in which a relationship set is considered as higher level entity set.
Consider an example of ternary relationship having three entity sets Employee, Job and Branch with relationship set works-on as shown in Figure 2.16. The information about Managers on employes, managers of particular jobs and of different branches can be taken easily.
6. Specialization and Generalization Constraints
The following constraints are applied on specialization and generalization to capture important business rules of the relationships in an enterprise. There are Two types of constraints :
- Participation Constraints : It tells the participation of entity set in relationship There are two types of participations.
- Partial participation : If only some entities from entity set E is participated in relationships in set R then it is known as Partial participation. Partial participation is shown in Figure 17(a).
- Total participation : If every entity from entity set E is participated with at least one relation in relationship set R then it is known as Total participation. Consider the Figure 17(b).
Here Customer and Loan are two entity sets and Relationship set is Borrower.
— Every customer may or may not take the Loan so Customer entity set is partially participated.
— But every loan is concerned with at least one customer of bank. So Loan entity set is totally participated.
- Disjoint Constraints : Disjoint constraints describe the relationship between members of different According to Disjoint constraint if the subclasses of a specialization/ generalization are disjoint then an entity can be a member of only one subclass of that specialization/generalization. Consider Figure 2.15, subclasses Full Time Employee and Part Time Employee of superclass Employee (discussed earlier that a subclass may be further categorized) are disjoint. Suppose any employee ‘Martin’ works as part time employee for Bank then it can only belongs to subclass ‘Part Time Employee’.
7. Categorization
Categorization is a modeling process of a single subclass having relationship with more than distinct superclasses. The subclass having more than one superclass is known as category and the process of defining a category is known as categorization. The symbol shown in Figure 2.18(a) represents categorization. Consider Figure 2.18(b).
In a bank, a person can be either a employee or a client and both of them may be investors. So, here subclasses employee and client act as Disjoint Superclasses and Subclass Investor acts as Category.
You cannot combine works-on and managers relationship sets because some workers are not managers. Using aggregation, works-on relationship set acts as higher entity set and solve this drawback of E-R Model. E-R Model with Aggregation is shown in Figure 2.19.
Source: Gupta Satinder Bal, Mittal Aditya (2017), Introduction to Database Management System, 2nd Edition-University Science Press (2017)