|
|
(15 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| <html> | | <html> |
| <style> | | <h4> |
| #video12 {
| | An introduction to OCL - the Object Constraint Language - through an example. This session also introduces the new MDriven Debugger |
| position: relative;
| | and shows how to get instant results from modeling efforts. Learn more about percentages and other useful properties to operate |
| height: 500px;
| | and moderate your model properly. |
| width:560px;
| |
| padding-bottom: 10px; | |
| }
| |
| #video12 iframe {
| |
| position: absolute;
| |
| min-height: auto;
| |
| min-width: auto; | |
| }
| |
| #video12 div {
| |
| position: absolute;
| |
| top: 0;
| |
| left:760px;
| |
| width: 260px;
| |
| height: 100%;
| |
| padding-left: 10px;
| |
| overflow-y: auto;
| |
| }
| |
| span {
| |
| font-size: 18;
| |
| display:block;
| |
| padding: 2px 10px 2px 10px;
| |
| padding-bottom: 0.5;
| |
| padding-top: 0.5;
| |
| opacity: 0.7; | |
| }
| |
| span:hover {
| |
| color: #0000FF;
| |
| cursor: pointer;
| |
| }
| |
| span:focus {
| |
| color: blue;
| |
| </style>
| |
|
| |
|
| <h5> | | </h4> |
| An introduction to OCL - the object constraints language - by example. The session also introduce the new MDriven debugger and shows how to get instant results of modelling efforts. Learn more about percentage and other useful properties to operate and moderate your model properly.
| |
|
| |
|
| </h5>
| | <p class="warn"> |
| | | <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> |
| <p> | |
| <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> | |
| <style type="text/css">
| |
| p {
| |
| opacity: 0.7;
| |
| text-align: justify;
| |
| width: 90%
| |
| }
| |
| </style>
| |
| </p> | | </p> |
|
| |
|
| <div id="video12"> | | <br> |
| <iframe width="740" height="500" src="https://www.youtube.com/embed/di3GScdWBxA?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe>
| | <div class="video"> |
| <div> | | <div class="video__wrapper"> |
| <span data-video="di3GScdWBxA" data-start="180" tabindex="0"> derivation properties </span> | | <iframe src="https://www.youtube.com/embed/QaQu0ojg-Oc?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe> |
| <ul>
| | </div> |
| <span data-video="di3GScdWBxA" data-start="41" tabindex="0"> percentage property </span> | | <div class="video__navigation"> |
| <span data-video="di3GScdWBxA" data-start="300" tabindex="0"> calculation in oc </span> | | <span class="navigation-item" data-video="QaQu0ojg-Oc" data-start="180" tabindex="0"> Derivation Properties </span> |
| </ul>
| | <span class="navigation-item" data-video="QaQu0ojg-Oc" data-start="41" tabindex="0"> Percentage property </span> |
| <span data-video="di3GScdWBxA" data-start="250" tabindex="0"> random operator </span> | | <span class="navigation-item" data-video="QaQu0ojg-Oc" data-start="300" tabindex="0"> Calculation in OCL </span> |
| <span data-video="di3GScdWBxA" data-start="690" tabindex="0"> toDecimal operation </span> | | <span class="navigation-item" data-video="QaQu0ojg-Oc" data-start="250" tabindex="0"> Random operator </span> |
| | <span class="navigation-item" data-video="QaQu0ojg-Oc" data-start="690" tabindex="0"> toDecimal operation </span> |
| | </div> |
| | </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 = 'http://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> |
| | | [[Category:OCL]] |
| '''Raw subtitles text'''
| | [[Category:OCL Editor]] |
| | | [[Category:Derivations]] |
| Hi welcome back to Part3 of Ocl
| | [[Category:Expressions]] |
| | | [[Category:Operators]] |
| let's say someone changes the requirements
| | {{Edited|July|12|2024}} |
| | |
| all of a sudden, the fruit can be in
| |
| | |
| multiple bowls, so I should have changed
| |
| | |
| the cardinality of the inbowl
| |
| | |
| property, but then we need to add a
| |
| | |
| Association object and association class
| |
| | |
| called fruit part in this case
| |
| | |
| I also add a percentage property on it,
| |
| | |
| so I know how much of the fruit that's in
| |
| | |
| the fruit bowl and all of a sudden,
| |
| | |
| we have quite different problem
| |
| | |
| we need to be able to calculate depending on
| |
| | |
| how much of the total fruits that's
| |
| | |
| in the fruit bowl, so fruit.allinstances
| |
| | |
| but we also have the link end
| |
| | |
| so if we watched the innerlink name
| |
| | |
| so these are the names to the fruit part in the association
| |
| | |
| so we find that fruit part
| |
| | |
| so fruit.allinstances and fruit part the
| |
| | |
| percentage, so if we select this you
| |
| | |
| should see, ok,okay I have the fruit allinstances
| |
| | |
| but since I changed the model
| |
| | |
| so all the data I had before is gone
| |
| | |
| so I need to update it
| |
| | |
| ok let's add a new attribute, so that we
| |
| | |
| know how much of the fruit is in bowls
| |
| | |
| since the fruit is one fruit hundred
| |
| | |
| percent it shouldn't be more than a hundred
| |
| | |
| so we have the fruit parts that
| |
| | |
| this fruit takes part in and the
| |
| | |
| percentage of that and we sum that together
| |
| | |
| yeah we need to reload the model had
| |
| | |
| some changes, saving those okay then
| |
| | |
| I want to, the fruit I want to assign a
| |
| | |
| value to the percentage one just use a
| |
| | |
| random value to get some spreading my
| |
| | |
| data, so this is issuing the ocl editor
| |
| | |
| tend to the percentage int32.random
| |
| | |
| there should be random operator
| |
| | |
| the max value is a hundred so anything
| |
| | |
| between 0 and a hundred, execute that on
| |
| | |
| this glass bowl, okay and on the plastic bowl
| |
| | |
| oh I add semicolon too much
| |
| | |
| ok so now we have some random value in
| |
| | |
| the percentage in the fruit part now
| |
| | |
| we can make some use in the derivation of
| |
| | |
| the weight of the contents of the fruit bowl
| |
| | |
| because this is currently not
| |
| | |
| correct just summing up the weight of the fruits
| |
| | |
| we need to consider the part
| |
| | |
| of the fruits that that we use
| |
| | |
| so we iterate over fruit part the percentage
| |
| | |
| then we divide that by hundred to get a
| |
| | |
| fraction and we multiply it with now we
| |
| | |
| can follow the single link back to fruitInBowl
| |
| | |
| and get the weight of the
| |
| | |
| of the whole fruit
| |
| | |
| and we need to sum that up but that
| |
| | |
| would be a double and we need an int 32
| |
| | |
| so we need first to convert it to a
| |
| | |
| decimal, because that's the highest
| |
| | |
| position and then we can take it to int32 like that
| |
| | |
| ok so now we fix that one
| |
| | |
| let's see how much is in the bowls
| |
| | |
| so are there any bowls that
| |
| | |
| oh I should use two errors in
| |
| | |
| this expression is no one meant I meant
| |
| | |
| first of all this is spelled like wrong
| |
| | |
| but what the type is, ok that's the error it was fruit bowl
| |
| | |
| should have been fruit
| |
| | |
| okay how much is using bowls, if its
| |
| | |
| larger than a hundred then that fruit is overused
| |
| | |
| so we could warn about this in
| |
| | |
| our application of course, now I have the weight of the
| |
| | |
| contents as actually and considering the
| |
| | |
| the percentage of the fruit that's in
| |
| | |
| there the bowl, let's see what's this then
| |
| | |
| adding a new derived attribute and
| |
| | |
| presentation and grab the type name
| |
| | |
| from the fruit that's in the single link
| |
| | |
| fruit bowl, that's not like that with
| |
| | |
| weight of and same thing here back to
| |
| | |
| the single link fruitInBowl weight
| |
| | |
| but we want to multiply it by our percentage
| |
| | |
| how much did we use
| |
| | |
| ok let's do this, we calculate the actual weight
| |
| | |
| in separate drived attribute
| |
| | |
| fruit inbowl, weight, times percentage
| |
| | |
| devided by hundred, to decimal, we need to go to decimal
| |
| | |
| because there's the conversion
| |
| | |
| to int32 is from decimal, ok it's the actual
| |
| | |
| weight now we have that and we can head back
| |
| | |
| yeah we have an error in
| |
| | |
| this expression presentation expression
| |
| | |
| because you can't just add int32 to a
| |
| | |
| string, we need to make it ok
| |
| | |
| and back to the debugger, re-read the model
| |
| | |
| check the fruit bowl hasn't change
| |
| | |
| that's because we haven't actually made
| |
| | |
| use of your presentation on the
| |
| | |
| fruit part, we're going to need to have
| |
| | |
| back to fruit bowl, in this one fruitinbowl presentation
| |
| | |
| that's not correct we should use the
| |
| | |
| fruit part of that, but we need to say
| |
| | |
| self in front of it, like so
| |
| | |
| reloading the model, now we can see that
| |
| | |
| we have detailed information about
| |
| | |
| what we actually have in the bowl and since
| |
| | |
| the weight of the contents now actually
| |
| | |
| is calculated in the fruit part for each
| |
| | |
| and the weight of each part is
| |
| | |
| calculated we might as well just sum
| |
| | |
| those up to reduced the need for definition
| |
| | |
| and like that doesn't change anything so
| |
| | |
| these are some examples on how you can
| |
| | |
| use ocl to navigate your data to
| |
| | |
| calculate your data to derive data
| |
| | |
| new information from your existing data and
| |
| | |
| there's loads of applications for
| |
| | |
| this and following these rules you can
| |
| | |
| actually complete the whole software
| |
| | |
| system only with business rules
| |
| | |
| expressed in icl, so hopefully
| |
| | |
| ypu will check out some of our other videos to
| |
| | |
| learn more about that, thank you for watching this Ocl introduction
| |