Home » Modeling » OCL » Navigating over eContainer()
|
Re: Navigating over eContainer() [message #486877 is a reply to message #486862] |
Sun, 20 September 2009 15:58 |
Eclipse User |
|
|
|
Originally posted by: dvorak.radek.gmail.com
Hi Derek,
You can set the "implicit root class" parser option to EObject and then
ecore reflective operations
like eClass(), eCotainer() should be available.
The Stdlib of QVT comes with Element::container().
Regards,
/Radek
On Sun, 20 Sep 2009 12:04:04 +0200, Derek Palma <derek.palma@gmail.com>
wrote:
> Hi,
>
> I have Ecore models with EClass A having a reference to EClass B, a
> composition where A 'owns' B. The reference is configured with
> setContainment(true). There is no opposite relation because I don't have
> it/want it/need it. Is there a way to navigate from an instance of B
> back to an instance of A with OCL? As far as I can see, it seems
> B.eContainer() would have to be used by OCL to achieve this. Is there a
> syntax for this?
>
> Thanks in advance.
> Derek
|
|
|
Re: Navigating over eContainer() [message #486921 is a reply to message #486877] |
Mon, 21 September 2009 03:40 |
Derek Palma Messages: 141 Registered: July 2009 |
Senior Member |
|
|
Thanks Radek!!!
I searched the java doc and found the option in ParsingOptions.
Unfortunately, I just don't get how to specify the parameters due to some
lack of understanding of Java generics I guess.
Here is what I have. I tried EObject in the 3rd parameter but it does not
like it. Oddly I found no code in my environment setting this option which I
could refer to. Please tell me the magical syntax. :)
Derek
Environment<EPackage, EClassifier, EOperation, EStructuralFeature,
EEnumLiteral, EParameter, EObject, CallOperationAction, SendSignalAction,
Constraint, EClass, EObject>
rootEnv = EcoreEnvironmentFactory.INSTANCE.createEnvironment();
ParsingOptions.setOption(rootEnv, ParsingOptions.implicitRootClass(rootEnv),
<What goes here????>);
"radek dvorak" <dvorak.radek@gmail.com> wrote in message
news:op.u0khhsom12y5f2@kliste.local...
> Hi Derek,
>
> You can set the "implicit root class" parser option to EObject and then
> ecore reflective operations
> like eClass(), eCotainer() should be available.
>
> The Stdlib of QVT comes with Element::container().
>
> Regards,
> /Radek
>
>
>
> On Sun, 20 Sep 2009 12:04:04 +0200, Derek Palma <derek.palma@gmail.com>
> wrote:
>
>> Hi,
>>
>> I have Ecore models with EClass A having a reference to EClass B, a
>> composition where A 'owns' B. The reference is configured with
>> setContainment(true). There is no opposite relation because I don't have
>> it/want it/need it. Is there a way to navigate from an instance of B
>> back to an instance of A with OCL? As far as I can see, it seems
>> B.eContainer() would have to be used by OCL to achieve this. Is there a
>> syntax for this?
>>
>> Thanks in advance.
>> Derek
|
|
|
Re: Navigating over eContainer() [message #486927 is a reply to message #486921] |
Mon, 21 September 2009 05:30 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi Derek
The org.eclipse.ocl.ecore.tests.ParsingOptionsTest JUnit test does
ParsingOptions.setOption(ocl.getEnvironment(),
ParsingOptions.implicitRootClass(ocl.getEnvironment()),
EcorePackage.Literals.EOBJECT);
This should not be necessary. The OCL 2.0 specification is hardly clear
but your meta-model types conform to OclAny and Classifier so any
operation of Classifier, such as container() should work. Hopefully
fixed in the next release.
Regards
Ed Willink
Derek Palma wrote:
> Thanks Radek!!!
>
> I searched the java doc and found the option in ParsingOptions.
> Unfortunately, I just don't get how to specify the parameters due to
> some lack of understanding of Java generics I guess.
>
> Here is what I have. I tried EObject in the 3rd parameter but it does
> not like it. Oddly I found no code in my environment setting this option
> which I could refer to. Please tell me the magical syntax. :)
>
> Derek
>
> Environment<EPackage, EClassifier, EOperation, EStructuralFeature,
> EEnumLiteral, EParameter, EObject, CallOperationAction,
> SendSignalAction, Constraint, EClass, EObject>
>
> rootEnv = EcoreEnvironmentFactory.INSTANCE.createEnvironment();
>
> ParsingOptions.setOption(rootEnv,
> ParsingOptions.implicitRootClass(rootEnv), <What goes here????>);
>
>
>
>
>
> "radek dvorak" <dvorak.radek@gmail.com> wrote in message
> news:op.u0khhsom12y5f2@kliste.local...
>> Hi Derek,
>>
>> You can set the "implicit root class" parser option to EObject and
>> then ecore reflective operations
>> like eClass(), eCotainer() should be available.
>>
>> The Stdlib of QVT comes with Element::container().
>>
>> Regards,
>> /Radek
>>
>>
>>
>> On Sun, 20 Sep 2009 12:04:04 +0200, Derek Palma
>> <derek.palma@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have Ecore models with EClass A having a reference to EClass B, a
>>> composition where A 'owns' B. The reference is configured with
>>> setContainment(true). There is no opposite relation because I don't
>>> have it/want it/need it. Is there a way to navigate from an instance
>>> of B back to an instance of A with OCL? As far as I can see, it seems
>>> B.eContainer() would have to be used by OCL to achieve this. Is there
>>> a syntax for this?
>>>
>>> Thanks in advance.
>>> Derek
>
|
|
|
Goto Forum:
Current Time: Sun Apr 28 21:21:55 GMT 2024
Powered by FUDForum. Page generated in 0.04120 seconds
|