Inverse References
Let's learn about inverse reference properties for our class models.
We'll cover the following...
In OO modeling and programming, a bidirectional association is represented as a pair of mutually inverse reference properties, which allow for navigation, also known as object access in both directions.
The model below serves as our example. It contains two bidirectional associations, as indicated by the ownership dots at both association ends
Inverse reference properties
To easily retrieve the committees that are chaired or co-chaired by a club member, we can add two reference properties to our Committee-ClubMember example model. These two reference properties are: a club member as the chair of a committee (ClubMember::chairedCommittee
) and a club member
as the co-chair of a committee (ClubMember::coChairedCommittee
). We assume that any club member can be the chair or co-chair of no more than one committee (The disjunction is non-exclusive). As a result, we get the following model:
There is a close correspondence between the two reference properties Committee::chair
and ClubMember::chairedCommittee
. They are the inverse of each other. So, when the club member Tom is the chair of the budget committee, expressed by the tuple [_"budget committee", "Tom"_]
, then the budget committee is the committee chaired by the club member Tom, expressed by the inverse tuple [_"Tom", "budget committee"_]
. To express this inverse correspondence in the diagram, we append an inverse property ...