Turnkey session 7: Expressions
No edit summary
(Automatically adding template at the end of the page.)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<html>
<html>
<p> Session 7 - In this session we take a deeper look at OCL expressions and what you can do with them. OCL is a complete language that can act on everything that you have in your model, it has operators on objects and on collections. The ocl language is a functional language –different in approach compared to imperative languages like javascript and c#. The ocl language is optimized for querying your model. It uses a bit of set theory from your math classes. It is compact in the sense that it does a lot with short snippets. OCL is defined by ObjectManagementGroup OMG.</p>
<h4>
<p> Session 7: In this session, we take a deeper look at OCL expressions and what you can do with them. OCL is a complete language
  that can act on everything you have in your model. It has operators on objects and on collections. The OCL language
  is a functional language, different in approach compared to imperative languages like Javascript and c#. The OCL language
  is optimized for querying your model. It uses a bit of set theory from your math classes. It is compact in the sense that
  it does a lot with short snippets. OCL is defined by ObjectManagementGroup(OMG).</p>
<h4>


<p class="warn">
<p class="video-warn">
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now you can pick any topic to be instructed without watching the whole video.</em>
  <em>To make your experience smooth, we set the main tags mentioned in the video to the right bar menu of this mini-player. Choose an interesting subtitle on the list and immediately get to the exact theme navigation item place in the video. Now you can pick any topic to be instructed on without watching the whole video.</em>
<style type="text/css">
p.warn {
opacity: 0.7;
text-align: justify;
width: 90%
font-size:70%
}
</style>
</p>
</p>


<style>
<br>
#video12 {
<div class="video">
  position: relative;
   <div class="video__wrapper">
  height: 500px;
    <iframe src="https://www.youtube.com/embed/nB-Fj_iZjY0?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe>
  width:560px;
  </div>
  padding-bottom: 10px;
   <div class="video__navigation">
}
     <span class="navigation-item" data-video="nB-Fj_iZjY0" data-start="55" tabindex="0"> "all instances" expression </span>
#video12 iframe {
     <span class="navigation-item" data-video="nB-Fj_iZjY0" data-start="119" tabindex="0"> "Last" expression </span>
  position: absolute;
     <span class="navigation-item" data-video="nB-Fj_iZjY0" data-start="130" tabindex="0"> "First" </span>
  min-height: auto;
     <span class="navigation-item" data-video="nB-Fj_iZjY0" data-start="159" tabindex="0"> "Order By" </span>
  min-width: auto;
     <span class="navigation-item" data-video="nB-Fj_iZjY0" data-start="220" tabindex="0"> SubSequence </span>
}
     <span class="navigation-item" data-video="nB-Fj_iZjY0" data-start="260" tabindex="0"> Combine the expressions </span>
#video12 div {
     <span class="navigation-item" data-video="nB-Fj_iZjY0" data-start="290" tabindex="0"> Select operator </span>
  position: absolute;
     <span class="navigation-item" data-video="nB-Fj_iZjY0" data-start="340" tabindex="0"> Combine with logic expressions </span>
  top: 0;
     <span class="navigation-item" data-video="nB-Fj_iZjY0" data-start="367" tabindex="0"> Loop variable </span>
  left:760px;
  </div>
  width: 260px;
  height: 100%;
  padding-left: 10px;
  overflow-y: auto;
}
span.time {
    font-size: 18;
    display:block;
  padding: 2px 10px 2px 10px;
    padding-bottom: 0.5;
    padding-top: 0.5;
  opacity: 0.7;
}
span.time:hover {
  color: #0000FF;
  cursor: pointer;
}
span.time:focus {
   color: blue;
</style>
</br>
<div id="video12">
<iframe width="740" height="500" src="https://www.youtube.com/embed/sJAsfLoscBQ?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe>
   <div>
     <span class="time"data-video="sJAsfLoscBQ" data-start="50" tabindex="0"> "all instances" expression </span>
     <span class="time" data-video="sJAsfLoscBQ" data-start="114" tabindex="0"> "Last" expression </span>
     <span class="time" data-video="sJAsfLoscBQ" data-start="125" tabindex="0"> "First" </span>
     <span class="time" data-video="sJAsfLoscBQ" data-start="154" tabindex="0"> "Order By" </span>
     <span class="time" data-video="sJAsfLoscBQ" data-start="215" tabindex="0"> SubSequence </span>
     <span class="time" data-video="sJAsfLoscBQ" data-start="255" tabindex="0"> Combine the expressions </span>
     <span class="time" data-video="sJAsfLoscBQ" data-start="285" tabindex="0"> select operator </span>
     <span class="time" data-video="sJAsfLoscBQ" data-start="335" tabindex="0"> combine with logic expressions </span>
     <span class="time" data-video="sJAsfLoscBQ" data-start="362" tabindex="0"> loop variable </span>
</div>
</div>
</div>


<script>
var IMG = document.querySelectorAll('#video12 span'),
    IFRAME = document.querySelector('#video12 iframe');
for (var i = 0; i < IMG.length; i++) {
  IMG[i].onclick = function() {
    IFRAME.src = 'https://www.youtube.com/embed/' + this.dataset.video + '?rel=0&autoplay=1';
    if(this.dataset.end) IFRAME.src = IFRAME.src.replace(/([\s\S]*)/g, '$1&end=' + this.dataset.end);
    if(this.dataset.start) IFRAME.src = IFRAME.src.replace(/([\s\S]*)/g, '$1&start=' + this.dataset.start);
    this.style.backgroundColor='rgba(0,0,0,.2)';
  }
}
</script>
</html>
</html>
    
    
===== OCL expressions =====
=== OCL Expressions ===


To learn more about object constraint language expressions (OCL expressions) you can watch the OCL Sessions Series
To learn more about object constraint language expressions (OCL expressions) you can watch the OCL Sessions Series:
 
* [[Part 1 OCL Common Expressions]]
[[Part 1|Part 1 OCL Common Expressions]]
* [[Part 2 OCL: Operators]]
 
* [[Part 3 OCL: Derivation properties|Part 3 Derivation properties]]
[[Part 2 OCL: Derivation. Associations|Part 2 OCL: Operators]]
We use the system protoyper to connect to our database and write expressions. There are objects in the database we need to transport into our application. This is what the Turnkey application does by using different expressions.  
 
* One common operator is '''allinstances'''. It takes all the referenced classes and posts them back to the application. Following the explanation in the video, if we have a set of objects, we have different types of operators - likes size, for example, it would return 6, but in our case, we have 4 cars. We can stack the operators after each other and use all instances to make size returns 4.
[[Part 3 OCL: Derivation properties|Part 3 Derivation properties]]
* There are many different operators - one of them is '''"last"'''. It checks the list of retrieved or selected objects and picks the last one. There's an operator called '''"first"''' - that does almost the same thing but with the first one.
 
* '''Order by''' is an operator that could sort our objects on some property. Let's say that is  B C A D E F - "order by" on that property would fetch "A" first "B" then "C" "D" "E" "F".
We can use the system protoyper to connect to our database and write expressions. There are objects in the database that we need to transport into our application. And this is exactly what the turnkey application does by using different expressions.  
* '''SubSequence''' operator takes only a subset of a returned set from '''allinstances'''. For example 1,2, like that - instead of 4, we have only two and we could combine. Following the video, that adds the order by registration number behind the subsequence expression that we have in the debugger.
 
* The most important operator you will often use is '<nowiki/>'''select''''. It requires some Boolean value - it checks every value object that runs through on some property. Then, it chooses whether to return it or not. When it comes to "select", you can combine any Boolean expression like logic operators with 'and' and 'or' 'not' or others. One important concept in using "select" is the loop variable - it is the name of the iterated object in the expressions. For example, we are going to call it "one car". There's a pipe sign, which means we could use this variable "one car" in our expressions. It helps when the expressions get complex.
One common operator is '''all instances'''. It takes all of the class referenced and post them back to the application. Following the explanation in the video if we have a set of objects, we have different types of operators - likes size, for example,it would return 6, but in our case we have 4 cars. So we can stack the operators after each other and use all instances to make size returns 4.
[[Category:MDriven Turnkey]]
 
[[Category:MDriven Turnkey Sessions]]
There are many different operators, one of them is '''"last"'''. It checks the list of retrieved or selected objects and picks the last one. There's an operator called '''"first"''' - that does almost the same thing, but with the first one.
[[Category:OCL]]
 
[[Category:OCL Editor]]
'''Order by''' is an operator that could sort our objects on some property. Let's say that is  B C A D E F "oreder by" on that property would fetch "A" first "B" then "C" "D" "E" "F".
[[Category:Expressions]]
 
[[Category:Operators]]
'''SubSequence''' operator takes only a subset of returned set from allinstances. For example 1,2, like that, so instead of 4 we have got only two and we could combine. So following the video, that's add the order by registration number behind the subsequence expression that we have in the debugger.
{{Edited|July|12|2024}}
 
The most important operator that you will use most likely is '<nowiki/>'''select'''' it requires some boolean value, so it checks each and every value object that runs through on some property. Then it either chooses to return it or not. When it comes to select you can combine any boolean expression like logic operators with 'and' and 'or' 'not' and things like that. One important concept in using select is the loop variable - it is the name on the iterated object in the expressions. For example we are going to call that "one car". There's a pipe sign, it means that we could use this variable "one car" in our expressions. It helps when the expressions get complex.

Latest revision as of 15:49, 10 February 2024

Session 7: In this session, we take a deeper look at OCL expressions and what you can do with them. OCL is a complete language that can act on everything you have in your model. It has operators on objects and on collections. The OCL language is a functional language, different in approach compared to imperative languages like Javascript and c#. The OCL language is optimized for querying your model. It uses a bit of set theory from your math classes. It is compact in the sense that it does a lot with short snippets. OCL is defined by ObjectManagementGroup(OMG).

To make your experience smooth, we set the main tags mentioned in the video to the right bar menu of this mini-player. Choose an interesting subtitle on the list and immediately get to the exact theme navigation item place in the video. Now you can pick any topic to be instructed on without watching the whole video.


"all instances" expression "Last" expression "First" "Order By" SubSequence Combine the expressions Select operator Combine with logic expressions Loop variable

OCL Expressions

To learn more about object constraint language expressions (OCL expressions) you can watch the OCL Sessions Series:

We use the system protoyper to connect to our database and write expressions. There are objects in the database we need to transport into our application. This is what the Turnkey application does by using different expressions.

  • One common operator is allinstances. It takes all the referenced classes and posts them back to the application. Following the explanation in the video, if we have a set of objects, we have different types of operators - likes size, for example, it would return 6, but in our case, we have 4 cars. We can stack the operators after each other and use all instances to make size returns 4.
  • There are many different operators - one of them is "last". It checks the list of retrieved or selected objects and picks the last one. There's an operator called "first" - that does almost the same thing but with the first one.
  • Order by is an operator that could sort our objects on some property. Let's say that is B C A D E F - "order by" on that property would fetch "A" first "B" then "C" "D" "E" "F".
  • SubSequence operator takes only a subset of a returned set from allinstances. For example 1,2, like that - instead of 4, we have only two and we could combine. Following the video, that adds the order by registration number behind the subsequence expression that we have in the debugger.
  • The most important operator you will often use is 'select'. It requires some Boolean value - it checks every value object that runs through on some property. Then, it chooses whether to return it or not. When it comes to "select", you can combine any Boolean expression like logic operators with 'and' and 'or' 'not' or others. One important concept in using "select" is the loop variable - it is the name of the iterated object in the expressions. For example, we are going to call it "one car". There's a pipe sign, which means we could use this variable "one car" in our expressions. It helps when the expressions get complex.
This page was edited 47 days ago on 02/10/2024. What links here