UML Notations in CommonKADS
Activity diagrams State diagrams Class diagrams Use-case diagrams
Background UML
Nineties: number of popular object-oriented methods
Unified Modeling Language: proposal for set of standard notations
wide attention
see www.rational.com
mainly meant for analysis phase
UML notations used
Class diagram
static information structure (“data”)
Activity diagram
combined function/control view
Use-case diagram
high level view of system services (functional)
State diagram
highly interactive control
Activity diagram
Model control and information flow of a procedure or process
Useful if control is mainly synchronous
otherwise: use state diagram
Use in CommonKADS: modeling the organizational process
worksheet OM-2 of the organization model
Can also be used to model control flow within a task method (knowledge model)
Action state
State in which some work is being done
activity, task
State terminates when the work is finished
difference with state diagrams
After termination the action state can lead to another action state
“state transition”
Special symbols for being and end of a procedure or process
Basic notation for activity diagram
data entry
processing generate
output
Decision
Sate transition is deterministic
If transition depends on outcome of the work, then introduce a decision
data entry
dump in further processing [data correct]
[data incorrect]
Introducing concurrency
buy food and drinks
cook dinner open wine bottle
have dinner
Swim lanes
Process can sometimes be distributed over several agents or organizational units
Notation: use compartments
In particular useful when modeling a business process (e.g. in organization model)
Notation for swim lanes
write tender get customer
information SALES DEPARTMENT
calculate cost
DESIGN DEPARTMENT
design elevator
Object flow
standard design write
tender get customer
information SALES DEPARTMENT
decide about design type
custom design
calculationcost elevator
design DESIGN DEPARTMENT
non-standard standard
CUSTOMER
tender customer information
Signals
receive request
archive (request) archive
(request)
process request archive
Business process “Housing”
primary
process secondary
process
data entry
of applications magazine
production
application assessment
residence assignment
statistical analysis
policy information :residence
assignments
Activity diagram of method control
cover
predict
obtain compare
[no more solutions of cover]
[new solution of cover]
[result = equal]
[result = not equal]
solution found no solution found start
diagnosis through generate-and-test
State diagrams
Synonyms: “state chart”, “state-transition diagram”
Purpose: model of dynamic behavior
Use if control is heavily influenced by “external”
events
Draw a state diagram for object classes with interesting behavior
Activity diagram is alternative
internal control
object flow
State
watching football match
duration
entry/switch on TV do/watch
exit/turn off TV
state name state variables
state actions
& activities
State transition
Event: comes from outside the object modeled
Message: generates event for another object
ready for take of check: boolean entry/final check
airborne
do/fly permission-from-control-tower
[check -= OK]
/ take-off
^control-tower.confirm-takeoff(flightID)
Actions and activities
Action: instantaneous, not interruptible
on transition
on state entry = action on all incoming transitions
on state exit = action on all outgoing transitions
on event
Activity: takes time, interruptible
State diagram of ticket machine
idle inserting money
timer balance
insert(coin)/add to balance
processing selection do/compute change
dispensing dispensing
ticket
cancelling
do/return balance select(ticket) cancel button
pressed
time out
[balance <
ticket price]
insert(coin)/new balance
[balance = ticket price]
State concurrency
entering transaction
data processing
take out
cash take out
card
idle cash card
entered
cash taken card taken
State generalization
If Object A is in super-state S, then the object us in precisely one of the sub-states
white to move
black to move playing chess
State diagrams in CommonKADS
Communication modeling (Ch. 8)
Asynchronous reasoning control
real-time applications
Control specification for the business process
Overlap with activity diagrams
state with no outgoing events = action state
State diagram “Housing”
application assessment
waiting for case data application received/
order assessment
data needed/ask assessment finished/
report decision
Class diagram
Captures static information structure
In O-O: also functions
Generalization, inheritance & reuse are important issues
Imported into CommonKADS domain- schema notation
no use made of operation box
Can also be used in Task Model to sketch task information structure
Objects and classes
Fokker 100 :airplane
airplane
#seats: integer
Fokker 70 :airplane
#seats = 80
:airplane
Object class
Describes a group of objects with similar properties
Abbreviation: "class"
Rationale for introducing classes:
it provides a means for abstraction
Terminology: “object” is often used in an ambiguous way, pointing to both objects (in the strict sense) and object classes.
Attributes
An attribute describes a value held by objects belonging to the class.
Attribute specification consists of:
Class it is defined on (student)
Attribute name (name)
Admissible values (string)
Optional: default value
Object and Value
Most O-O approaches distinguish between objects and values.
Difference: a value does not have an identity
it "lives” only in connection to a certain object.
RULE 1: an object is not allowed as a possible value of an attribute!
RULE 2: attribute names need only to be unique within a class.
Values and Value Sets
Values are the primitive things with no internal structure from the viewpoint of the application
Admissible values are defined through a value set
Typical predefined value-sets:
string, number, integer, real, range, boolean, ….
User-defined:
set or list of strings
Object Identifiers
In O-O modeling you assume that every object has an identity.
Consequence: introduce only attributes that act as identifiers, iff the identifier is something that exists in the real world.
Examples: student card number, social security number.
Operations
Definition:
operation is "a function or a transformation that can be applied to objects of a class".
Objects in a class share the same operations.
Method: implementation of an operation
= functional view
Class notation
class name attribute-1: value-set
attribute-2: value-set
operation-1(Par1:Type, Par2:Type): ReturnType
library book catalog#: string
title: string author: string
category: Category
cover-type: {hard-cover, paperback}
available(): Boolean
library book
Associations
Associations are used to link objects to other objects
Majority of associations:
binary (between two objects)
directional (should be read in a particular direction
Ternary associations come up occasionally.
Associations between more than three objects are rare.
Association notation
man woman
0-1 0-1
husband wife
man woman
husband wife
General notation for association
Notation for a binary association
married-to 0-1
0-1
Multiplicity examples
student course
person
address
<< has address
married-to
major subject
>>
enrolled in >>
0+
0-1
1+
Multiplicity
Also called: "cardinality".
Always connected to one of the classes involved.
Typical types of multiplicity:
0-1 Zero or one (optional).
1 Precisely one.
0+ Zero or more,
1+ One or more.
Association class
Modeling an association as a class if the association has an internal information structure
Advantage: associations become first-class objects.
Attributes and methods can be defined for the association class.
Notation association class
man woman
0-1 0-1
wife husband
marriage date: Date
registered in >> city
Use of an association class
company name
person namesocial security # address
salary job title
person namesocial security # address
company name
<< works for
employer employee
1 1+
employer employee
1+ 1+
works for if you want to model that
a person can work for more than one company,
then change to
Associations with specific semantics
Associations provide a general, "neutral", way of connecting object classes.
Semantics of the association are defined through
argument typing, multiplicity and (implicitly) the name of the association.
Class diagrams provide specific types of associations, with predefined semantics:
generalization ("is a").
aggregation ("part of").
Generalization
Purpose: sharing similarities while preserving differences
Is an association between a class that acts as super- class and one or more classes called the sub-
classes.
Super-classes show the features that the sub-classes have in common.
Each sub-class inherits the attributes and operations defined on its super-class(es).
Notation for generalization
agent
human computer
program
man woman
executor-of >> task
1+ 0+
Aggregation
Aggregation denotes a binary association in which one side is an "assembly" and the other side a "part".
"Assembly" and "part" act as predefined roles involved in the aggregation association.
Cardinality of a part can be defined
precisely one; optional (0-1); many, ...
Notation for aggregation
audio system
tape deck CD player
tuner
amplifier speaker
phoneshead record
player
0-1
0-1
0-1
0-1 0-1 2,4
Composition
Sub-type of aggregation
Existence of part depends on aggregate
document nametype
openprint
paragraph style
0+
Aggregation and generalization
Similarities:
Tree-like structure
Transitive properties
Differences:
AND-tree (aggregation) vs. OR-tree (generalization)
instance tree (aggregation) vs. class tree (generalization)
Combined aggregation and generalization
audio system
CD player
amplifier speaker
phoneshead
record player
0-1 2,4
input system
1+
Use-case diagram
shows services that can be expected from a system
provides outsider view (customer)
terminology
use case service provided by system actor agent using a system service
used in early phases of system analysis
use in CommonKADS: way to present possible solutions to customer
Use cases for a library
library system
lend book
make book reservation
search library catalog
add book to catalog
remove book from catalog
lender librarian
A small case study
Course administration system (CAS)
Context: university department
Required services:
STUDENT: update personal data, inspect exam results, inspect course info, enroll in course
TUTOR: inspect exam results, update course info, inspect enrollments
ADMIN STAFF: enter exam results, inspect exam results, update personal data students, inspect enrollments
Use cases
student
tutor
inspect course info
update course info enroll
in course
enter exam results
browse enrollments browse
exam results browse
individual results
browse course results
Class diagram
student student-card#: string
name: string address: string date-of-birth: data
major: Major ...
course course-code: string
year: integer trimester: 1-3 study-points: integer learning-goals: string
description: text literature: text
maximum-#students: integer exam
date: date result: [0..10]
enrollment date: date
university staf member title: string position: string department: string
telephone: string
0+ 0+
course-exam 1
0+
tutor 0+
1+
0+
requires
Activity diagram for course enrollment procedure
submit enrollment
request
check student limit check
preconditions
inform about
prerequisites inform about
student limit [preconditions
OK]
[preconditions
not OK] [above limit]
[limit not yet reached]
State diagram:
“update student data”
waiting for notification timer
received(new student data)
^ send message to central university database
local processing
do/update local database do/display results
OK message received from central database
[timer = time-out or not OK]
/notify failure