<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=OCUP2F_03_OCL</id>
	<title>OCUP2F 03 OCL - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=OCUP2F_03_OCL"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=OCUP2F_03_OCL&amp;action=history"/>
	<updated>2026-04-21T09:06:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=OCUP2F_03_OCL&amp;diff=26715&amp;oldid=prev</id>
		<title>Bernard Szlachta: Bernard Szlachta moved page OCUP2A 03 OCL to OCUP2F 03 OCL</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=OCUP2F_03_OCL&amp;diff=26715&amp;oldid=prev"/>
		<updated>2015-07-08T04:42:32Z</updated>

		<summary type="html">&lt;p&gt;Bernard Szlachta moved page &lt;a href=&quot;/training/OCUP2A_03_OCL&quot; class=&quot;mw-redirect&quot; title=&quot;OCUP2A 03 OCL&quot;&gt;OCUP2A 03 OCL&lt;/a&gt; to &lt;a href=&quot;/training/OCUP2F_03_OCL&quot; title=&quot;OCUP2F 03 OCL&quot;&gt;OCUP2F 03 OCL&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Private]]&lt;br /&gt;
{{Cat|OCUP2}}&lt;br /&gt;
==Module 3. Object Constraint Language⌘==&lt;br /&gt;
===References⌘===&lt;br /&gt;
* OCL Specification Document (Version 2.0 or 2.2; Chapter 7 – All) http://www.omg.org/spec/OCL/&lt;br /&gt;
===Object Constraint Language (OCL)⌘===&lt;br /&gt;
* OMG Specification&lt;br /&gt;
* Object Constraint Language (OCL), a formal language used to describe expressions on UML models&lt;br /&gt;
===Why OCL?⌘===&lt;br /&gt;
* A UML diagram is typically not refined enough to provide all the relevant aspects of a specification. &lt;br /&gt;
* There is a need to describe additional constraints about the objects in the model. &lt;br /&gt;
* Such constraints are often described in natural language. Practice has shown that this will always result in ambiguities.&lt;br /&gt;
* OCL is a formal language that has been developed to fill this gap.&lt;br /&gt;
* OCL expressions do not have side effects (i.e., their evaluation cannot alter the state of the corresponding system).&lt;br /&gt;
&lt;br /&gt;
===Class Diagram Example⌘===&lt;br /&gt;
[[File:ClipCapIt-141201-120201.PNG]]&lt;br /&gt;
====Context⌘====&lt;br /&gt;
Context of an OCL expression within a UML model can be specified through:&lt;br /&gt;
* context declaration:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;objc&amp;quot;&amp;gt;&lt;br /&gt;
context Company&lt;br /&gt;
  self.numberOfEmployees &amp;gt; 50&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
* in a diagram, with dashed lines to connect it to its contextual element&lt;br /&gt;
[[File:ClipCapIt-141201-123904.PNG]]&lt;br /&gt;
&lt;br /&gt;
====Invariants⌘====&lt;br /&gt;
* Invariant is OCL expression that must be true for all instances of a classifier at any time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;objc&amp;quot;&amp;gt;&lt;br /&gt;
context Company inv:&lt;br /&gt;
  self.numberOfEmployees &amp;gt; 50&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Pre- and Postconditions⌘====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;objc&amp;quot;&amp;gt;&lt;br /&gt;
context Typename::operationName(param1 : Type1, ... ): ReturnType&lt;br /&gt;
  pre : param1 &amp;gt; ...&lt;br /&gt;
  post: result = ...&lt;br /&gt;
&lt;br /&gt;
context Company inv:&lt;br /&gt;
  self.numberOfEmployees &amp;gt; 50&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Invariants⌘====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;objc&amp;quot;&amp;gt;&lt;br /&gt;
context Company inv:&lt;br /&gt;
  self.numberOfEmployees &amp;gt; 50&lt;br /&gt;
&lt;br /&gt;
context Company inv enoughEmployees:&lt;br /&gt;
  self.numberOfEmployees &amp;gt; 50&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Invariants⌘====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;objc&amp;quot;&amp;gt;&lt;br /&gt;
context Company inv:&lt;br /&gt;
  self.numberOfEmployees &amp;gt; 50&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
====Invariants⌘====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;objc&amp;quot;&amp;gt;&lt;br /&gt;
context Company inv:&lt;br /&gt;
  self.numberOfEmployees &amp;gt; 50&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic OCL types⌘===&lt;br /&gt;
[[File:ClipCapIt-141201-122157.PNG]]&lt;/div&gt;</summary>
		<author><name>Bernard Szlachta</name></author>
	</entry>
</feed>