list of dots

User Manual    [Previous]   [Next]   

E019 Duplicate Association

Umple semantic error reported when a class is given two associations with the same name.

Associations between the same classes must be given different names. This error can occur when two associations have the same role name; the solution is to change one of the role names. The error can also occur when two associations are created without any role name at all. In that case the default name is generated from the associated class. The solution is to add a role name to one of the associations.

The first example below is a simple case where there are identical associations with no role name. The second example shows how to solve this.

The third example shows that error 19 can also occur with association classes. The solution to this can be found in the manual page for association classes.

Example

// The following example shows how 
// to generate error 19.
// The solution is to at least one
// role name one or both of the Y ends
// and at least one role name on one
// of both of the X ends.
class X {
}

class Y {
  0..1 -> * X;
  0..1 -> * X;
}

      

Load the above code into UmpleOnline

 

Another Example

// Using role names rn1 and rn2 to
// avoid error 19
class X {
}

class Y {
  1 -- * X;
  1 rn2 -- * X rn1;
}


      

Load the above code into UmpleOnline

 

Another Example

// Example of an association class
// definition that generates error 19
// The solution is to add a role name
// such as menteeAssignments between
// the first * and Member

class Member {
  name;
}

associationClass Assignment {
  Date dateEstablished;
  * Member mentor;
  * Member mentee;
}
      

Load the above code into UmpleOnline