Collection and UniqueCollection Union [message #1710027] |
Fri, 02 October 2015 14:07  |
Eclipse User |
|
|
|
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 09:25   |
Eclipse User |
|
|
|
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 #1710279 is a reply to message #1710252] |
Mon, 05 October 2015 12:31  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03703 seconds