ISO IEC 19507-2012 Information technology - Object Management Group Object Constraint Language (OCL)《信息技术 对象管理组织对象约束语言 (OCL)》.pdf

上传人:brainfellow396 文档编号:1256995 上传时间:2019-09-02 格式:PDF 页数:244 大小:3.99MB
下载 相关 举报
ISO IEC 19507-2012 Information technology - Object Management Group Object Constraint Language (OCL)《信息技术 对象管理组织对象约束语言 (OCL)》.pdf_第1页
第1页 / 共244页
ISO IEC 19507-2012 Information technology - Object Management Group Object Constraint Language (OCL)《信息技术 对象管理组织对象约束语言 (OCL)》.pdf_第2页
第2页 / 共244页
ISO IEC 19507-2012 Information technology - Object Management Group Object Constraint Language (OCL)《信息技术 对象管理组织对象约束语言 (OCL)》.pdf_第3页
第3页 / 共244页
ISO IEC 19507-2012 Information technology - Object Management Group Object Constraint Language (OCL)《信息技术 对象管理组织对象约束语言 (OCL)》.pdf_第4页
第4页 / 共244页
ISO IEC 19507-2012 Information technology - Object Management Group Object Constraint Language (OCL)《信息技术 对象管理组织对象约束语言 (OCL)》.pdf_第5页
第5页 / 共244页
点击查看更多>>
资源描述

1、 Reference number ISO/IEC 19507:2012(E) ISO/IEC 2012INTERNATIONAL STANDARD ISO/IEC 19507 First edition 2012-04-15 Information technology Object Management Group Object Constraint Language (OCL) Technologies de linformation Langage de contraintes orient-objet (OCL) de lOMG ISO/IEC 19507:2012(E) COPYR

2、IGHT PROTECTED DOCUMENT ISO/IEC 2012 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address be

3、low or ISOs member body in the country of the requester. ISO copyright office Case postale 56 CH-1211 Geneva 20 Tel. + 41 22 749 01 11 Fax + 41 22 749 09 47 E-mail copyrightiso.org Web www.iso.org Published in Switzerland ii ISO/IEC 2012 All rights reservedISO/IEC 19507:2012(E) ISO/IEC 2012 - All ri

4、ghts reserved iii Table of ContentsForeword . ixIntroduction . x 1 Scope . 1 2 Conformance 1 3 References . 2 3.1 Normative References .2 3.2 Informative References 2 4 Terms and Definitions 3 5 Notational Conventions 3 6 Additional Information 3 6.1 Changes to Adopted OMG Specifications 3 6.2 Struc

5、ture of the Specification .3 6.3 Acknowledgements 4 7 OCL Language Description 5 7.1 General 5 7.2 Why OCL? 57.2.1 Where to Use OCL 5 7.3 Introduction 67.3.1 Legend . 67.3.2 Example Class Diagram . 67.3.3 Character Set . 7 7.4 Relation to the UML Metamodel .77.4.1 Self . 77.4.2 Specifying the UML Co

6、ntext 77.4.3 Invariants . 87.4.4 Pre- and Postconditions . 87.4.5 Package Context . 97.4.6 Operation Body Expression . 97.4.7 Initial and Derived Values 97.4.8 Other Types of Expressions 10 7.5 Basic Values and Types .107.5.1 Types from the UML Model . 117.5.2 Enumeration Types 117.5.3 Let Expressio

7、ns . 117.5.4 Additional operations/attributes through definition expressions . 127.5.5 Type Conformance 12ISO/IEC 19507:2012(E) iv ISO/IEC 2012 - All rights reserved7.5.6 Re-typing or Casting 137.5.7 Precedence Rules 147.5.8 Use of Infix Operators 147.5.9 Keywords . 157.5.10 Comment . 167.5.11 Inval

8、id Values . 16 7.6 Objects and Properties .167.6.1 Properties: Attributes . 177.6.2 Properties: Operations . 177.6.3 Properties: AssociationEnds and Navigation 187.6.4 Navigation to Association Classes . 207.6.5 Navigation from Association Classes . 217.6.6 Navigation through Qualified Associations

9、217.6.7 Using Pathnames for Packages . 217.6.8 Accessing overridden properties of supertypes . 227.6.9 Predefined properties on All Objects . 227.6.10 Features on Classes Themselves 237.6.11 Collections . 247.6.12 Collections of Collections . 257.6.13 Collection Type Hierarchy and Type Conformance R

10、ules . 257.6.14 Previous Values in Postconditions . 257.6.15 Tuples 26 7.7 Collection Operations .277.7.1 Select and Reject Operations 277.7.2 Collect Operation . 287.7.3 ForAll Operation . 297.7.4 Exists Operation . 307.7.5 Closure Operation 307.7.6 Iterate Operation 31 7.8 Messages in OCL .327.8.1

11、 Calling operations and sending signals . 327.8.2 Accessing result values . 337.8.3 An example 33 7.9 Resolving Properties 34 8 Abstract Syntax 35 8.1 Introduction .35 8.2 The Types Package .358.2.1 Type Conformance 388.2.2 Operations and Well-formedness Rules for the Types Package . 40 8.3 The Expr

12、essions Package 428.3.1 Expressions Core . 438.3.2 FeatureCall Expressions 458.3.3 If Expressions 478.3.4 Message Expressions 48 8.4 Literal Expressions .498.4.1 Let Expressions . 528.4.2 Well-formedness Rules of the Expressions package . 538.4.3 Additional Operations on UML metaclasses 60ISO/IEC 19

13、507:2012(E) ISO/IEC 2012 - All rights reserved v 8.4.4 Additional Operations on OCL Metaclasses 628.4.5 Overview of class hierarchy of OCL Abstract Syntax metamodel . 64 9 Concrete Syntax . 65 9.1 General 65 9.2 Structure of the Concrete Syntax .65 9.3 A Note to Tool Builders 679.3.1 Parsing .679.3.

14、2 Visibility 67 9.4 Concrete Syntax .679.4.1 ExpressionInOclCS 689.4.2 OclExpressionCS . 689.4.3 VariableExpCS 699.4.4 simpleNameCS 699.4.5 restrictedKeywordCS . 709.4.6 unreservedSimpleNameCS . 719.4.7 pathNameCS . 719.4.8 LiteralExpCS 729.4.9 EnumLiteralExpCS 729.4.10 CollectionLiteralExpCS 739.4.

15、11 CollectionTypeIdentifierCS 739.4.12 CollectionLiteralPartsCS 749.4.13 CollectionLiteralPartCS 749.4.14 CollectionRangeCS . 749.4.15 PrimitiveLiteralExpCS 759.4.16 TupleLiteralExpCS . 769.4.17 UnlimitedNaturalLiteralExpCS . 769.4.18 IntegerLiteralExpCS . 769.4.19 RealLiteralExpCS 779.4.20 StringLi

16、teralExpCS 779.4.21 BooleanLiteralExpCS . 789.4.22 TypeLiteralExpCS 789.4.23 CallExpCS . 799.4.24 LoopExpCS 799.4.25 IteratorExpCS 809.4.26 IterateExpCS . 839.4.27 VariableDeclarationCS 849.4.28 TypeCS 859.4.29 primitiveTypeCS 859.4.30 oclTypeCS . 869.4.31 collectionTypeCS . 869.4.32 tupleTypeCS 879

17、.4.33 variableDeclarationListCS . 879.4.34 FeatureCallExpCS . 889.4.35 OperationCallExpCS 889.4.36 PropertyCallExpCS 919.4.37 NavigationCallExpCS 939.4.38 AssociationClassCallExpCS 939.4.39 isMarkedPreCS 949.4.40 argumentsCS . 94ISO/IEC 19507:2012(E) vi ISO/IEC 2012 - All rights reserved9.4.41 LetEx

18、pCS . 959.4.42 LetExpSubCS 959.4.43 OclMessageExpCS 969.4.44 OclMessageArgumentsCS . 979.4.45 OclMessageArgCS 979.4.46 IfExpCS 989.4.47 NullLiteralExpCS 989.4.48 InvalidLiteralExpCS 999.4.49 Comments 99 9.5 Environment Definition .999.5.1 Environment . 999.5.2 NamedElement 1029.5.3 Namespace 102 9.6

19、 Concrete to Abstract Syntax Mapping 102 9.7 Abstract Syntax to Concrete Syntax Mapping 103 10 Semantics Described Using UML 105 10.1 Introduction .105 10.2 The Values Package 10610.2.1 Definitions of Concepts for the Values Package 10710.2.2 Well-formedness Rules for the Values Package 11110.2.3 Ad

20、ditional Operations for the Values Package 11310.2.4 Overview of the Values Package . 114 10.3 The Evaluations Package .11510.3.1 Definitions of Concepts for the Evaluations Package 11610.3.2 Well-formedness Rules of the Evaluations Package . 12510.3.3 Additional Operations of the Evaluations Packag

21、e 13210.3.4 Overview of the Values Package . 133 10.4 The AS-Domain-Mapping Package 13410.4.1 Well-formedness rules for the AS-Domain-Mapping.type-value Package . 13510.4.2 Additional Operations for the AS-Domain-Mapping.type-value Package 13710.4.3 Well-formedness rules for the AS-Domain-Mapping.ex

22、p-eval Package 137 11 OCL Standard Library 145 11.1 Introduction .145 11.2 The OclAny, OclVoid, OclInvalid, and OclMessage Types 14611.2.1 OclAny . 14611.2.2 OclMessage . 14611.2.3 OclVoid 14611.2.4 OclInvalid . 146 11.3 Operations and Well-formedness Rules .14611.3.1 OclAny . 14611.3.2 OclVoid 1481

23、1.3.3 OclMessage . 148 11.4 Primitive Types .14811.4.1 Real 14811.4.2 Integer 14811.4.3 String 149ISO/IEC 19507:2012(E) ISO/IEC 2012 - All rights reserved vii 11.4.4 Boolean 14911.4.5 UnlimitedNatural 149 11.5 Operations and Well-formedness Rules 14911.5.1 Real . 14911.5.2 Integer 15011.5.3 String .

24、 15111.5.4 Boolean 15311.5.5 UnlimitedNatural 154 11.6 Collection-Related Types .15511.6.1 Collection . 15611.6.2 Set . 15611.6.3 OrderedSet 15611.6.4 Bag 15611.6.5 Sequence . 156 11.7 Operations and Well-formedness Rules 15611.7.1 Collection . 15611.7.2 Set . 15911.7.3 OrderedSet 16111.7.4 Bag 1631

25、1.7.5 Sequence . 165 11.8 Predefined Iterator Expressions .16811.8.1 Extending the Standard Library with Iterator Expressions . 168 11.9 Mapping Rules for Predefined Iterator Expressions .16811.9.1 Collection . 16811.9.2 Set . 17011.9.3 Bag 17111.9.4 Sequence . 17211.9.5 OrderedSet 173 12 The Use of

26、 OCL Expressions in UML Models 175 12.1 Introduction 175 12.2 The ExpressionInOcl Type .17512.2.1 ExpressionInOcl . 176 12.3 Well-formedness Rules 17612.3.1 ExpressionInOcl . 176 12.4 Standard Placements of OCL Expressions 17712.4.1 How to Extend the Use of OCL at Other Places 177 12.5 Definition 17

27、712.5.1 Well-formedness Rules 177 12.6 Invariant .17812.6.1 Well-formedness rules . 178 12.7 Precondition .17912.7.1 Well-formedness rules 17912.7.2 Postcondition . 18012.7.3 Well-formedness rules . 180 12.8 Initial Value Expression 18012.8.1 Well-formedness rules . 181 12.9 Derived Value Expression

28、 182ISO/IEC 19507:2012(E) viii ISO/IEC 2012 - All rights reserved 12.10 Operation Body Expression 182 12.11 Guard .18212.11.1 Well-formedness rules . 183 12.12 Concrete Syntax of Context Declarations .18312.12.1 packageDeclarationCS 18412.12.2 contextDeclarationCS 18412.12.3 propertyContextDeclCS .

29、18412.12.4 initOrDerValueCS 18412.12.5 classifierContextDeclCS 18412.12.6 invOrDefCS 18412.12.7 defExpressionCS . 18512.12.8 operationContextDeclCS . 18512.12.9 prePostOrBodyDeclCS 18512.12.10 operationCS . 18512.12.11 parametersCS 185 13 The Basic OCL and Essential OCL 187 13.1 Introduction .187 13

30、.2 OCL Adaptation for Metamodeling .187 13.3 Diagrams 188 Annex A - Semantics193 Annex B - Bibliography.229 Annex C - Legal Information.231 ISO/IEC 19507:2012(E) ISO/IEC 2012 - All rights reserved ix Foreword ISO (the International Organization for Standardization) is a worldwide federation of natio

31、nal standards bodies (ISO member bodies). The work of preparing International Standards is normally carried out through ISO technical committees. Each member body interested in a subject for which a technical committee has been established has the right to be represented on that committee. Internati

32、onal organizations, governmental and non-governmental, in liaison with ISO, also take part in the work. ISO collaborates closely with the International Electrotechnical Commission (IEC) on all matters of electrotechnical standardization. International Standards are drafted in accordance with the rul

33、es given in the ISO/IEC Directives, Part 2. The main task of technical committees is to prepare International Standards. Draft International Standards adopted by the technical committees are circulated to the member bodies for voting. Publication as an International Standard requires approval by at

34、least 75 % of the member bodies casting a vote. Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO shall not be held responsible for identifying any or all such patent rights. ISO/IEC 19507 was prepared by Technical Committee ISO

35、/IEC JTC1, Information technology, in collaboration with the Object Management Group (OMG), following the submission and processing as a Publicly Available Specification (PAS) of the OMG Object Constraint Language specification Version 2.3.1. ISO/IEC 19507, under the general title Information techno

36、logy - Open distributed processing - Object Constraint Language specification (OCL), apart from this introductory material is identical with that for the OMG specification for Object Constraint Language, v2.3.1.ISO/IEC 19507:2012(E) x ISO/IEC 2012 - All rights reserved Introduction The rapid growth

37、of distributed processing has led to a need for a coordinating framework for this standardization and ITU-T Recommendations X.901-904 | ISO/IEC 10746, the Reference Model of Open Distributed Processing (RM-ODP) provides such a framework. It defines an architecture within which support of distributio

38、n, interoperability, and portability can be integrated. RM-ODP Part 2 (ISO/IEC 10746-2) defines the foundational concepts and modeling framework for describing distributed systems. The scopes and objectives of the RM-ODP Part 2 and the UML, while related, are not the same and, in a number of cases,

39、the RM-ODP Part 2 and the UML specification use the same term for concepts that are related but not identical (e.g., interface). Nevertheless, a specification using the Part 2 modeling concepts can be expressed using UML with appropriate extensions (using stereotypes, tags, and constraints). RM-ODP

40、Part 3 (ISO/IEC 10746-3) specifies a generic architecture of open distributed systems, expressed using the foundational concepts and framework defined in Part 2. Given the relation between UML as a modeling language and Part 2 of the RM ODP standard, it is easy to show that UML is suitable as a nota

41、tion for the individual viewpoint specifications defined by the RM-ODP. OCL Language OCL is a pure specification language; therefore, an OCL expression is guaranteed to be without side effects. When an OCL expression is evaluated, it simply returns a value. It cannot change anything in the model. Th

42、is means that the state of the system will never change because of the evaluation of an OCL expression, even though an OCL expression can be used to specify a state change (e.g., in a post-condition). OCL is not a programming language; therefore, it is not possible to write program logic or flow con

43、trol in OCL. You cannot invoke processes or activate non-query operations within OCL. Because OCL is a modeling language in the first place, OCL expressions are not by definition directly executable. OCL is a typed language so that each OCL expression has a type. To be well formed, an OCL expression

44、 must conform to the type conformance rules of the language. For example, you cannot compare an Integer with a String. Each Classifier defined within a UML model represents a distinct OCL type. In addition, OCL includes a set of supplementary predefined types. These are described in Clause 11 (“The

45、OCL Standard Library”). INTERNATIONAL STANDARD ISO/IEC 19507:2012(E) ISO/IEC 2012 - All rights reserved 1 Information technology - Object Management Group Object Constraint Language (OCL) 1S c o p e This International Standard defines the Object Constraint Language (OCL), version 2.3.1. OCL version

46、2.3.1 is the version of OCL that is aligned with UML 2.3 and MOF 2.0. 2 Conformance The UML 2.0 Infrastructure and the MOF 2.0 Core specifications that were developed in parallel with this OCL 2.3.1 specification share a common core. The OCL specification contains a well-defined and named subset of

47、OCL that is defined purely based on the common core of UML and MOF. This allows this subset of OCL to be used with both the MOF and the UML, while the full specification can be used with the UML only. The following compliance points are distinguished for both parts. 1. Syntax compliance: The tool ca

48、n read and write OCL expressions in accordance with the grammar, including validating its type conformance and conformance of well-formedness rules against a model. 2. XMI compliance: The tool can exchange OCL expressions using XMI. 3. Evaluation compliance: The tool evaluates OCL expressions in acc

49、ordance with the semantics clause. The following additional compliance points are optional for OCL evaluators, as they are dependent on the technical platform on which they are evaluated: allInstances() pre-values and oclIsNew() in postconditions OclMessage navigating across non-navigable associations accessing private and protected features of an object The following table shows the possible compliance points. Each tool is expected to fill in this table to specify which compliance p

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 标准规范 > 国际标准 > 其他

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1