Classes are the most well known elements of UML. A class as a unique name (within it's namespace) and can contain attributes and operations. Relationships with other classes can be established by means of associations, dependencies and generalization.
Attributes can be written using OCL syntax:
+ name: string # count: integer = 1
Syntax:
attribute ::= [visibility] [derived] name [':' type] ['=' default] ['{' tagged_values '}']
visibility ::= ('+'|'#'|'-')
derived ::= '/'
name ::= literal
type ::= literal ['[' multiplicity ']']
multiplicity ::= mult_value ['..' mult_value]
default ::= literal
tagged_values ::= tagged_value [, tagged_value]*
tagged_value ::= literal
mult_value ::= ('0' .. '9' ['0' .. '9']* | '*')
literal ::= literal_char [literal_char]*
literal_char ::= ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '-' | '_')
Syntax:
operation ::= [visibility] name '('[parameterlist]')' [':' type] ['{' tagged_values '}']
visibility ::= ('+'|'#'|'-')
derived ::= '/'
parameterlist ::= parameter [',' parameter]
parameter ::= [direction] name [':' type] ['{' tagged_values '}']
direction ::= ('in'|'out'|'inout')
name ::= literal
type ::= literal ['[' multiplicity ']']
multiplicity ::= mult_value ['..' mult_value]
mult_value ::= ('0' .. '9' ['0' .. '9']* | '*')
tagged_values ::= tagged_value [, tagged_value]*
tagged_value ::= literal
literal ::= literal_char [literal_char]*
literal_char ::= ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '-' | '_')