In the reflexion package of MOF2, the proposal for links assumes that
AssociationEnds are ordered.
There is an implicit mapping between firstObject and secondObject roles and
AssociationEnds is based on this assumption:
FirstObject maps to the first associationEnd
SecondObject maps to the second associationEnd
This leads to the following Operation to create links in the Factory Class:
createLink(association: Association, firstObject : Object, secondObject :
At first glance, this solution provides an easy way to identify the link
members in parameters of link operations. However, the AssociationEnd is
difficult to read. It is closer to relational concepts than to
One will always have to guess which is the first or second object.
The modeler who has created the association might remember the order. But
the user using the association will probably be lost.
Country:Class - resident:AssociationEnd (First) - Citizenship:Association
- country:AssociationEnd (Second) - Country:Class
createLink("Citizenhip": Association, "Thomas": Object : "France" :
The idea is to benefit from the semantic carried by AssociationEnds
A link defines members. Each member references a participant object
according to a role defined by the AssociationEnd.
Thanks to opposite association of AssociationEnds (aka Property), it is
possible to identify one end from another. This means that if we create
links from an AssociationEnd viewpoint, there is no need to order
The proposal is to order the creation parameters as follow: sourceObject,
Of course, this approach only works for binary associations. But the focus
of AssociationEnd is the first step to take into account nary associations.
This also highlight that what matters most in Association semantic is the
role name of AssociationEnds.
It is usually much more difficult to have a meaningful name for association.
This is why we can often see names such as "has for ..." which do not carry
much information about the association.
All operations on links are redefined as follow:
createLink (sourceObject : Object, oppositeRole : Property, oppositeObject :
linkedObjects (sourceObject : Object, oppositeRole : Property) :
LinkExists (sourceObject : Object, oppositeRole : Property, oppositeObject :
Object) : Boolean
A better proposal would not use the opposite role but the role attached to
the object participation to the association.
But experience shows that this is two much unsual for modelers. This would
however be the right path for the introduction of nary associations.