Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » collection(T2)
collection(T2) [message #47882] Fri, 11 January 2008 11:26 Go to next message
Eclipse UserFriend
Originally posted by: krzysztof_kaczmarski.o2.pl

Hi All,

could somebody please explain me why in the OCL standard library
defined in MDT-OCL collect() operation returns result of type
collection(T2)?
I understand that collection(T2) indicates that its elements are of
different type than in the original collection(T).

I cannot perform any operation on the collect() resulting collection
(like for example collect(x)->sum() because in the standard library
collection(T2) has no operations defined.

Thanks in advance,
Krzysztof
Re: collection(T2) [message #47974 is a reply to message #47882] Fri, 11 January 2008 13:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Krzysztof,

The T2 type in the stdlib implementation is a somewhat clumsy way to
represent the template parameter T2 in the OCL Specification's definition
of the collect() iterator.

Collection(T2) doesn't have to define operations of its own because it
inherits them from the basic Collection definition. How are you attempting
to parse/evaluate your expression? I have no difficult with expressions
such as

EClassifier.allInstances()->collect(name)->collect(size())- >sum()

Cheers,

Christian

Krzysztof Kaczmarski wrote:

> Hi All,
>
> could somebody please explain me why in the OCL standard library
> defined in MDT-OCL collect() operation returns result of type
> collection(T2)?
> I understand that collection(T2) indicates that its elements are of
> different type than in the original collection(T).
>
> I cannot perform any operation on the collect() resulting collection
> (like for example collect(x)->sum() because in the standard library
> collection(T2) has no operations defined.
>
> Thanks in advance,
> Krzysztof
Re: collection(T2) [message #48034 is a reply to message #47974] Fri, 11 January 2008 14:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: krzysztof_kaczmarski.o2.pl

Hi Christian,
is this inheritance defied in oclstdlib.uml ?
I cannot see that.

Cheers,
Krzysztof

Christian W. Damus wrote:
> Hi, Krzysztof,
>
> The T2 type in the stdlib implementation is a somewhat clumsy way to
> represent the template parameter T2 in the OCL Specification's definition
> of the collect() iterator.
>
> Collection(T2) doesn't have to define operations of its own because it
> inherits them from the basic Collection definition. How are you attempting
> to parse/evaluate your expression? I have no difficult with expressions
> such as
>
> EClassifier.allInstances()->collect(name)->collect(size())- >sum()
>
> Cheers,
>
> Christian
>
> Krzysztof Kaczmarski wrote:
>
>> Hi All,
>>
>> could somebody please explain me why in the OCL standard library
>> defined in MDT-OCL collect() operation returns result of type
>> collection(T2)?
>> I understand that collection(T2) indicates that its elements are of
>> different type than in the original collection(T).
>>
>> I cannot perform any operation on the collect() resulting collection
>> (like for example collect(x)->sum() because in the standard library
>> collection(T2) has no operations defined.
>>
>> Thanks in advance,
>> Krzysztof
>
Re: collection(T2) [message #48123 is a reply to message #48034] Fri, 11 January 2008 18:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Krzysztof,

This is one of the peculiarities of the oclstdlib.{ecore,uml}
implementations, that these generalization relationships are not defined in
the library models, but instead are implemented in code. Ecore cannot
express generalizations between non-EClasses, and this structure was
reproduced in the UML representation because of the way that the parser
internally supplies the inheritance. This is one of several aspects of
these libraries that needs to be cleaned up in an eventual MDT OCL 2.0
release ...

Cheers,

Christian


Krzysztof Kaczmarski wrote:

> Hi Christian,
> is this inheritance defied in oclstdlib.uml ?
> I cannot see that.
>
> Cheers,
> Krzysztof
>
> Christian W. Damus wrote:
>> Hi, Krzysztof,
>>
>> The T2 type in the stdlib implementation is a somewhat clumsy way to
>> represent the template parameter T2 in the OCL Specification's definition
>> of the collect() iterator.
>>
>> Collection(T2) doesn't have to define operations of its own because it
>> inherits them from the basic Collection definition. How are you
>> attempting
>> to parse/evaluate your expression? I have no difficult with expressions
>> such as
>>
>> EClassifier.allInstances()->collect(name)->collect(size())- >sum()
>>
>> Cheers,
>>
>> Christian

-----8<-----
Re: collection(T2) [message #48154 is a reply to message #48123] Sat, 12 January 2008 08:55 Go to previous message
Eclipse UserFriend
Originally posted by: krzysztof_kaczmarski.o2.pl

Oh, so my own implementation of OCL will have to implement it
implicitly too.
Thanks for this clarification.
Krzysztof


Christian W. Damus wrote:
> Hi, Krzysztof,
>
> This is one of the peculiarities of the oclstdlib.{ecore,uml}
> implementations, that these generalization relationships are not defined in
> the library models, but instead are implemented in code. Ecore cannot
> express generalizations between non-EClasses, and this structure was
> reproduced in the UML representation because of the way that the parser
> internally supplies the inheritance. This is one of several aspects of
> these libraries that needs to be cleaned up in an eventual MDT OCL 2.0
> release ...
>
> Cheers,
>
> Christian
>
>
> Krzysztof Kaczmarski wrote:
>
>> Hi Christian,
>> is this inheritance defied in oclstdlib.uml ?
>> I cannot see that.
>>
>> Cheers,
>> Krzysztof
>>
>> Christian W. Damus wrote:
>>> Hi, Krzysztof,
>>>
>>> The T2 type in the stdlib implementation is a somewhat clumsy way to
>>> represent the template parameter T2 in the OCL Specification's definition
>>> of the collect() iterator.
>>>
>>> Collection(T2) doesn't have to define operations of its own because it
>>> inherits them from the basic Collection definition. How are you
>>> attempting
>>> to parse/evaluate your expression? I have no difficult with expressions
>>> such as
>>>
>>> EClassifier.allInstances()->collect(name)->collect(size())- >sum()
>>>
>>> Cheers,
>>>
>>> Christian
>
> -----8<-----
Previous Topic:custom PrimitiveType literals
Next Topic:Global Operations
Goto Forum:
  


Current Time: Thu Apr 25 16:02:49 GMT 2024

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

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

Back to the top