Access unnavigable opposites of reference and composition relations in Ecore [message #1697471] |
Thu, 04 June 2015 08:52 |
Francois Cabrol Messages: 32 Registered: January 2015 |
Member |
|
|
Hi everyone,
I am working on a RCP application based on an Ecore meta-model. This application enables to edit a model according to business constraints written in OCL. I am new to the OCL subject.
The meta-model contains unidirectional relations, but the business constraints would need to access the container of a given object or the list of objects referencing a given object.
1) Is it possible ?
I have read the OCL FAQ (questions 2.3 and 2.4) and I am not sure to understand how to use these informations. The two bugs mentioned in 2.4 are marked as FIXED.
2) If it is possible, what is the correct syntax to access the parent/referencing objects ?
I created the simple Ecore meta-model represented in the attached file (Head containing Eye and referencing Heart). I tried to create a sample model, select the objects of this model and use the OCL consoles.
3) Syntax self.oclAsType(ecore::EObject).eContainer() works as expected in the interactive OCL console but not in the interactive Xtext OCL console. Why ?
4) In both consoles, syntax self.head for a Eye or Heart object does not work. If I understand well question 2.4 of the FAQ, this is the syntax I should use. What did I miss ?
I am using OCL all-in-one SDK 5.0.4.
Thanks for your advice,
François
[Updated on: Thu, 04 June 2015 08:53] Report message to a moderator
|
|
|
|
|
Re: Access unnavigable opposites of reference and composition relations in Ecore [message #1697810 is a reply to message #1697784] |
Mon, 08 June 2015 14:55 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
Today, in Luna, the Xtext functionality is part of the new 'examples'
quality Pivot-based OCL that prototypes solution for the OCL 2.5 submission.
On June 26, for Mars, the main 'examples' plugins are promoted to
non-'examples' and are the preferred OCL platform.
If you are interested in the future then you may go with what you see
with the Xtext console.
If you are interested in maximum portability, you should only use what
works on all relevant platforms; at least Dresden OCL and USE too.
Your choice, but as you can see that are many issues at the edge of OCL
where functionality is inadequately specified and consequently
inconsistently implemented. The sooner we get to OCL 2.5 the better.
Regards
Ed Willink
On 08/06/2015 14:15, Francois Cabrol wrote:
> Thank you very much Ed !
>
> But if I use the aforementioned example, and if I select an instance
> of Heart or Eye in one of my sample models then play with the OCL
> consoles, I get the following results:
>
> Calling self.Head on a Eye object (containment reference)
> In the interactive Xtext OCL console, I get the expected result (the
> containing Head object)
> In the interactive OCL console, I get an error: Unrecognized variable:
> (Head)
>
> Calling self.Head on a Heart object (non-containment reference)
> In the interactive Xtext OCL console, I get an empty result
> In the interactive OCL console, I get an error: Unrecognized variable:
> (Head)
>
> Does it mean I can use syntax self.Head in my OCL business constraints ?
>
> Thanks in advance,
>
> François
|
|
|
Powered by
FUDForum. Page generated in 0.02927 seconds