Search code examples
umlassociationsclass-diagram

Can an enumerative attribute be optional?


in a class diagram, can an enumeration class attribute be optional and affect associations?

example entity1 has various attributes

entity2 possesses the following attributes: type : typeenum(type1 ,type2)

the association between entity 1 and 2 is many to many and has 1 attribute called year.

if type is 1, there can only be one association between entity 1 and entity 2 for each year. if instead it is 2, more can exist in the same year.


Solution

  • An enumeration attribute can be optional. This is expresse with the attribute multiplicity [0..1] next to its type.

    Such an attribute may influence an association via constraints. In the given example, you would have to use the maximimum multiplicity * and add a constraint for the association that constraints the maximum number of linked instance depending on the attribute's existance and its value.