OCUP2I 02 Classification

From Training Material
Jump to navigation Jump to search


<slideshow style="nobleprog" headingmark="⌘" incmark="…" scaled="false" font="Trebuchet MS" >

title
UML 2.5 Certification - OCUP 2 Intermediate Exam Preparation
author

Filip Stachecki (Filip@NobleProg.pl),presenter: Bernard Szlachta bs@nobleprog.co.uk

</slideshow>

Module 2. Classification⌘

References⌘

UML 2.5 specification:

  • Chapter 9: Classification
    • Classifiers
    • Properties
    • Operations
    • Generalization Sets
    • Instances

Classifiers⌘

  • A Classifier represents a classification of instances according to their Features.
  • Classifiers are organized in hierarchies by Generalizations.

Properties⌘

  • Properties are Structural Features that represent:
    • the attributes of Classifiers (when a property is owned by a Classifier other than an Association)
    • the member Ends of Associations (roles)
    • the parts of Structured Classifiers.

Property Notation⌘

<property> ::= [<visibility>] [‘/’] <name> [‘:’ <prop-type>] [‘[‘ <multiplicity-range> ‘]’] 
               [‘=’ <default>] [‘{‘ <prop-modifier > [‘,’ <prop-modifier >]* ’}’]
<visibility> ::= ‘+’ | ‘-‘ | ‘#’ | ‘~’
<prop-modifier> ::= ‘readOnly’ | ‘union’ | ‘subsets’ <property-name> 
                     | ‘redefines’ <property-name> | ‘ordered’ | ‘unordered’ 
                     | ‘unique’ | ‘nonunique’ | ‘seq’ 
                     | ‘sequence’ | ‘id’ | <prop-constraint>
<inherited-property> ::= ’^’ <property>  
Important Property Modifiers⌘
  • readOnly means that the Property is read only.
  • ordered means that the Property is ordered, i.e., isOrdered = true.
  • unordered means that the Property is not ordered, i.e., isOrdered = false.
  • unique means that there are no duplicates in a multi-valued Property, i.e., isUnique = true.
  • nonunique means that there may be duplicates in a multi-valued Property, i.e., isUnique = false.
  • id means that the Property is part of the identifier for the class.

Operations⌘

  • An Operation is a behavioral feature of a classifier, which specifies name, type, parameters, and constraints
  • can have preconditions and postconditions
  • can have a type (the type of the return parameter)
[<visibility>] <name> ‘(‘ [<parameter-list>] ‘)’ [‘:’ [<return-type>] 
[‘[‘ <multiplicity-range> ‘]’] [‘{‘ <oper-property> [‘,’ <oper-property>]* ‘}’]]

<parameter-list> ::= <parameter> [‘,’<parameter>]*

<parameter> ::= [<direction>] <parameter-name> ’:’ <type-expression> 
             [’[’<multiplicity-range>’]’] [’=’ <default>]
             [’{’ <parm-property> [’,’ <parm-property>]* ’}’]

<direction> ::= ’in’ | ’out’ | ’inout’ (defaults to ’in’ if omitted)

<oper-property> ::= ‘redefines’ <oper-name> | ‘query’ | ‘ordered’ | ‘unordered’ 
       | ‘unique’ | ‘nonunique’ | ‘seq’ | ‘sequence’ | <oper-constraint>

Operation examples⌘

 +createWindow (location: Coordinates, container: Container [0..1]): Window
 +toString (): String
 +toString(return : String)

Generalization Sets⌘

  • GeneralizationSet provides a way to group Generalizations into orthogonal dimensions.
  • A GeneralizationSet may be associated with a Classifier called its powertype.
  • These techniques provide additional power for organizing classification hierarchies.
  • If isCovering is true, then every instance of the general Classifier is an instance of (at least) one of the specific Classifiers.
  • If isDisjoint is true, then no instance of any of the specific Classifiers may also be an instance of any other of the specific Classifiers. By default, both properties are false.

Generalization Sets Notation⌘

Generalization Sets constraints⌘

The constraints may appear in either order: {complete, disjoint} is equivalent to {disjoint, complete}. The default values are {incomplete, overlapping}. If only one constraint is shown, the other takes its default value.

Generalization Sets examples⌘

Instances⌘

  • An Instance Specification is a model element that represents an instance in a modeled system.
  • May be partial or complete representations of the instances that it corresponds to.
  • May represent an instance at a point in time (a snapshot).
  • Instance Specification is a model element and should not be confused with the instance that it is modeling.

Instance Specification Example⌘

InstanceSpecification with Slots.

  • A Slot specifies that an instance modeled by an Instance Specification has a value or values for a specific StructuralFeature