An important category of relationships (i.e., associations) have the form:
Object X is part of object Y
For example:
Engine X is part of car Y
These are called part-whole, meronymic, or partonomic relationships.
Philosophers classify part-whole relationships according to how they combine the following three properties:
C = configurational = parts have a functional/structural relationship to each other or whole
H = homogeneous = parts same kind as whole
I = invariance = parts can't be separated from the whole
For example,
a sub-category of partonomic relationships are those that are configurational,
non-homogeneous, and non-invariant (CHI). Thus, there is a total of
eight possible categories of patonomic relationships. Six are common, and two
are represented in UML.
An engine is part of a car.
A piston is part of an engine.
A car is part of a fleet of cars.
Flour is a part of a loaf of bread.
Metal is part of a car.
A slice of bread is part of a loaf of bread.
We can represent the categories of Part-Whole relationships using a UML class diagram:
UML has special notation for composition and aggregation:
Assume we represent the relationship X is part of Y by:
X is part of Y
Assume:
X is part of Y and Y is part of Z
Can we infer:
X is part of Z
In other words, is the is part of relationship transitive?
Generally, transitivity fails unless both is part of relationships have the same CHI type as defined above.
For example, the first inference is valid, but not the second:
piston part of engine
engine part of car
piston part of car
engine part of car
car part of fleet
engine part of fleet
the customer is in the store
"Moby Dick" is a book
Smith is 5 feet tall
Feet are attached to legs
Smith owns a bicycle
The Composite Design Pattern is used in both domain modeling and design to represent partonomic hierarchies.