| union two sets of different classifier [message #1231090] |
Mon, 13 January 2014 15:16  |
Eclipse User |
|
|
|
I would like to union two sets of different classifier with OCL:
for the code below:
Class.allInstances()->union(Attribute.allInstances()) //Class and Attribute are two Classes defined in Ecore
it returns :
Unresolved Operation 'Set(myOO::myOO::Class)::union(Set(myOO::myOO::Attribute))'
How can I do this?
PS:
1- In other word, it seem that OCL treats SET as a SET<T>, unlike the concept of set in set theory in mathematic that the type of the set members is not concerned.
2- Ecore diagram is attached
Thanks
|
|
|
|
|
|
| Re: union two sets of different classifier [message #1231445 is a reply to message #1231431] |
Tue, 14 January 2014 12:48   |
Eclipse User |
|
|
|
Hi
OCL for Ecore 3.2.0 is the very longstanding Eclipse OCL that
unfortunately has a number of corner case issues that are really hard to
fix without significant difficulties, not least of which is
compatibility and lack of underlying models.
The new code is currently only of 'examples' quality so it is not forced
on to you; you must explicitly choose to use it, firstly by installing
the OCL Examples and Editors, then by changing your java package paths.
It is implicitly used by the newer tooling Xtext-based editors, Xtext
Console and OCL to java code generator.
Regards
Ed Willink
On 14/01/2014 17:01, Hamid Qartal wrote:
> Hi Ed
>
> Thanks for your reply.
> I am using: Eclipse Version: 4.2.1, OCL End user SDK 4.0.2 , as
> installed softwares ( I got these info from "about
> eclipse>installation details>installed softwares") and
> EMF modeling framework runtime and tools 2.6.0 EMF Ecore 2.8.3
> OCL for Ecore 3.2.0
> OCL parser and interpreter 3.2.1 (I got these info from "about
> eclipse>installation details>plug-ins")
>
> what you said does make sense that it takes the most derived common
> super type of source and argument and execute the query!
> if it is so, according to above version numbers, which one , should I
> upgrade to get the desired result as you said.
>
> (I assume in that case I would not require to cast my types to supper
> types explicitly. right?)
>
> Thanks
|
|
|
| Re: union two sets of different classifier [message #1231465 is a reply to message #1231445] |
Tue, 14 January 2014 13:51  |
Eclipse User |
|
|
|
Hi
I installed the last version of Eclipse 4.3.1 and ocl for ecore 3.3.0
I tried to union two classes which are children of the same parent, but still I need to cast explicitly one of them to its parent (by using oclAsType operation) to have my OCL code running in OCL in xtext console.
I am wondering if this is the normal behaviour of the OCL?
to make my question more explicit, Does OCL treat SETs as pure SETs or it treats them as SET<T> where T is the type of the including members? I assume the latter is the case? right?
For more details, Please look at the attached screen shot; OCL codes and the Ecore diagram are visible in that picture: I highlighted the part I mean I need to write explicitly; As you see removing the oclAsType in the second query would result an error.
Thanks
Hamid
|
|
|
Powered by
FUDForum. Page generated in 0.04412 seconds