Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Constraints with OCLInEcore across multiple model files
Constraints with OCLInEcore across multiple model files [message #1236974] Tue, 28 January 2014 09:17 Go to next message
Tilman Stehr is currently offline Tilman Stehr
Messages: 3
Registered: August 2013
Junior Member
Hi,

I'm trying to implement OCL constraints with OCLInEcore for an Ecore model that is split across multiple *.ecore model files. The architecture consists of a "base" file that contains base types and several "extension" files which provide specialized types extending the base types.

The constraints defined in the model file seem to work, but only as long as they use types that are defined in the same *.ecore file. When I try to use types defined in another file however, for example by calling oclAsType, validation fails. My guess is that the other model file is not available and therefore its type can't be resolved when evaluating the constraint.

Is it possible to get this to work? Do I have to somehow register all models that are needed in the constraints and provide paths to the *.ecore files?

I tested this with OCL 4.1.1 running on Eclipse Kelper and EMF 2.9

I'd be very grateful for any hints.
Tilman
Re: Constraints with OCLInEcore across multiple model files [message #1236994 is a reply to message #1236974] Tue, 28 January 2014 10:33 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4036
Registered: July 2009
Senior Member
Hi

Your guess was right. Essential OCL had no way to reference external models.

Eclipse OCL therefore has an extension which will likely be in OCL 2.5
in which the first name in a qualified name may be a quoted URI. If you
look at the OCL in your Ecore files your should see these.

However only the new Pivot-based parser supports this, so I'm hoping
that under the OCL preferences you have selected the LPG parser. If you
change this to Pivot you should get on better.

In the OCLinEcore there is a Set Excport Delegate URI that can ensure
that files get written to require the evaluator you want.

Regards

Ed Willink


On 28/01/2014 15:00, Tilman Stehr wrote:
> Hi,
>
> I'm trying to implement OCL constraints with OCLInEcore for an Ecore
> model that is split across multiple *.ecore model files. The
> architecture consists of a "base" file that contains base types and
> several "extension" files which provide specialized types extending
> the base types.
>
> The constraints defined in the model file seem to work, but only as
> long as they use types that are defined in the same *.ecore file.
> When I try to use types defined in another file however, for example
> by calling oclAsType, validation fails. My guess is that the other
> model file is not available and therefore its type can't be resolved
> when evaluating the constraint.
>
> Is it possible to get this to work? Do I have to somehow register all
> models that are needed in the constraints and provide paths to the
> *.ecore files?
> I tested this with OCL 4.1.1 running on Eclipse Kelper and EMF 2.9
>
> I'd be very grateful for any hints.
> Tilman
Re: Constraints with OCLInEcore across multiple model files [message #1238135 is a reply to message #1236994] Fri, 31 January 2014 08:47 Go to previous messageGo to next message
Tilman Stehr is currently offline Tilman Stehr
Messages: 3
Registered: August 2013
Junior Member
Hi Ed,

Thanks for your answer. Yes I'm using the Pivot parser in an RCP application.

Following your hint I have tried to qualify my references with the namespace uri for the model and also the platform uri for the model file. But no matter what I enter, the evaluation of the constraint still fails. Could this be related to the fact that I'm running from an RCP environment?

I can provide a minimal example of the problem if you think it would help resolve the problem.

Regards
Tilman
Re: Constraints with OCLInEcore across multiple model files [message #1238147 is a reply to message #1238135] Fri, 31 January 2014 09:08 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4036
Registered: July 2009
Senior Member
Hi

I've not used the RCP environment for a long time and never for OCL, so
there may be a stupid problem.

A full small repro would be very helpful.

It looks like there probably is a problem so pleaswe attach it to a
Bugzilla. You can send the attachment to me privately if you have
confidentiality problems.)

Regards

Ed Willink


On 31/01/2014 13:47, Tilman Stehr wrote:
> Hi Ed,
> Thanks for your answer. Yes I'm using the Pivot parser in an RCP
> application.
> Following your hint I have tried to qualify my references with the
> namespace uri for the model and also the platform uri for the model
> file. But no matter what I enter, the evaluation of the constraint
> still fails. Could this be related to the fact that I'm running from
> an RCP environment?
>
> I can provide a minimal example of the problem if you think it would
> help resolve the problem.
>
> Regards Tilman
Re: Constraints with OCLInEcore across multiple model files [message #1264709 is a reply to message #1236974] Wed, 05 March 2014 07:37 Go to previous message
Tilman Stehr is currently offline Tilman Stehr
Messages: 3
Registered: August 2013
Junior Member
Hi

I have created a bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=429657) with a working example. I hope this allows you to reproduce this problem.

Kind regards,
Tilman
Previous Topic:Enum value not recognized?
Next Topic:OCLHelper.getSyntaxHelp for properties on association ends
Goto Forum:
  


Current Time: Mon Sep 01 17:06:24 EDT 2014

Powered by FUDForum. Page generated in 0.01659 seconds