use-documentation.pdf

 

Embed or link this publication

Description

use

Popular Pages


p. 1

USE A UML based Specification Environment Preliminary Version 0.1 Database Systems Group Bremen University May 16, 2007

[close]

p. 2

Version 0.1 This document represents the first version of the USE documentation. Several section will be completed, added or changed in the following versions (e.g. the USE Generator sections). 2

[close]

p. 3

Contents 1 Introduction to USE 10 1.1 1.2 1.3 1.4 Overview of USE Features . . . . . . . . . . . . Working with USE . . . . . . . . . . . . . . . . 1.2.1 Specifying a UML Model . . . . . . . . 1.2.2 Running USE . . . . . . . . . . . . . . . 1.2.3 USE Shell - The Command Line Interface 1.2.4 Graphical User Interface . . . . . . . . . 1.2.5 Creating Objects and Setting Attributes . 1.2.6 Checking OCL Invariants . . . . . . . . 1.2.7 Evaluating OCL Expressions . . . . . . . Formal Background . . . . . . . . . . . . . . . . Examples inspected within this documentation . . 1.4.1 Employees, Departments and Projects . . 1.4.2 Persons and Companies . . . . . . . . . 1.4.3 Graphs . . . . . . . . . . . . . . . . . . 1.4.4 Factorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 10 11 11 11 12 13 14 15 16 16 16 16 17 17 19 2 Specifying a UML Model with USE 2.1 2.2 2.3 Defining a UML Model . . . . . . . . . . . . . Specification Elements . . . . . . . . . . . . . 2.2.1 Enumerations . . . . . . . . . . . . . . 2.2.2 Classes . . . . . . . . . . . . . . . . . 2.2.3 Associations . . . . . . . . . . . . . . 2.2.4 Association classes . . . . . . . . . . . 2.2.5 Constraints . . . . . . . . . . . . . . . 2.2.6 Operation declarations . . . . . . . . . 2.2.7 Types . . . . . . . . . . . . . . . . . . 2.2.8 Names, Numbers and OCL-Expressions Specifications of the Examples . . . . . . . . . 2.3.1 Employees, Departments and Projects . 2.3.2 Persons and Companies . . . . . . . . 2.3.3 Graphs . . . . . . . . . . . . . . . . . 2.3.4 Factorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 19 20 20 21 22 23 23 24 24 24 24 27 28 29 30 3 Analyzing the formal Specification 3.1 Creating System States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3

[close]

p. 4

3.2 3.3 3.1.1 Model Inherent Constraints . . . . . . . . Validating Invariants . . . . . . . . . . . . . . . Validating Pre- and Postconditions . . . . . . . . 3.3.1 Validating the Person & Company Model 3.3.2 An Example with oclIsNew . . . . . . . 3.3.3 Nested Operation Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 33 34 35 40 43 46 4 GUI Reference 4.1 4.2 4.3 4.4 4.5 The Menubar . . . . . . . . . . . . . . . . . . 4.1.1 File . . . . . . . . . . . . . . . . . . . 4.1.2 Edit . . . . . . . . . . . . . . . . . . . 4.1.3 State . . . . . . . . . . . . . . . . . . 4.1.4 View . . . . . . . . . . . . . . . . . . 4.1.5 Help . . . . . . . . . . . . . . . . . . . Toolbar . . . . . . . . . . . . . . . . . . . . . The Main Window . . . . . . . . . . . . . . . 4.3.1 Showing the diagram views . . . . . . 4.3.2 Overview of the Specification . . . . . 4.3.3 Definition of the Specification elements 4.3.4 Log window . . . . . . . . . . . . . . 4.3.5 Status and Tips . . . . . . . . . . . . . Diagram Views . . . . . . . . . . . . . . . . . 4.4.1 General Functions . . . . . . . . . . . 4.4.2 Class Diagram View . . . . . . . . . . 4.4.3 Object Diagram View . . . . . . . . . . 4.4.4 Class Invariant View . . . . . . . . . . 4.4.5 Object Count View . . . . . . . . . . . 4.4.6 Link Count View . . . . . . . . . . . . 4.4.7 State Evolution View . . . . . . . . . . 4.4.8 Object Properties View . . . . . . . . . 4.4.9 Class Extend View . . . . . . . . . . . 4.4.10 Sequence Diagram View . . . . . . . . 4.4.11 Call Stack View . . . . . . . . . . . . . 4.4.12 Command List View . . . . . . . . . . Evaluation Browser . . . . . . . . . . . . . . . 4.5.1 Extended Evaluation . . . . . . . . . . 4.5.2 Variable Assignment Window . . . . . 4.5.3 Subexpression Evaluation Window . . 4.5.4 Tree Views . . . . . . . . . . . . . . . 4.5.5 True-False highlighting . . . . . . . . . 4.5.6 Fit Width . . . . . . . . . . . . . . . . 4.5.7 Default Configuration . . . . . . . . . 4.5.8 Set to default . . . . . . . . . . . . . . 4.5.9 Capture to File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 46 47 47 47 48 48 49 49 49 49 50 50 50 50 51 51 53 53 53 53 54 54 54 57 57 57 58 60 60 60 62 63 63 64 65 4

[close]

p. 5

4.5.10 4.5.11 4.5.12 4.5.13 4.5.14 5 Shortcuts . . . . . Context Menu . . . Tree Display Menu Hide Title . . . . . Object Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 66 66 67 67 72 Shell Reference 5.1 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.1 Overview of the Shell commands . . . . . . . . . . 5.1.2 Help about a specific Shell command . . . . . . . . 5.1.3 Compile and evaluate an OCL expression . . . . . . 5.1.4 Compile and evaluate an OCL expression (verbose) . 5.1.5 Compile an OCL expression and show its static type 5.1.6 Enter OCL expressions over multiple lines . . . . . 5.1.7 Create objects . . . . . . . . . . . . . . . . . . . . . 5.1.8 Destroy objects . . . . . . . . . . . . . . . . . . . . 5.1.9 Insert a link into an association . . . . . . . . . . . . 5.1.10 Delete a link from an association . . . . . . . . . . . 5.1.11 Set an attribute value of an object . . . . . . . . . . 5.1.12 Enter object operation . . . . . . . . . . . . . . . . 5.1.13 Exit least recently entered operation . . . . . . . . . 5.1.14 Check integrity constraints . . . . . . . . . . . . . . 5.1.15 Activate single-step mode . . . . . . . . . . . . . . 5.1.16 Read information from File . . . . . . . . . . . . . 5.1.17 Reset system to empty state . . . . . . . . . . . . . 5.1.18 Exit USE . . . . . . . . . . . . . . . . . . . . . . . 5.1.19 Undo last state manipulation command . . . . . . . 5.1.20 Print info about a class . . . . . . . . . . . . . . . . 5.1.21 Print info about loaded model . . . . . . . . . . . . 5.1.22 Print info about current system state . . . . . . . . . 5.1.23 Print currently active operations . . . . . . . . . . . 5.1.24 Print internal program info . . . . . . . . . . . . . . 5.1.25 Print information about global variables . . . . . . . 5.2 Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . OCL Standard Operations 6.1 Object Types . . . . . 6.1.1 Equality . . . . 6.1.2 Inequality . . . 6.1.3 isUndefined . . 6.1.4 oclIsNew . . . 6.1.5 oclAsType . . 6.1.6 oclIsTypeOf . . 6.1.7 oclIsKindOf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 72 72 72 72 73 73 74 74 74 75 75 75 76 76 77 78 78 78 79 79 79 79 80 80 80 81 82 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 82 82 82 82 82 82 83 5

[close]

p. 6

6.2 6.3 6.4 6.5 6.6 Boolean Types . . . . . . . Real . . . . . . . . . . . . 6.3.1 Addition . . . . . 6.3.2 Subtraction . . . . 6.3.3 Multiplication . . . 6.3.4 Division . . . . . . 6.3.5 Negation . . . . . 6.3.6 Less . . . . . . . . 6.3.7 Greater . . . . . . 6.3.8 Less or equal . . . 6.3.9 Greater or equal . . 6.3.10 Absolute Values . 6.3.11 Floor . . . . . . . 6.3.12 Round . . . . . . . 6.3.13 Maximum . . . . . 6.3.14 Minimum . . . . . Integer . . . . . . . . . . . 6.4.1 Addition . . . . . 6.4.2 Subtraction . . . . 6.4.3 Multiplication . . . 6.4.4 Division . . . . . . 6.4.5 Negation . . . . . 6.4.6 Less . . . . . . . . 6.4.7 Greater . . . . . . 6.4.8 Less or equal . . . 6.4.9 Greater or equal . . 6.4.10 Absolute Values . 6.4.11 Euclidean division 6.4.12 Modulo . . . . . . 6.4.13 Maximum . . . . . 6.4.14 Minimum . . . . . Collection . . . . . . . . . 6.5.1 Size . . . . . . . . 6.5.2 Count . . . . . . . 6.5.3 Includes . . . . . . 6.5.4 Excludes . . . . . 6.5.5 Includes all . . . . 6.5.6 Excludes all . . . . 6.5.7 Is empty . . . . . . 6.5.8 Not empty . . . . 6.5.9 Sum . . . . . . . . Set . . . . . . . . . . . . . 6.6.1 Set-Equality . . . 6.6.2 Including elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 83 83 83 83 83 83 84 84 84 84 84 84 84 85 85 85 85 85 85 85 85 85 86 86 86 86 86 86 86 87 87 87 87 87 87 87 87 88 88 88 88 88 88 6

[close]

p. 7

6.7 6.8 6.6.3 Excluding elements . 6.6.4 Union . . . . . . . . 6.6.5 Union with Bag . . . 6.6.6 Intersection . . . . . 6.6.7 Intersection with Bag 6.6.8 Difference of sets . . 6.6.9 Flatten . . . . . . . 6.6.10 As Bag . . . . . . . 6.6.11 As Sequence . . . . Bag . . . . . . . . . . . . . 6.7.1 Equality . . . . . . . 6.7.2 Including elements . 6.7.3 Excluding elements . 6.7.4 Union . . . . . . . . 6.7.5 Union with Set . . . 6.7.6 Intersection . . . . . 6.7.7 Intersection with Set 6.7.8 Flatten . . . . . . . 6.7.9 As Set . . . . . . . . 6.7.10 As Sequence . . . . Sequence . . . . . . . . . . 6.8.1 Get element . . . . . 6.8.2 Equality . . . . . . . 6.8.3 Union . . . . . . . . 6.8.4 Flatten . . . . . . . 6.8.5 Append elements . . 6.8.6 Prepend elements . . 6.8.7 Excluding elements . 6.8.8 Subsequence . . . . 6.8.9 Get first element . . 6.8.10 Get last element . . . 6.8.11 As Set . . . . . . . . 6.8.12 As Bag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 88 88 89 89 89 89 89 89 89 89 90 90 90 90 90 90 90 90 91 91 91 91 91 91 91 91 92 92 92 92 92 92 7

[close]

p. 8

List of Figures 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 4.12 Overview of the Specification Workflow . . . . . . . . . . . . . . . Graphical User Interface after starting USE with the Cars Example . Expanded tree with all model elements . . . . . . . . . . . . . . . . Main window with four different views . . . . . . . . . . . . . . . . Constraint failed . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation of the violated invariant . . . . . . . . . . . . . . . . . . Evaluating a simple select expression . . . . . . . . . . . . . . . . Evaluating a more complex expression . . . . . . . . . . . . . . . . Class diagram of the Employees, Departments and Projects example Class diagram of the Person & Company example . . . . . . . . . . Class diagram of the Graph example . . . . . . . . . . . . . . . . . Class diagram of factorial example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 12 13 14 14 15 15 16 17 17 18 18 30 31 32 34 35 36 37 39 41 44 45 49 50 50 51 51 52 52 53 54 55 55 55 Create object dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Main window with views after creating a new object . . . . . . . . . . . . Object Properties View . . . . . . . . . . . . . . . . . . . . . . . . . . . . Main window after creating the objects and inserting the links . . . . . . . Main window after reading in the whole Demo.cmd file . . . . . . . . . . . Evaluation Browser showing the violated constraint . . . . . . . . . . . . . Object diagram of the Person & Company example . . . . . . . . . . . . . Object diagram of the Person & Company example after changing the state Sequence diagram of the Person & Company example . . . . . . . . . . . . Sequence diagram of the Graph example . . . . . . . . . . . . . . . . . . . Sequence diagram of the factorial example . . . . . . . . . . . . . . . . . . Main window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Overview of the Specification . . . . . . . . . . . . . . . . . . . . . . . Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Definition of the specification elements . . . . . . . . . . . . . . . . . Log window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Status and tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Class Diagram View (Employees, Departments and Projects Example) . Class Diagram View - Context Menu with Hide, Crop, and Show . . . . Object Diagram View (Employees, Departments and Projects Example) Object Diagram View (Employees, Departments and Projects Example) Class Invariant View (Employees, Departments and Projects Example) . Object Count View (Employees, Departments and Projects Example) . . . . . . . . . . . . . . . . . . . . . . . . . . 8

[close]

p. 9

4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.20 4.21 4.22 4.23 4.24 4.25 4.26 4.27 4.28 4.29 4.30 4.31 4.32 4.33 4.34 4.35 4.36 4.37 4.38 4.39 4.40 4.41 4.42 Link Count View (Employees, Departments and Projects Example) . . . . . . . State Evolution View (Employees, Departments and Projects Example) . . . . . Object Properties View (Employees, Departments and Projects Example) . . . Class Extend View (Employees, Departments and Projects Example) . . . . . . Sequence Diagram View (Graph Example) . . . . . . . . . . . . . . . . . . . . Choose Commands (Graph Example) . . . . . . . . . . . . . . . . . . . . . . Properties - Diagram (Graph Example) . . . . . . . . . . . . . . . . . . . . . . Properties - Lifelines (Graph Example) . . . . . . . . . . . . . . . . . . . . . . Properties - Object Box (Graph Example) . . . . . . . . . . . . . . . . . . . . Call Stack View (Factorial Example) . . . . . . . . . . . . . . . . . . . . . . . Command List View (Factorial Example) . . . . . . . . . . . . . . . . . . . . Evaluation Browser (Employees, Departments and Projects Example) . . . . . Menu - Extended Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . Menu - Tree Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Late Variable Assignment (Employees, Departments and Projects Example) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Early Variable Assignment (Employees, Departments and Projects Example) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Variable Assignment & Substitution (Employees, Departments and Projects Example) . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Variable Substitution (Employees, Departments and Projects Example) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - No Variable Assignment (Employees, Departments and Projects Example) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Menu - True False Highlighting . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Term Highlighting (Employees, Departments and Projects Example) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Subtree Highlighting (Employees, Departments and Projects Example) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Complete Subtree Highlighting (Employees, Departments and Projects Example) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Set as Default . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Expand . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Collapse . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Tree Display Menu and Close button . . . . . . . . . . . Evaluation Browser - Title . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Object Browser . . . . . . . . . . . . . . . . . . . . . . Evaluation Browser - Object Browser with Dropdown menu . . . . . . . . . . 56 56 56 56 57 58 58 59 60 61 61 62 62 63 64 65 66 67 68 68 69 69 70 70 70 70 71 71 71 71 9

[close]

p. 10

1 Introduction to USE USE is a system for the specification of information systems. It is based on a subset of the Unified Modeling Language (UML) [Obj99]. 1.1 Overview of USE Features A USE specification contains a textual description of a model using features found in UML class diagrams (classes, associations, etc.). Expressions written in the Object Constraint Language (OCL) are used to specify additional integrity constraints on the model. A model can be animated to validate the specification against non-formal requirements. System states (snapshots of a running system) can be created and manipulated during an animation. For each snapshot the OCL constraints are automatically checked. Information about a system state is given by graphical views. OCL expressions can be entered and evaluated to query detailed information about a system state. 1.2 Working with USE This section outlines the general workflow for the specification and validation of a UML model. Figure 1.1 gives a general view of the USE approach. Within this section we use an example model specifying the class Car including an attribute mileage of type Integer and an operation increaseMileage with one formal parameter an no return value. Figure 1.1: Overview of the Specification Workflow 10

[close]

p. 11

1.2.1 Specifying a UML Model The USE tool expects a textual description of a model and its constraints as input. (see section 2) The example must therefore be translated into a USE specification1 by using an external text editor. The USE specification of the example model is shown below. model Cars class Car attributes mileage : Integer operations increaseMileage(kilometers : Integer) end 1.2.2 Running USE The following command can be used to invoke USE on the example specification.2 use ../examples/Documentation/Cars/Cars.use This command will compile and check the file Cars.use. There are currently two kinds of user interfaces which can be used simultaneously. The first one is a command line interface where you enter commands at a prompt. The output should be similar to the following. loading properties from: /home/opti/use/etc/use.properties loading properties from: /home/opti/.userc use version 2.3.1, Copyright (C) 1999-2006 University of Bremen compiling specification... Model Cars (1 class, 0 associations, 0 invariants, 1 operation, 0 pre-/postconditions) Enter ‘help’ for a list of available commands. use> To start USE without loading a specification use the command use. 1.2.3 USE Shell - The Command Line Interface After loading a specification you can enter commands at the prompt. 3 For example, you can enter OCL expressions by starting the input with a question mark. The expression will be evaluated and its result will be shown, e.g.: use> ? Set{1,2,3}->select(e | e > 1) -> Set{2,3} : Set(Integer) A possible extension to USE would be the import of an XMI file created by a CASE tool like Argo UML4 or Rational Rose 2 Assuming the current working directory is the top-level directory of the distribution and the bin directory is added to your PATH environment variable. 3 Try ’help’ for a list of available commands. 1 11

[close]

p. 12

The command line interface is useful for experienced users and for automated validation procedures since commands can be read from a script file. The graphical user interface is easier to learn and provides different ways of visualizing a system state. By default both interfaces are launched. 1 1.2.4 Graphical User Interface The window that appears after starting USE can be seen in the screen shot in figure 1.2. On the left is a tree view showing the contents (classes, associations, invariants, and pre- and postconditions) of the model. Figure 1.2: Graphical User Interface after starting USE with the Cars Example The next figure 1.3 shows the expanded tree with all model elements. The invariant is selected and its definition is shown in the panel below the tree. The large area on the right is a workspace where you can open views visualizing different aspects of a system. Views can be created any time by choosing an entry from the view menu or directly by a toolbar button. There is no limit on active views. The next screenshot shown in 1 Unless you specify the switch -nogui at startup time. 12

[close]

p. 13

Figure 1.3: Expanded tree with all model elements figure 1.4 displays the main window after the creation of four views. The two lower views list the names of classes and associations defined in the model and show the number of objects and links in the current system state. The initial system state is empty, i.e., there are no objects and links yet. The view at the upper right displays a list of OCL invariants and their results. As you can see, all invariants are true in the empty system state. Finally, the upper left view will show an object diagram once we have created objects and links. 1.2.5 Creating Objects and Setting Attributes Now you can create and destroy objects of type Car and set their attributes. More complex specifications allow more commands to manipulate the system state. (see section 5.1). We create two objects smallCar and bigCar and set their mileage to 2000 resp. −1500 kilometers. The commands are shown below. They can be entered step by step or by reading in a command file. To read in the corresponding command file use the following USE command: open ../examples/Documentation/Cars/Cars.cmd !create smallCar : Car !create bigCar : Car 13

[close]

p. 14

Figure 1.4: Main window with four different views !set smallCar.mileage := 2000 !set bigCar.mileage := -1500 1.2.6 Checking OCL Invariants After creating the system state the Class Invariant View shows that MileageNotNegative is violated. (see figure 1.5) Figure 1.5: Constraint failed To get more information you can double click on the failed invariant. This opens the Evaluation Browser showing the evaluation of the marked invariant. In figure 1.6 you can see, that object 14

[close]

p. 15

bigCar violates the invariant because its mileage is a negative number. Figure 1.6: Evaluation of the violated invariant 1.2.7 Evaluating OCL Expressions The OCL parser and interpreter of USE allows the evaluation of arbitrary OCL expressions. The menu item State|Evaluate OCL expression opens a dialog where expressions can be entered and evaluated (see figure 1.7). Figure 1.7: Evaluating a simple select expression The example in figure 1.8 shows a more complex expression with allInstances and the collection operations select, collect and exists. 15

[close]

Comments

no comments yet