Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Collection and UniqueCollection Union(Eclipse OCL's definition of a collection union appears to diverge from the OMG spec.)
Collection and UniqueCollection Union [message #1710027] Fri, 02 October 2015 18:07 Go to next message
Spencer Crosswy is currently offline Spencer CrosswyFriend
Messages: 2
Registered: October 2015
Junior Member
I'm seeing unexpected behavior for the 'union' operation on Collections and UniqueCollections. A union of Collections always returns a Bag; a union of UniqueCollections always returns a Set.

This behavior does align with the Eclipse OCL 6.0 spec (and earlier versions), but it does not align with the OMG OCL 2.4 spec that the Eclipse OCL 6.0 spec claims to implement. (OMG OCL 2.4 has distinct union operations for each collection - e.g. a union of Sequences returns a Sequence.)

Is this intentional?

I'm using Eclipse 4.5.0 (Mars) w/ OCL 6.0.0.
Re: Collection and UniqueCollection Union [message #1710239 is a reply to message #1710027] Mon, 05 October 2015 13:25 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The Pivot OCL also prototypes OCL 2.5/3.0 changes such as the Modeled
Standard Library, so precise OCL 2.4 is not there. Precise OCL 2.4 is
almost unimplementable anyway because of specification ambiguities. You
could use an OCL-2.4.oclstdlib in place of OCL-2.5.oclstdlib to get closer.

OCL 2.4 has no OrderedSet::union or Collection::union.

I have been uncomfortable about the partial availability of 'set'
operations such as union on non-sets. Hence the more uniform
Collection::union returning a set-like Bag.

I would much prefer to replace 'union' by 'appendAll' for
OrderedCollections so that it is clearer that the user is responsible
for the subsequent ordering. To me 'union' implies that the unified
ordering is somehow consistent. i.e.
Sequence{1,3,5}->union(Sequence{2,4,6}) could be expected to be
Sequence{1,2,3,4,5,6} but it is actually Sequence{1,3,5,2,4,6} since OCL
knows nothing about the ordering criterion used to create each Sequence.
Sequence{1,3,5}->appendAll(Sequence{2,4,6}) doesn't surprise me in the
same way.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=479042 raised so that I
might look at this next time I review the library.

Regards

Ed Willink


On 05/10/2015 13:45, Spencer Crosswy wrote:
> I'm seeing unexpected behavior for the 'union' operation on
> Collections and UniqueCollections. A union of Collections always
> returns a Bag; a union of UniqueCollections always returns a Set.
>
> This behavior does align with the Eclipse OCL 6.0 spec (and earlier
> versions), but it does not align with the OMG OCL 2.4 spec that the
> Eclipse OCL 6.0 spec claims to implement. (OMG OCL 2.4 has distinct
> union operations for each collection - e.g. a union of Sequences
> returns a Sequence.)
>
> Is this intentional?
>
> I'm using Eclipse 4.5.0 (Mars) w/ OCL 6.0.0.
Re: Collection and UniqueCollection Union [message #1710252 is a reply to message #1710239] Mon, 05 October 2015 14:14 Go to previous messageGo to next message
Spencer Crosswy is currently offline Spencer CrosswyFriend
Messages: 2
Registered: October 2015
Junior Member
Thanks for the reply.

Does OCL-2.4.oclstdlib have a Sequence::union? How would I go about "downgrading" to that version? I recently updated to Mars w/ Eclipse OCL 6.0.0 for improved OCL debugging.

Side question (I can open a new topic if necessary): Do you/the project have these OCL 2.4 specification ambiguities documented anywhere? We would like to use OCL 2.4 for specification, so information like that could help us avoid unintentional ambiguities.

Thanks,
Spencer

Edit 10/5/15: added question about downgrading to OCL-2.4.stdlib

[Updated on: Mon, 05 October 2015 14:23]

Report message to a moderator

Re: Collection and UniqueCollection Union [message #1710279 is a reply to message #1710252] Mon, 05 October 2015 16:31 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The OCL 2.5 RFP (now lapsed) has most of the problems in its wish list.
It should reappear soon (Decemeber) as the OCL 3.0 RFP.

http://www.omg.org/cgi-bin/doc?ad/2014-03-05 (start at page 19).

Altenatively

http://www.omg.org/issues/ocl2-rtf

gives you the gory details. If you/your institution are an OMG member,
JIRA provides the same in more readable form.

The bulk of the problems relate to the lack of support for XMI
interchange of the Abstract Syntax and the lack of a solid relationship
to UML. OCL survives despite these problems because the Concrete Syntax
is intuitively obvious, till you hit the dark corners.

Regards

Ed Willink


On 05/10/2015 15:14, Spencer Crosswy wrote:
> Thanks for the reply.
>
> Side question (I can open a new topic if necessary): Do you/the
> project have these OCL 2.4 specification ambiguities documented
> anywhere? We would like to use OCL 2.4 for specification, so
> information like that could help us avoid unintentional ambiguities in
> our specification.
>
> Thanks,
> Spencer
Previous Topic:Migrating code to OCL 3.5 (Eclipse 4.5)
Next Topic:Eclipse Issue with Editor
Goto Forum:
  


Current Time: Wed Apr 24 14:06:41 GMT 2024

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

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

Back to the top