In short
I would like to model a covariant association between two classes, that can each be specialized. I need to show the specialization of the related association-classes. But I want to avoid that my model could mean that there are redundant associations (i.e. one between the generalizations and one between the specializations.
Step by step explanation of the problem
I have in an UML class diagram a many-many association between a Person
and a Contract
. A person can be involved in several contracts, and conversely a contract can involve several persons. Each involved person ins involved with a role in the contract. One person can even be involved multiple time with different roles in the same contract:
There are many kind of Contract
specializations. Let's take a look at CompanyFoundationContract
, where several persons decide to create a company. Person
can also be specialized. Here I use a special kind of person called Founder
. In practice, I prefer composition over inheritance, and the founder would be a decorator. But I'll omit this detail later for the sake of simplification:
From the UML specialization, I know that Founder
and CompanyFoundationContract
inherit the many-to-many relation. But after discussion with my users of the legal practice, It soon appears that the Role
of a Founder
in a CompanyFoundationContract
needs to be specialized as well, to takie into account for example the shares held in the company. It seems simple to model this covariance in my class diagram:
At first sight, this model can represent the legal complexity of such contracts: it seems obvious that other persons that are not founders can be involved in the contract with a normal role (e.g. the notray or attorney who registers the company).
Since the association-class ShareHolderRole
is a specialization of the Role
association-class, I'd expect to clear that it's one and the same association between Contract
and Person
and between CompanyFoundationContract
and Founder
.
However, I am worried that I missed something and that interpreting UML strictly would imply to have two different and redundant associations. How shall I model accurately the fact that there is only one association, but a covariant association-class?