Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » OCL List Comprehensions
OCL List Comprehensions [message #1738931] Tue, 26 July 2016 08:23 Go to next message
Philippe de Rochambeau is currently offline Philippe de RochambeauFriend
Messages: 40
Registered: February 2013
Member
Hello,
I've modeled the Book Order System described on page 150 of Object-Oriented Analysis and Design for Information Systems, by Raul Sidnei Wazlawick:

index.php/fa/26569/0/

Althought the following two OCL constraint expressions are validated by the Eclipse OCL interpreter:
totalValue = items->sum()
totalValue = self.items.subtotal->sum()

... the following isn't (although it's recommended by the book author):
self.item->sum(anItem|anItem.subtotal)



Is the author using an non-standard version of OCL or are list comprehensions not "understood" by the Eclipse OCL Interpreter?
  • Attachment: Order.png
    (Size: 46.89KB, Downloaded 491 times)

[Updated on: Tue, 26 July 2016 08:29]

Report message to a moderator

Re: OCL List Comprehensions [message #1738939 is a reply to message #1738931] Tue, 26 July 2016 08:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6568
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi<br>
<br>
Presumably you meant (missing "s")<br>
<pre wrap="">self.items-&gt;sum(anItem|anItem.subtotal)</pre>
Currently the OCL specification gives no consideration to
comprehensions, although some consideration was given to it at the
Aachen workshop [1]. I can only conclude that your author was
being a little optimistic.<br>
<br>
Strictly speaking the 'not understood' is in the OCL standard
library rather than in OCL. The new Pivot-based OCL has a library
model in which iterations are modelled and so you could add a
"sum" iterator, however the co-existence of an iteration and an
operation with the same name may provoke a latent bug.<br>
<br>
    Regards<br>
<br>
        Ed Willink<br>
<br>
<br>
[1] <cite class="_Rm"><a class="moz-txt-link-freetext" href="https://www.google.co.uk/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=2&amp;ved=0ahUKEwi57p3g3pDOAhWGSRoKHYc2BaMQFggiMAE&amp;url=http%3A%2F%2Fwww.se-rwth.de%2Fpublications%2FReport-on-the-Aachen-OCL-Meeting.pdf&amp;usg=AFQjCNEezfyQBFsVsQdE0KfpBDwsYX2_rQ&amp;bvm=bv.127984354,d.d2s&amp;cad=rja">https://www.google.co.uk/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=2&amp;ved=0ahUKEwi57p3g3pDOAhWGSRoKHYc2BaMQFggiMAE&amp;url=http%3A%2F%2Fwww.se-rwth.de%2Fpublications%2FReport-on-the-Aachen-OCL-Meeting.pdf&amp;usg=AFQjCNEezfyQBFsVsQdE0KfpBDwsYX2_rQ&amp;bvm=bv.127984354,d.d2s&amp;cad=rja</a></cite><br>
<br>
<br>
<br>
On 26/07/2016 09:23, Philippe de Rochambeau wrote:<br>
</div>
<blockquote cite="mid:nn76m3$vh8$1@xxxxxxxxe.org" type="cite">
<pre wrap="">Hello,
I'm currently attempting to translate the book order system on page 150 of Object-Oriented Analysis and Design for Information Systems, by Raul Sidnei Wazlawick:



Althought the following two expressions are validated by the Eclipse OCL interpreter:
totalValue = items-&gt;sum()
totalValue = self.items.subtotal-&gt;sum()

this one, which is preferred by the book author, isn't
self.item-&gt;sum(anItem|anItem.subtotal)

Are so-called OCL "list comprehensions" not "understood" by the Eclipse OCL Interpreter?
</pre>
</blockquote>
<p><br>
</p>

<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo" />
</a>
</td>
<td>
<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
This email has been checked for viruses by Avast antivirus software.
<br><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient">www.avast.com</a>
</p>
</td>
</tr>
</table>
<br />
</body>
</html>
Re: OCL List Comprehensions [message #1738943 is a reply to message #1738939] Tue, 26 July 2016 09:08 Go to previous messageGo to next message
Philippe de Rochambeau is currently offline Philippe de RochambeauFriend
Messages: 40
Registered: February 2013
Member
Hi Ed, thank you for your reply.
Have you noticed how your replies are filled with HTML tags?
Re: OCL List Comprehensions [message #1738949 is a reply to message #1738943] Tue, 26 July 2016 09:29 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6568
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi<br>
<br>
No, I hadn't. Thanks for pointing it out.<br>
<br>
I think that most committers use NNTP rather than the forum. The
messages display fine in Thunderbird.<br>
<br>
The dual headed newsgroup/forum has been a long standing problem
(some forum messages get lost wrt NNTP). Replacement technology
has been discussed many times but no consensus prevails. I doubt
that it is worth raising a bug.<br>
<br>
I'll consult with others to see what they do. I'm reluctant to
lose HTML, but equally I'm reluctant to to produce painful to read
replies.<br>
<br>
Checking the NNTP message source, I see content type
multipart/alternative with both plain text and HTML in the
message, so it looks like a forum bug that it HTML encodes the
HTML rather than passing it clean or encoding the plain text.<br>
<br>
Perhaps its my fault for picking the wrong alternative from
Thunderbird's three way pop-up, mixed/plain/HTML.<br>
<br>
<u><i><b>Let's force this to HTML and see if just HTML is ok</b></i></u><br>
<br>
    Regards<br>
<br>
        Ed Willink<br>
<br>
On 26/07/2016 10:08, Philippe de Rochambeau wrote:<br>
</div>
<blockquote cite="mid:nn799n$652$1@xxxxxxxxe.org" type="cite">Hi
Ed, thank you for your reply.
<br>
Have you noticed how your replies are filled with HTML tags?
<br>
</blockquote>
<p><br>
</p>

<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo" />
</a>
</td>
<td>
<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
This email has been checked for viruses by Avast antivirus software.
<br><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient">www.avast.com</a>
</p>
</td>
</tr>
</table>
<br />
</body>
</html>
Re: OCL List Comprehensions [message #1738951 is a reply to message #1738949] Tue, 26 July 2016 09:34 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6568
Registered: July 2009
Senior Member
Hi

It seems content type text/html is bad too. I've set news.eclipse.org to
non-HTML. Hopefully my messafes will be readable now.

Regards

Ed Willink


On 26/07/2016 10:29, Ed Willink wrote:
> Hi
>
> No, I hadn't. Thanks for pointing it out.
>
> _/*Let's force this to HTML and see if just HTML is ok*/_


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Re: OCL List Comprehensions [message #1738957 is a reply to message #1738951] Tue, 26 July 2016 10:08 Go to previous message
Philippe de Rochambeau is currently offline Philippe de RochambeauFriend
Messages: 40
Registered: February 2013
Member
Much better: the tags are gone.
Previous Topic:How do you extend a PrimitiveType?
Next Topic:Label Positioning in NEON
Goto Forum:
  


Current Time: Thu Jan 23 16:18:26 GMT 2020

Powered by FUDForum. Page generated in 0.02254 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top