Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Validation of OCL Constraints programmatically outside Eclipse
Validation of OCL Constraints programmatically outside Eclipse [message #557674] Wed, 08 September 2010 13:45 Go to next message
Simon harrer is currently offline Simon harrerFriend
Messages: 25
Registered: August 2010
Junior Member
I have an ecore model with OCL invariants inside which I created using the OCLinEcore editor.

Now, i wanted to validate them using the EMF Validation Framework.

But they are not executed as no error occurs.

My Validation Code:
List<EObject> objects = resource.getContents(); // objects to validate
		// create a validator
		IValidator validator = ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);
		// use it!
		IStatus results = validator.validate(objects);

		if (!results.isOK()) {
			mismatchDescription.appendText(results.getMessage());
			return false;
		}
		
		return true;


any ideas how to enable validation also for OCL invariants? I know that a validation class was generated using the genmodel generate options. But I haven't found information how to link these validators to the emf validation framework.

Best regards,
Simon
Re: Validation of OCL Constraints programmatically outside Eclipse [message #557739 is a reply to message #557674] Wed, 08 September 2010 16:19 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Simon

I've answered this imminent FAQ by adding a registration section to the
end of http://wiki.eclipse.org/MDT/OCLinEcore Please report any bugs.

Regards

Ed Willink

On 08/09/2010 14:45, Simon harrer wrote:
> I have an ecore model with OCL invariants inside which I created using
> the OCLinEcore editor.
> Now, i wanted to validate them using the EMF Validation Framework.
> But they are not executed as no error occurs.
> My Validation Code:
>
> List<EObject> objects = resource.getContents(); // objects to validate
> // create a validator
> IValidator validator =
> ModelValidationService.getInstance().newValidator(Evaluation Mode.BATCH);
> // use it!
> IStatus results = validator.validate(objects);
>
> if (!results.isOK()) {
> mismatchDescription.appendText(results.getMessage());
> return false;
> }
>
> return true;
>
>
> any ideas how to enable validation also for OCL invariants? I know that
> a validation class was generated using the genmodel generate options.
> But I haven't found information how to link these validators to the emf
> validation framework.
> Best regards,
> Simon
Previous Topic:Some OCL beginner questions
Next Topic:M2M/QVTd OCL editor
Goto Forum:
  


Current Time: Thu Mar 28 15:18:42 GMT 2024

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

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

Back to the top