Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF] Validation framework: constrain instances (instead of classes)
[EMF] Validation framework: constrain instances (instead of classes) [message #1368979] Tue, 20 May 2014 11:10 Go to next message
Bertrand Quenin is currently offline Bertrand Quenin
Messages: 70
Registered: July 2009
Member
Hi,

I'm currently working with OCL constraints and I was wondering if it's possible to add constraints specific to an instance (a given EObject, as opposed to a constraint on an EClass, which applies to all instances of this class).

I didn't see anything like this available and I wanted to ask before developing my own validator.

Regards,
BQ.
Re: [EMF] Validation framework: constrain instances (instead of classes) [message #1369198 is a reply to message #1368979] Tue, 20 May 2014 13:17 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 803
Registered: July 2009
Senior Member
Hi, BQ,

No, this sort of use case is what the filtering of constraints using
IConstraintFilters attached to an IValidator is intended for. You
shouldn't need to create your own validator for this.

Cheers,

Christian

On 2014-05-20 11:10:24 +0000, Bertrand Quenin said:

> Hi,
>
> I'm currently working with OCL constraints and I was wondering if it's
> possible to add constraints specific to an instance (a given EObject,
> as opposed to a constraint on an EClass, which applies to all instances
> of this class).
>
> I didn't see anything like this available and I wanted to ask before
> developing my own validator.
>
> Regards,
> BQ.
Re: [EMF] Validation framework: constrain instances (instead of classes) [message #1369468 is a reply to message #1369198] Tue, 20 May 2014 15:51 Go to previous messageGo to next message
Bertrand Quenin is currently offline Bertrand Quenin
Messages: 70
Registered: July 2009
Member
Ok, thanks. It seems related to EMF validation framework and I only used the diagnostician for now. I'm going to have a look at this.
Re: [EMF] Validation framework: constrain instances (instead of classes) [message #1369701 is a reply to message #1369468] Tue, 20 May 2014 18:01 Go to previous message
Christian W. Damus is currently offline Christian W. Damus
Messages: 803
Registered: July 2009
Senior Member
Hi,

Sorry, I assumed you were working with that other framework because you
mentioned implementing a custom validator (in the intrinsic EMF
framework, validators are generated for us). In your case, constraints
are declared (and optionally defined) in the Ecore model, so naturally
there is no tie-in to specific instances.

So, yes, probably you'll be implementing your own EValidator (to wrap
the one that's generated for you) and it can decide which constraints
to evaluate on which objects.

Cheers,

Christian


On 2014-05-20 15:51:33 +0000, Bertrand Quenin said:

> Ok, thanks. It seems related to EMF validation framework and I only
> used the diagnostician for now. I'm going to have a look at this.
Previous Topic:[EMF Query] Using EMF Query outside Eclipse (with OCL)
Next Topic:[ChangeRecoder] Problem with beginRecording() after endRecording() was called
Goto Forum:
  


Current Time: Sun Oct 26 07:48:42 GMT 2014

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

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