Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Modeling of UNION Types Using Categories
In DBMS, superclass/subclass relationships typically involve a single superclass. However, a union type or category represents a subclass that is a subset of the UNION of multiple distinct superclass entity types.
Example: Vehicle Owner Category
Consider a motor vehicle registration database with three entity types: PERSON, BANK, and COMPANY. A vehicle owner can be any one of these. We create a category called OWNER that represents the union of all three ?
In an EER diagram, the category is represented by a circle with the ∪ symbol. Lines connect superclasses to the circle, and a subset arrow connects the circle to the category.
Category vs Shared Subclass
| Feature | Category (Union Type) | Shared Subclass |
|---|---|---|
| Set Operation | UNION of superclasses | INTERSECTION of superclasses |
| Membership | Belongs to one superclass | Belongs to all superclasses |
| Inheritance | Inherits from whichever superclass it belongs to | Inherits from all superclasses |
| Example | OWNER is a PERSON or BANK or COMPANY | ENGINEERING_MANAGER is an ENGINEER and MANAGER and SALARIED_EMPLOYEE |
Total and Partial Categories
Total category Contains the union of all entities in its superclasses. Represented by a double line connecting to the union circle.
Partial category Contains only a subset of the union. Represented by a single line.
If superclasses have the same key attributes and many shared attributes, use specialization/generalization instead. Use categorization when superclasses are distinct entity types with different keys.
Conclusion
Categories (union types) model subclasses that belong to one of multiple distinct superclass types, unlike shared subclasses that require membership in all superclasses. They are essential in EER modeling when entities from different types need to be grouped under a single subclass, such as vehicle ownership spanning persons, banks, and companies.
