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: (which comes from a thread here:

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
    String oclDelegateURI = OCLDelegateDomain.OCL_DELEGATE_URI;
        new OCLSettingDelegateFactory.Global());

  • tried to adopt the solution suggested here (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
(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
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: 7665
Registered: July 2009
Senior Member

Try reading


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

Current Time: Sat Jul 20 12:10:30 GMT 2024

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

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

Back to the top