CODEDRAGON ㆍDevelopment/UML
uml_2_ocl_final_adopted_specification.pdf
UML 2.0 OCL Specification
1 Scope ............................................................................................. 1
2 Conformance .................................................................................. 1
3 Normative References .................................................................... 2
4 Terms and Definitions ..................................................................... 2
5 Symbols .......................................................................................... 2
6 Additional Information ..................................................................... 2
6.1 Changes to Adopted OMG Specifications ........................................................... 2
6.2 Structure of the specification ............................................................................... 2
6.3 Acknowledgements ............................................................................................. 3
7 OCL Language Description ............................................................ 5
7.1 Why OCL? ........................................................................................................... 5
7.1.1 Where to Use OCL.................................................................................................. 5
7.2 Introduction ......................................................................................................... 6
7.2.1 Legend .................................................................................................................... 6
7.2.2 Example Class Diagram .......................................................................................... 6
7.3 Relation to the UML Metamodel .......................................................................... 7
7.3.1 Self .......................................................................................................................... 7
7.3.2 Specifying the UML context .................................................................................... 7
7.3.3 Invariants ................................................................................................................ 8
7.3.4 Pre- and Postconditions .......................................................................................... 8
7.3.5 Package Context..................................................................................................... 9
7.3.6 Operation Body Expression .................................................................................... 9
7.3.7 Initial and Derived Values ....................................................................................... 9
7.3.8 Other Types of Expressions .................................................................................. 10
7.4 Basic Values and Types .................................................................................... 10
7.4.1 Types from the UML Model ................................................................................... 11
7.4.2 Enumeration Types ............................................................................................... 11
7.4.3 Let Expressions ..................................................................................................... 11
7.4.4 Additional operations/attributes through «definition» expressions ........................ 11
7.4.5 Type Conformance ................................................................................................ 12
7.4.6 Re-typing or Casting ............................................................................................. 13
7.4.7 Precedence Rules ................................................................................................. 13
7.4.8 Use of Infix Operators ........................................................................................... 14
7.4.9 Keywords .............................................................................................................. 14
7.4.10 Comment ............................................................................................................. 14
7.5 Objects and Properties ...................................................................................... 15
7.5.1 Properties: Attributes ............................................................................................. 15
7.5.2 Properties: Operations .......................................................................................... 16
7.5.3 Properties: AssociationEnds and Navigation ....................................................... 17
ii OCL Adopted Specification
7.5.4 Navigation to Association Classes ........................................................................ 18
7.5.5 Navigation from Association Classes .................................................................... 19
7.5.6 Navigation through Qualified Associations ............................................................ 20
7.5.7 Using Pathnames for Packages ............................................................................ 20
7.5.8 Accessing overridden properties of supertypes .................................................... 20
7.5.9 Predefined properties on All Objects ..................................................................... 21
7.5.10 Features on Classes Themselves ....................................................................... 22
7.5.11 Collections ...........................................................................................................22
7.5.12 Collections of Collections .................................................................................... 23
7.5.13 Collection Type Hierarchy and Type Conformance Rules .................................. 23
7.5.14 Previous Values in Postconditions ...................................................................... 24
7.5.15 Tuples .................................................................................................................25
7.6 Collection Operations ........................................................................................ 25
7.6.1 Select and Reject Operations ............................................................................... 25
7.6.2 Collect Operation .................................................................................................. 27
7.6.3 ForAll Operation .................................................................................................... 28
7.6.4 Exists Operation .................................................................................................... 28
7.6.5 Iterate Operation ................................................................................................... 29
7.7 Messages in OCL .............................................................................................. 29
7.7.1 Calling operations and sending signals ................................................................. 29
7.7.2 Accessing result values ......................................................................................... 30
7.7.3 An example ........................................................................................................... 31
7.8 Resolving Properties ......................................................................................... 32
8 Abstract Syntax ............................................................................ 33
8.1 Introduction ........................................................................................................ 33
8.2 The Types Package .......................................................................................... 33
8.2.1 Type Conformance ................................................................................................ 35
8.2.2 Well-formedness Rules for the Types Package .................................................... 38
8.3 The Expressions Package ................................................................................. 40
8.3.1 Expressions Core.................................................................................................. 40
8.3.2 Model PropertyCall Expressions ........................................................................... 44
8.3.3 If Expressions ........................................................................................................ 46
8.3.4 Message Expressions ........................................................................................... 46
8.3.5 Literal Expressions ................................................................................................ 48
8.3.6 Let expressions ..................................................................................................... 50
8.3.7 Well-formedness Rules ofthe Expressions package ............................................ 51
8.3.8 Additional Operations on UML metaclasses ......................................................... 56
8.3.9 Additional Operations on OCL metaclasses ......................................................... 58
8.3.10 Overview of class hierarchy of OCL Abstract Syntax metamodel ....................... 60
9 Concrete Syntax ........................................................................... 61
9.1 Structure of the Concrete Syntax ...................................................................... 61
9.2 A Note to Tool Builders ..................................................................................... 63
9.2.1 Parsing .................................................................................................................. 63
9.2.2 Visibility ................................................................................................................. 63
9.3 Concrete Syntax ................................................................................................ 63
9.3.1 Comments ............................................................................................................. 89
9.3.2 Operator Precedence ............................................................................................ 89
9.4 Environment definition ....................................................................................... 89
OCL Adopted Specification iii
9.4.1 Environment .......................................................................................................... 89
9.4.2 NamedElement ..................................................................................................... 91
9.4.3 Namespace ........................................................................................................... 92
9.5 Concrete to Abstract Syntax Mapping ............................................................... 92
9.6 Abstract Syntax to Concrete Syntax Mapping ................................................... 92
10Semantics Described using UML ................................................. 93
10.1 Introduction ..................................................................................................... 93
10.2 The Values Package ....................................................................................... 94
10.2.1 Definitions of concepts for the Values package ................................................... 95
10.2.2 Well-formedness rules for the Values Package .................................................. 99
10.2.3 Additional operations for the Values Package .................................................. 100
10.2.4 Overview of the Values package ....................................................................... 101
10.3 The Evaluations Package ............................................................................. 102
10.3.1 Definitions of concepts for the Evaluations package ......................................... 103
10.3.2 Model PropertyCall Evaluations ........................................................................ 106
10.3.3 If Expression Evaluations .................................................................................. 107
10.3.4 Ocl Message Expression Evaluations ............................................................... 108
10.3.5 Literal Expression Evaluations .......................................................................... 109
10.3.6 Let expressions ................................................................................................. 111
10.3.7 Well-formedness Rules of the Evaluations package ......................................... 112
10.3.8 Overview of the Values package ....................................................................... 119
10.4 The AS-Domain-Mapping Package ............................................................... 120
10.4.1 Well-formedness rules for the AS-Domain-Mapping.type-value Package ........ 123
10.4.2 Additional operations for the AS-Domain-Mapping.type-value Package .......... 124
10.4.3 Well-formedness rules for the AS-Domain-Mapping.exp-eval Package ........... 124
11The OCL Standard Library ......................................................... 131
11.1 Introduction ................................................................................................... 131
11.2 The OclAny, OclVoid, andOclMessage types .............................................. 131
11.2.1 OclAny .............................................................................................................. 131
11.2.2 OclMessage ...................................................................................................... 132
11.2.3 OclVoid ............................................................................................................. 133
11.2.4 Operations and well-formedness rules .............................................................. 133
11.2.5 OclMessage ...................................................................................................... 134
11.2.6 OclVoid ............................................................................................................. 134
11.3 ModelElement types ...................................................................................... 134
11.3.1 OclModelElement .............................................................................................. 135
11.3.2 OclType ............................................................................................................. 135
11.3.3 OclState ............................................................................................................ 135
11.3.4 Operations and well-formedness rules .............................................................. 135
11.4 Primitive Types .............................................................................................. 136
11.4.1 Real ...................................................................................................................136
11.4.2 Integer ...............................................................................................................136
11.4.3 String .................................................................................................................136
11.4.4 Boolean ............................................................................................................. 136
11.5 Operations and well-formedness rules .......................................................... 136
11.5.1 Real ...................................................................................................................136
11.5.2 Integer ...............................................................................................................137
iv OCL Adopted Specification
11.5.3 String ................................................................................................................. 138
11.5.4 Boolean ............................................................................................................. 139
11.6 Collection-Related Types .............................................................................. 139
11.6.1 Collection .......................................................................................................... 140
11.6.2 Set ..................................................................................................................... 140
11.6.3 OrderedSet ........................................................................................................ 140
11.6.4 Bag .................................................................................................................... 140
11.6.5 Sequence .......................................................................................................... 140
11.7 Operations and well-formedness rules .......................................................... 140
11.7.1 Collection .......................................................................................................... 140
11.7.2 Set ..................................................................................................................... 141
11.7.3 OrderedSet ........................................................................................................ 143
11.7.4 Bag .................................................................................................................... 144
11.7.5 Sequence .......................................................................................................... 146
11.8 Predefined Iterator Expressions .................................................................... 149
11.8.1 Extending the standard library with iterator expressions ................................... 149
11.9 Mapping rules for predefined iterator expressions ........................................ 149
11.9.1 Collection .......................................................................................................... 149
11.9.2 Set ..................................................................................................................... 150
11.9.3 Bag .................................................................................................................... 151
11.9.4 Sequence .......................................................................................................... 152
12The Use of Ocl Expressions in UML Models .............................. 155
12.1 Introduction .................................................................................................... 155
12.1.1 UML 2.0 Alignment ............................................................................................ 155
12.2 The ExpressionInOcl Type ............................................................................ 155
12.2.1 ExpressionInOcl ................................................................................................ 156
12.3 Well-formedness rules ................................................................................... 156
12.3.1 ExpressionInOcl ................................................................................................ 156
12.4 Standard placements of OCL Expressions ................................................... 157
12.4.1 How to extend the use of OCL at other places ................................................. 157
12.5 Definition ....................................................................................................... 157
12.5.1 Well-formedness rules ...................................................................................... 157
12.6 Invariant ......................................................................................................... 158
12.6.1 Well-formedness rules ...................................................................................... 158
12.7 Precondition .................................................................................................. 158
12.7.1 Well-formedness rules ...................................................................................... 159
12.8 Postcondition ................................................................................................. 159
12.8.1 Well-formedness rules ...................................................................................... 160
12.9 Initial value expression .................................................................................. 160
12.9.1 Well-formedness rules ...................................................................................... 160
12.10 Derived value expression ............................................................................ 161
12.11 Operation body expression ......................................................................... 161
12.12 Guard .......................................................................................................... 162
12.12.1 Well-formedness rules .................................................................................... 162
12.13 Concrete Syntax of Context Declarations ................................................... 163
12.13.1 packageDeclarationCS ................................................................................... 163
12.13.2 contextDeclarationCS ..................................................................................... 163
12.13.3 attrOrAssocContextCS .................................................................................... 164
OCL Adopted Specification v
12.13.4 initOrDerValueCS ............................................................................................ 164
12.13.5 classifierContextDeclCS .................................................................................. 164
12.13.6 invOrDefCS ..................................................................................................... 164
12.13.7 defExpressionCS ............................................................................................ 164
12.13.8 operationContextDeclCS ................................................................................. 164
12.13.9 prePostOrBodyDeclCS ................................................................................... 165
12.13.10 operationCS .................................................................................................. 165
12.13.11 parametersCS ............................................................................................... 165
13Alignment of OCL, UML and MOF Metamodels ........................ 167
13.1 Introduction ................................................................................................... 167
13.2 Use of the UML Metamodel .......................................................................... 167
13.3 Use of the OCL metamodel in the UML metamodel ..................................... 168
13.4 Wishlist .......................................................................................................... 169
Appendix A - Semantics ..................................................................A-1
Appendix B - Interchange Format ....................................................B-1
Index .....................................................................................................Index-1
'Development > UML' 카테고리의 다른 글
StarUML v2.0.1-beta12 updated(2014/12/01) (0) | 2014.12.05 |
---|---|
UML Spec (0) | 2014.08.30 |
UML 2.0 Infrastructure Specification (0) | 2014.08.05 |
UML 2.0 Diagram Interchange Specification (0) | 2014.07.30 |
UML 특징 (0) | 2014.06.14 |