Entity - Relationship Modelling - Entity subtypes and constraints
Entity subtypes
Entity types can have attributes that can possess different meanings in a given context. In this situation, the modelling rule that is applied is that each attribute can have only one meaning. This is of particular note in regard to separating an entity type into similar entities where there are common features. In other words, an entity type can be a supertype. Entities with the same properties plus additional properties will be created as subtypes of this supertype. The subtype will inherit the same properties as the supertype. The additional properties of the subtype will be extra to those of the supertype. These entity subtypes can themselves be supertypes with further subtypes having inherited properties and further extra properties.
Entity types
Student (StudentId, Name, Registered, Region) //indentation to show subtyping
GraduateStudent (DegreeObtained)
CounselledStudent ()
UnderGradStudent (DegreeStudied)
DiplomaStudent ()
In the example above, it should be noted that each subtype:
- GraduateStudent
- UnderGradStudent
- DiplomaStudent
is defined from the supertype. They are not occurrences of Student or CounselledStudent, nor can they ever be. Any occurrence of Student must be defined as:
- GraduateStudent
- UnderGradStudent
- DiplomaStudent
Constraints
Constraints are represented in E-R models as:
- a property of a modelling construct
- a description in the Constraints part of a model
Constraints should always be represented in the modelling construct unless it is not possible for it to be represented by any process other than a description.
The above diagram demonstrates that for an employee to be provided with a car, he/she must be a licensed employee. There is no direct connection between Employee and Car. Therefore, in addition to the constraint that the employee has to be a licensed employee to get a car, there is the added constraint that an occurrence of Employee cannot be provided with a car.
There are various methods of showing a constraint in a model. With appropriate information it is possible to illustrate such a constraint through the use of subtypes as shown in the above image.
Comments, suggestions, ideas to
Stuart Banner
