Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » [Complete OCL] Parsing option to support EObject as implicit root class ?
[Complete OCL] Parsing option to support EObject as implicit root class ? [message #1433895] Mon, 29 September 2014 11:37 Go to next message
Olivier Melois is currently offline Olivier MeloisFriend
Messages: 14
Registered: March 2012
Junior Member
Hello.

When evaluating OCL operations programmatically, I would like to cast UML elements as EObjects, in order to call operations such as eContainingFeature. The code I was formerly using, which was based on the classic API, was doing the following :

OCl ocl = ... 
ParsingOptions.setOption(ocl.getEnvironment(), ParsingOptions.implicitRootClass(ocl.getEnvironment()), EcorePackage.Literals.EOBJECT); 


However the org.eclipse.ocl.examples.pivot.options.ParsingOptions#IMPLICIT_ROOT_CLASS is marked as deprecated. Is there a way / a workaround to allow casting into the EObject type ? Currently, when evaluating such a cast, I have the following error message : Incompatible source type: 'UML::Package' for oclAsType(ecore::EObject)

Regards,

Olivier

Re: [Complete OCL] Parsing option to support EObject as implicit root class ? [message #1434157 is a reply to message #1433895] Mon, 29 September 2014 19:03 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I think that most of the EObject use cases are addressed without the
cast. So oclContainer() for eContainer(), oclType() for eClass().
Stereotype navigation now has a type safe syntax.

The Pivot OCL supports OMG OCL not EOCL, so UML::Package is not an
EObject specification wise.

Regards

Ed Willink

On 29/09/2014 13:37, Olivier Melois wrote:
> Hello.
> When evaluating OCL operations programmatically, I would like to cast
> UML elements as EObjects, in order to call operations such as
> eContainingFeature. The code I was formerly using, which was based on
> the classic API, was doing the following :
> OCl ocl = ... ParsingOptions.setOption(ocl.getEnvironment(),
> ParsingOptions.implicitRootClass(ocl.getEnvironment()),
> EcorePackage.Literals.EOBJECT);
> However the
> org.eclipse.ocl.examples.pivot.options.ParsingOptions#IMPLICIT_ROOT_CLASS is
> marked as deprecated. Is there a way / a workaround to allow casting
> into the EObject type ? Currently, when evaluating such a cast, I have
> the following error message : Incompatible source type: 'UML::Package'
> for oclAsType(ecore::EObject)
> Regards,
> Olivier
>
>
Previous Topic:Announcing Eclipse OCL 5.0.2 for Luna
Next Topic: validating OCL Complete File on models in papyrus
Goto Forum:
  


Current Time: Fri Apr 19 19:44:44 GMT 2024

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

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

Back to the top