digraph "Compositions" {
  rankdir="BT"
  node [ratio="auto" shape=record margin=0; href="javascript:Action.selectClass(&quot;\N&quot;);"];

  // Class: A
  "A" [shape=plaintext margin=0 label=<<table border="1" cellspacing="0" cellborder="0" cellpadding="10"><tr><td>    A    </td></tr></table>>,
   tooltip="class A
Example code illustrating various&#13;kinds of compositions&#13;"];

  // Class: X
  "X" [shape=plaintext margin=0 label=<<table border="1" cellspacing="0" cellborder="0" cellpadding="10"><tr><td>    X    </td></tr></table>>,
   tooltip="class X
"];

  // Class: Y
  "Y" [shape=plaintext margin=0 label=<<table border="1" cellspacing="0" cellborder="0" cellpadding="10"><tr><td>    Y    </td></tr></table>>,
   tooltip="class Y
"];

  // Class: B
  "B" [shape=plaintext margin=0 label=<<table border="1" cellspacing="0" cellborder="0" cellpadding="10"><tr><td>    B    </td></tr></table>>,
   tooltip="class B
Class with inline composition having role name&#13;"];

  // Class: C
  "C" [shape=plaintext margin=0 label=<<table border="1" cellspacing="0" cellborder="0" cellpadding="10"><tr><td>    C    </td></tr></table>>,
   tooltip="class C
Class with both composition ends having role names&#13;"];

  // All associations
  "X" -> "Y" [dir="forward", arrowhead="diamond", taillabel="* x", headlabel="2..3 ", tooltip="X * x -<@> 2..3  Y

An Y called ies has some Xs. It can have none, and there is no upper bound defined.

A X has at least2 Ys called ies and can never have none. And there is an upper bound of at most 3 Ys called ies.

This is a composition. A X is part of an Y. When any Y is destroyed its parts are destroyed too.
" headtooltip="X * x -<@> 2..3  Y

An Y called ies has some Xs. It can have none, and there is no upper bound defined.

A X has at least2 Ys called ies and can never have none. And there is an upper bound of at most 3 Ys called ies.

This is a composition. A X is part of an Y. When any Y is destroyed its parts are destroyed too.
" tailtooltip="X * x -<@> 2..3  Y

An Y called ies has some Xs. It can have none, and there is no upper bound defined.

A X has at least2 Ys called ies and can never have none. And there is an upper bound of at most 3 Ys called ies.

This is a composition. A X is part of an Y. When any Y is destroyed its parts are destroyed too.
" URL="javascript:Action.selectAssociation('X,Y,2..3 ,* x')" ];
  "B" -> "A" [dir="forward", arrowhead="diamond", taillabel="1 ", headlabel="* endTwo", tooltip="B 1  -<@> * endTwo A

An A called endTwo has A B. It must always have exactly, one, and can never have none. And there is an upper bound of at most one B.

A B has some As called endTwo. It can have none, and there is no upper bound defined.

This is a composition. A B is part of an A. When any A is destroyed its parts are destroyed too.
" headtooltip="B 1  -<@> * endTwo A

An A called endTwo has A B. It must always have exactly, one, and can never have none. And there is an upper bound of at most one B.

A B has some As called endTwo. It can have none, and there is no upper bound defined.

This is a composition. A B is part of an A. When any A is destroyed its parts are destroyed too.
" tailtooltip="B 1  -<@> * endTwo A

An A called endTwo has A B. It must always have exactly, one, and can never have none. And there is an upper bound of at most one B.

A B has some As called endTwo. It can have none, and there is no upper bound defined.

This is a composition. A B is part of an A. When any A is destroyed its parts are destroyed too.
" URL="javascript:Action.selectAssociation('B,A,* endTwo,1 ')" ];
  "C" -> "A" [dir="back", arrowtail="diamond", taillabel="0..1 endOne", headlabel="* endTwo", tooltip="C 0..1 endOne <@>- * endTwo A

An A called endTwo may have a C called endOne. It can have none or just 1. 

A C called endOne has some As called endTwo. It can have none, and there is no upper bound defined.

This is a composition. An A is part of a C. When any C is destroyed its parts are destroyed too.
" headtooltip="C 0..1 endOne <@>- * endTwo A

An A called endTwo may have a C called endOne. It can have none or just 1. 

A C called endOne has some As called endTwo. It can have none, and there is no upper bound defined.

This is a composition. An A is part of a C. When any C is destroyed its parts are destroyed too.
" tailtooltip="C 0..1 endOne <@>- * endTwo A

An A called endTwo may have a C called endOne. It can have none or just 1. 

A C called endOne has some As called endTwo. It can have none, and there is no upper bound defined.

This is a composition. An A is part of a C. When any C is destroyed its parts are destroyed too.
" URL="javascript:Action.selectAssociation('C,A,* endTwo,0..1 endOne')" ];
}
