2.11. OCL in UML (Using Papyrus)
Total Page:16
File Type:pdf, Size:1020Kb
OCL Documentation OCL Documentation Christian Damus, Adolfo Sánchez-Barbudo Herrera, Axel Uhl, Edward Willink and contributors Copyright 2002 - 2014 Eclipse OCL 5.0 1 1. Overview and Getting Started ....................................................................................... 1 1.1. What is OCL? .................................................................................................... 1 1.2. How Does It Work? ............................................................................................ 1 1.2.1. Editing ................................................................................................... 1 1.2.2. Execution ................................................................................................ 1 1.2.3. Debugging .............................................................................................. 2 1.2.4. Testing ................................................................................................... 2 1.3. Eclipse OCL is Extensible .................................................................................... 2 1.4. Who Uses OCL and Eclipse OCL? ........................................................................ 2 1.5. Who is Behind Eclipse OCL? ............................................................................... 3 1.6. Getting Started ................................................................................................... 3 2. Users Guide ................................................................................................................ 5 2.1. The two Eclipse OCLs ......................................................................................... 5 2.1.1. The Classic Eclipse OCL metamodels .......................................................... 5 2.1.2. The Unified or Pivot Eclipse OCL metamodel ............................................... 5 2.1.3. The transition .......................................................................................... 6 2.1.4. APIs ...................................................................................................... 7 2.2. The Essential OCL Language ................................................................................ 7 2.2.1. Syntax .................................................................................................... 7 2.3. The OCLinEcore Language ................................................................................. 17 2.3.1. Syntax .................................................................................................. 17 2.3.2. Limitations ............................................................................................ 29 2.4. The Complete OCL Language ............................................................................. 29 2.4.1. Syntax .................................................................................................. 29 2.5. The OCL Standard Library Language ................................................................... 35 2.5.1. Syntax .................................................................................................. 35 2.6. Editors ............................................................................................................ 39 2.6.1. Syntax coloring ...................................................................................... 40 2.6.2. Validation ............................................................................................. 40 2.6.3. Hover Text ............................................................................................ 40 2.6.4. Content Assist ........................................................................................ 40 2.6.5. Code Templates ...................................................................................... 41 2.6.6. Open Declaration .................................................................................... 41 2.7. Console ........................................................................................................... 41 2.7.1. Context Object Selection .......................................................................... 41 2.7.2. Editing .................................................................................................. 42 2.7.3. Editor Keys ........................................................................................... 42 2.7.4. Results .................................................................................................. 42 2.7.5. Tool Bar ............................................................................................... 42 2.8. Validity View (new in Luna) ............................................................................... 43 2.8.1. View Tool Bar ....................................................................................... 43 2.8.2. Model Elements Pane .............................................................................. 44 2.8.3. Metamodel Constraints Pane ..................................................................... 46 2.8.4. Constraint Locators ................................................................................. 47 2.9. Debugger (new in Luna) ..................................................................................... 48 2.9.1. Launching ............................................................................................. 48 2.9.2. Stepping ................................................................................................ 50 2.9.3. Variables View ....................................................................................... 51 2.9.4. Breakpoints View ................................................................................... 51 2.9.5. Outline View ......................................................................................... 51 2.10. OCL Integration .............................................................................................. 51 2.10.1. OCL execution in Ecore / EMF Delegates .................................................. 51 2.10.2. Custom Validation Messages ................................................................... 51 2.10.3. CompleteOCL Validation ....................................................................... 52 2.10.4. OCLinEcore for Xtext Validation ............................................................. 53 2.10.5. Complete OCL for Xtext Validation ......................................................... 53 2.11. OCL in UML (using Papyrus) ........................................................................... 53 2.11.1. UML Integration ................................................................................... 53 Eclipse OCL 5.0 ii OCL Documentation 2.11.2. Class Diagram ...................................................................................... 54 2.11.3. State Machine Diagram .......................................................................... 58 2.12. User Interface ................................................................................................. 59 2.12.1. Project Property Pages ........................................................................... 59 2.12.2. Workspace Preference Pages ................................................................... 59 2.12.3. Overall Options .................................................................................... 60 2.12.4. Ecore and UML Options ........................................................................ 61 2.12.5. UML Options ....................................................................................... 62 2.12.6. Model Registry ..................................................................................... 62 2.12.7. Syntax Coloring .................................................................................... 62 2.12.8. Editor Templates ................................................................................... 62 2.12.9. OCLinEcore Options ............................................................................. 63 3. The OCL Standard Library ........................................................................................ 64 3.1. Precedences .................................................................................................... 64 3.2. Bag(T) ....................................................................................................... 64 3.3. Boolean ..................................................................................................... 65 3.4. Class ........................................................................................................ 66 3.5. Collection(T) ......................................................................................... 66 3.6. Enumeration ............................................................................................. 69 3.7. EnumerationLiteral ............................................................................... 69 3.8. Integer ..................................................................................................... 69 3.9. Metaclass(T) ........................................................................................... 70 3.10. OclAny ..................................................................................................... 70 3.11. OclComparable ....................................................................................... 71 3.12. OclElement ............................................................................................