Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » OCL already defined
OCL already defined [message #45316] Fri, 18 August 2006 10:05 Go to next message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
HI all I am working on an OCL Console Interpreter extention:

I can define Defines and evaluate expressions which can use the defines.
I have one problem, everytime I evaluate a expression I create a new
IOCLHelper:
IOCLHelper helper = HelperUtil .createOCLHelper(new
EcoreEnvironmentFactory( new
DelegatingPackageRegistry(context.eResource()
..getResourceSet().getPackageRegistry(), EPackage.Registry.INSTANCE)));

After that I register all defines:
for (Iterator iter = defines.iterator(); iter.hasNext();) {
OCLDefine element = (OCLDefine) iter.next();
helper.define(element.getOclExpression());
}

Then I evaluate the expression.

When I call this a second time I always get this error:
ERROR in (defCS): (Operation (getSubroles(Role)) already defined in type
(Role))

Whats my error where are the defines persisted from one to the next call?
Re: OCL already defined [message #45364 is a reply to message #45316] Fri, 18 August 2006 16:57 Go to previous message
Christian Vogt is currently offline Christian VogtFriend
Messages: 11
Registered: July 2009
Junior Member
Hi Chris,

The defined operations (and properties) are stored within a
AdditionalFeatureAdapter which gets added to the adapters list of the, in
your case, Role EClassifier. This is what allow subsequent OCL expressions
to utlize them.

If you want to explicitly clear the additional features you can use the
static method:
TypeUtil.undefineAdditionalFeatures(EClassifier)

Since you seem to be using a new EcoreEnvironment for each evaluation, you
wouldn't expect the defines to be present in the next OCL expression.
These defines should probably only be present within the same
EcoreEnvironment in which they were defined. I raised the following
bugzilla to track this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=154371

HTH,
Christian Vogt


Chris Lenz wrote:

> HI all I am working on an OCL Console Interpreter extention:

> I can define Defines and evaluate expressions which can use the defines.
> I have one problem, everytime I evaluate a expression I create a new
> IOCLHelper:
> IOCLHelper helper = HelperUtil .createOCLHelper(new
> EcoreEnvironmentFactory( new
> DelegatingPackageRegistry(context.eResource()
> ..getResourceSet().getPackageRegistry(), EPackage.Registry.INSTANCE)));

> After that I register all defines:
> for (Iterator iter = defines.iterator(); iter.hasNext();) {
> OCLDefine element = (OCLDefine) iter.next();
> helper.define(element.getOclExpression());
> }

> Then I evaluate the expression.

> When I call this a second time I always get this error:
> ERROR in (defCS): (Operation (getSubroles(Role)) already defined in type
> (Role))

> Whats my error where are the defines persisted from one to the next call?
Re: OCL already defined [message #585531 is a reply to message #45316] Fri, 18 August 2006 16:57 Go to previous message
Christian Vogt is currently offline Christian VogtFriend
Messages: 11
Registered: July 2009
Junior Member
Hi Chris,

The defined operations (and properties) are stored within a
AdditionalFeatureAdapter which gets added to the adapters list of the, in
your case, Role EClassifier. This is what allow subsequent OCL expressions
to utlize them.

If you want to explicitly clear the additional features you can use the
static method:
TypeUtil.undefineAdditionalFeatures(EClassifier)

Since you seem to be using a new EcoreEnvironment for each evaluation, you
wouldn't expect the defines to be present in the next OCL expression.
These defines should probably only be present within the same
EcoreEnvironment in which they were defined. I raised the following
bugzilla to track this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=154371

HTH,
Christian Vogt


Chris Lenz wrote:

> HI all I am working on an OCL Console Interpreter extention:

> I can define Defines and evaluate expressions which can use the defines.
> I have one problem, everytime I evaluate a expression I create a new
> IOCLHelper:
> IOCLHelper helper = HelperUtil .createOCLHelper(new
> EcoreEnvironmentFactory( new
> DelegatingPackageRegistry(context.eResource()
> ..getResourceSet().getPackageRegistry(), EPackage.Registry.INSTANCE)));

> After that I register all defines:
> for (Iterator iter = defines.iterator(); iter.hasNext();) {
> OCLDefine element = (OCLDefine) iter.next();
> helper.define(element.getOclExpression());
> }

> Then I evaluate the expression.

> When I call this a second time I always get this error:
> ERROR in (defCS): (Operation (getSubroles(Role)) already defined in type
> (Role))

> Whats my error where are the defines persisted from one to the next call?
Previous Topic:OCL already defined
Next Topic:EMFT-JET 0.7.1 Build Announcements
Goto Forum:
  


Current Time: Sat Dec 21 16:45:21 GMT 2024

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

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

Back to the top