Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Evaluation of derived OCL Ecore attributes from Java
Evaluation of derived OCL Ecore attributes from Java [message #1791710] Wed, 04 July 2018 12:30 Go to next message
Matteo MORELLI is currently offline Matteo MORELLIFriend
Messages: 5
Registered: July 2018
Junior Member
Hello, I'm dealing with a problem with the evaluation of derived Ecore attributes from Java. The derivation rule is annotated in the Ecore metamodel as OCL expression.

My use case matches very well what is described here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=420208 (which comes from a thread here: https://www.eclipse.org/forums/index.php/t/561711/).

It seems that this is not really a bug, but rather bad user initialization. However, I do not understand what to do to workaround the problem.

I made an effort to read about possible solutions. That's what I tried:


  • make sure that Operation Reflection is true
  • explicit Use Delegates = true as annotation
  • Used the following initialization to comply with this statement "SettingDelegateFactory registration must occur before the static initialization of the EMF generated classes" (from https://bugs.eclipse.org/bugs/show_bug.cgi?id=420208)
    String oclDelegateURI = OCLDelegateDomain.OCL_DELEGATE_URI;
    EStructuralFeature.Internal.SettingDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI,
        new OCLSettingDelegateFactory.Global());

  • tried to adopt the solution suggested here https://www.eclipse.org/forums/index.php?t=msg&th=526868&goto=1112295&#msg_1112295 (seems to not be compatible with Oxygen)


You can find here attached (i) a EMF project with a simple metamodel embedding OCL expressions to define derived attributes and (ii) a plugin that shows how I currently do model queries (from Java). The plugin also contains a model instance which conforms to the metamodel (in models/). What I get is, for example, that once I try to access
ca.getModel()
(line 42 in com.test.javaload.dummy.loader.DummyModelLoader) I always get a NPE.

Any suggestion on how to get it working?
Thanks in advance
--
Matteo
Re: Evaluation of derived OCL Ecore attributes from Java [message #1791914 is a reply to message #1791710] Fri, 06 July 2018 20:36 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Try reading https://help.eclipse.org/photon/index.jsp?topic=%2Forg.eclipse.ocl.doc%2Fhelp%2FStandalone.html

Regards

Ed Willink
Previous Topic:Announce OCL 6.4.0
Next Topic:Dynamic OCL Constraints
Goto Forum:
  


Current Time: Fri Apr 26 10:43:40 GMT 2024

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

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

Back to the top