Modeling of UNION Types Using Categories


In DBMS, Superclass/subclass relationships with a single super-class. A shared subclass may be represented in multiple superclass/subclass relationships, where each relationship has a single superclass.

Understanding Superclass/Subclass Relationships in DBMS

A single superclass/subclass relationship using more than one superclass. Each superclass represents a distinct entity type. Subclass represents a group of objects that is a subset of the UNION of the distinct entity types. This subclass is known as union type or a category.

Example

Consider the scenario where we have three distinct entity types: PERSON, BANK, and COMPANY. In a motor vehicle registration database, a vehicle owner can be classified as a person, a bank holding a lien on the vehicle, or a company. To create a class (i.e., a collection of entities). That encompasses all three entity types, we need to construct a subclass that represents the union of the three sets, which we will call OWNER. This subclass is a category, also known as a union type.

Category in an Entity-Relationship Diagram

To visually represent this subclass in an Entity-Relationship (EER) diagram, we use a circle with the symbol "∪" to denote the set union operation, which is connected to the superclasses COMPANY, BANK, and PERSON. An arc with the subset symbol connects the circle to the OWNER category, indicating that the OWNER category is a subclass of the union of the three entity types. If necessary, we can display a defining predicate next to the line from the superclass to which the predicate applies.

In Figure below, we can see two categories displayed in the EER diagram: OWNER and REGISTERED_VEHICLE. OWNER is a subclass of the union of PERSON, BANK, and COMPANY, while REGISTERED_VEHICLE is a subclass of the union of CAR and TRUCK.

Comparison of Category and Shared Subclass: OWNER and ENGINEERING_MANAGER

Category is a subclass. It has two or more superclasses representing distinct entity types. Superclass/subclass relationships only have a single superclass. To better understand the distinction between a category and other subclass relationships, let us compare the OWNER category in Figure above with the shared subclass ENGINEERING_MANAGER.

ENGINEERING_MANAGER subclass is member of each of these superclasses: ENGINEER, MANAGER, and SALARIED_EMPLOYEE. Entity which is part of ENGINEERING_MANAGER must also exist in all three of its superclasses. So, ENGINEERING_MANAGER is subset of the intersection of the three classes. Engineering manager must be an ENGINEER, MANAGER, and a SALARIED_EMPLOYEE.

On the other hand, a category such as OWNER is a subset of the union of its superclasses. Entity that is member of OWNER must exist in only one of its superclasses. In Figure above, an OWNER entity may be COMPANY, BANK, or PERSON.

Attribute inheritance operates in the case of categories. In Figure above, each OWNER entity inherits the attributes of COMPANY, PERSON, or BANK. It depends on superclass to which entity belongs. In a shared subclass such as ENGINEERING_MANAGER (Figure above), the subclass inherits all the attributes of its superclasses SALARIED_EMPLOYEE, ENGINEER, and MANAGER.

Total and Partial Categories

A category can be total or partial. Difference between category and shared subclass, such as ENGINEERING_MANAGER. It is that the latter must exist in all three superclasses. Category is a subset of the union of its superclasses.

A category can be total. It holds the union of all entities in its superclasses. A category can also be total. It can hold subset of the union. A total category is represented by a double line connecting the category and the circle. A partial category is indicated by a single line.

Superclasses of a category may have different key attributes. These may have same key attribute. If the category is total, it may be represented as a total specialization or a total generalization. The choice of which representation to use is subjective. If the two classes represent the same type of entities and share numerous attributes. It also has same key attributes, specialization/generalization is preferred. Otherwise, categorization (union type) is more appropriate.

It is important to note that not all modeling methodologies have union types. In such models, a union type must be represented indirectly.

Updated on: 17-May-2023

985 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements