Unary Relationships
Unary relationships associate occurrences of an entity type with other occurrences of the same entity type.
- e.g.,
- entity Person
- One person may be married to another person
Unary Relationships
One-to-One Unary Relationship
- Figure (a) shows a one-to-one unary relationship called Back-Up
- involves Salesperson entity
- salespersons are organized in pairs as backup to each other when one is away from work
- in each direction the modality of one forbids the situation of a salesperson not having a backup
One-to-Many Unary Relationship
- a sales manager can manage several other salespersons
- each salesperson is managed by exactly one sales manager
- This situation describes a one-to-many unary relationship
- Figure (b)
- The downward branch
- It says that a salesperson manages zero to many other salespersons
- means that
- a salesperson may not be a sales manager (the zero modality case)
- or may be a sales manager with several subordinate salespersons (the many cardinality case)
- means that
- It says that a salesperson manages zero to many other salespersons
- the rightward branch
- says that a salesperson is managed by exactly one other salesperson (who must, of course, be a sales manager)
- The downward branch
Many-to-Many Unary Relationship
Example
- One classic example of a many-to-many unary relationship is known as the “bill of materials” problem
- Consider a complex mechanical object
- Any such object is made of basic parts like nuts and bolts that are used to make other components or sub-assemblies of the object
- Small sub-assemblies and basic parts go together to make bigger sub-assemblies, and so on until ultimately they form the entire object
- Each basic part and each sub-assembly can be thought of as a “part” of the object
- Then, the parts are in a many-to-many unary relationship to each other
- Any one particular part can be made up of several other parts while at the same time itself being a component of several other parts
- Figure (c)
- a product can be part of no other products or part of several other products
- Going in the reverse direction, a product can be composed of no other products or be composed of several other products
