Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsType of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/650539/#msg_650539
Evaluating:
self.supplier.getValue(self.supplier.getAppliedStereotype('r COS::ContractInterface')- >any(true),'interface').oclIsTypeOf(uml::Interface) Results:
true
Evaluating:
let i : uml::Interface = self.supplier.getValue(self.supplier.getAppliedStereotype('r COS::ContractInterface')- >any(true),'interface').oclAsType(uml::Interface) in i Results:
Init expression type does not conform to type of variable (i).]]>Volker Stolz2011-01-25T13:31:06-00:00Re: Type of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/650665/#msg_650665
This might be Bug 299959. Major simplification of associated code is
happening for 3.1.0 and you will get hover text in the editor to help
with type problems. I'm not sure this helps you now.
Regards
Ed Willink
On 25/01/2011 13:31, Volker Stolz wrote:
> While playing with my UML model and the interactive OCL console. Both
> OCL-functions convince me that I'm looking at a uml::Interface, but if
> I try to assign it to a variable of the same time in a let, it doesn't
> type-check. What am I missing? Platform is Helios-SR1 with feature OCL
> 3.0.1 and feature OCL for UML 3.0.0.
>
> Evaluating:
> self.supplier.getValue(self.supplier.getAppliedStereotype('r
> COS::ContractInterface')-
> >any(true),'interface').oclIsTypeOf(uml::Interface)
> Results:
> true
>
> Evaluating:
> self.supplier.getValue(self.supplier.getAppliedStereotype('r
> COS::ContractInterface')-
> >any(true),'interface').oclAsType(uml::Interface)
> Results:
> <Interface> Interface_From_Clock
>
> Evaluating:
> let i : uml::Interface =
> self.supplier.getValue(self.supplier.getAppliedStereotype('r
> COS::ContractInterface')-
> >any(true),'interface').oclAsType(uml::Interface) in i
> Results:
> Init expression type does not conform to type of variable (i).]]>Ed Willink2011-01-25T22:44:28-00:00Re: Type of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/650746/#msg_650746
I just checked Indigo with OCL 3.1.0 M4, and it gives the same message...Please advise; (new) ticket?
-Volker]]>Volker Stolz2011-01-26T11:09:25-00:00Re: Type of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/650821/#msg_650821
The fixes appear in M5 the new extensible Model-Driven Library, which
ensures that declarations and semantics are localised. It was too
difficult to pin down the corner cases in the old code, and even harder
to track OCL evolution (past), and more importantly future where many
unimplementable aspects of Complete OCL will be resolved.
Use org.eclipse.ocl.examples.pivot... which will be promoted to
org.eclipse.ocl.pivot... in 4.0.
Please raise a Bugzilla, if you can attach small complete repro models;
that will ensure that I check it. Providing the UML aspects of the new
code is still work in progress; test cases welcome.
Regards
Ed Willink
On 26/01/2011 11:09, Volker Stolz wrote:
> Hi Ed, it might be.
>
> I just checked Indigo with OCL 3.1.0 M4, and it gives the same
> message...Please advise; (new) ticket?
>
> -Volker]]>Ed Willink2011-01-26T16:57:13-00:00Re: Type of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/650823/#msg_650823
let i : uml::Interface = self.supplier.getValue(self.supplier.getAppliedStereotype('rCOS::ContractInterface')->any(true),'interface')->any(true).oclAsType(uml::Interface) in i
It looks like it may actually be my fault since accessing the stereotype with getValue() yields an EJavaObject in Ecore, and I'm not sure if I should expect OCL to find out that the stereotype actually has exactly-once multiplicity. The additional "any(true)" will do the right thing here.
Volker]]>Volker Stolz2011-01-26T17:40:46-00:00Re: Type of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/650836/#msg_650836
On 26/01/2011 17:40, Volker Stolz wrote:
> Hm, I've found a kind of workaround:
>
Good. I forhot to ask whty you were using getXXX? This is usually
indicating an attempt to use Ecore synthesized methods rather than
modeled methods.
> let i : uml::Interface =
> self.supplier.getValue(self.supplier.getAppliedStereotype('r COS::ContractInterface')- >any(true),'interface')->any(true).oclAsType(uml::Interface)
> in i
>
> It looks like it may actually be my fault since accessing the
> stereotype with getValue() yields an EJavaObject in Ecore, and I'm not
> sure if I should expect OCL to find out that the stereotype actually
> has exactly-once multiplicity.
>
Another source of difficulties with the old code. The new code has all
values extending Value, which provides a clear locality for multiplicity
semantic resolutions. You should always get an error to help you.
Regards
Ed Willink
> Volker]]>Ed Willink2011-01-26T18:22:15-00:00Re: Type of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/651010/#msg_651010
But this rule is part of a whole collection in a larger framework where some depend on the Ecore factory, as we use e.g. getRelationships(). I guess I could start by splitting them up into those that can already be moved to UML, like this one.
Thanks for the hint about M5, I'll take a look at it and see if it will required further action!
-Volker]]>Volker Stolz2011-01-27T12:49:29-00:00Re: Type of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/653525/#msg_653525
I get the same error with OCL 3.1.0 20110131.
-Volker]]>Volker Stolz2011-02-10T06:42:19-00:00Re: Type of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/653545/#msg_653545
The fix should be in the new UML-based pivot model approach in OCL 3.1.0
M5 Examples.
Can you let me have some example files so that I can check it out?
Regards
Ed
On 10/02/2011 06:42, Volker Stolz wrote:
> Hi Ed, a note:
> I get the same error with OCL 3.1.0 20110131.
>
> -Volker]]>Ed Willink2011-02-10T08:39:20-00:00Re: Type of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/654374/#msg_654374
http://heim.ifi.uio.no/~stolz/ocl-issue.zip
-Volker]]>Volker Stolz2011-02-15T13:47:49-00:00Re: Type of variable in "let" not agreeing with oclIsTypeOf/oclAsType
https://www.eclipse.org/forums/index.php/mv/msg/203500/654420/#msg_654420
Thanks. That also gives me a simple UML example to work with.
Unfortunately I've got some way tp go to sort this out with the pivot
model. I've filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=337230
Hopefully this'll be fully fixed for Indigo.
Regards
Ed Willink
On 15/02/2011 13:47, Volker Stolz wrote:
> Hi Ed, self-contained minimal profile, model and unit tests:
>
> http://heim.ifi.uio.no/~stolz/ocl-issue.zip
>
> -Volker]]>Ed Willink2011-02-15T17:03:37-00:00