Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Different Validation for a model
Different Validation for a model [message #1707102] Wed, 02 September 2015 10:50 Go to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 30
Registered: January 2015
Member
Hi there,

I try to use the same EMF ecore-Model in different contexts, i.e. in
different Eclipse RCP-Products. Each product might have slightly
different business rules under which I want to validate the model.

Is it somehow possible to decouple the EMF validation from the
implementation of the validating methods in order to separate model and
validation rules into separate bundles? Or would that be something I'd
have to add myself, i.e. some mechanism by eclipse extension points to
search for registered validation bundles that validate the model?

Cheers,
Hauke
Re: Different Validation for a model [message #1707109 is a reply to message #1707102] Wed, 02 September 2015 12:19 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6440
Registered: July 2009
Senior Member
Hi

If you use OCL you can separate your validation into OCL documents.
Different applications can select which Complete OCL documents are used.

Regards

Ed Willink


On 02/09/2015 11:50, Hauke Fuhrmann wrote:
> Hi there,
>
> I try to use the same EMF ecore-Model in different contexts, i.e. in
> different Eclipse RCP-Products. Each product might have slightly
> different business rules under which I want to validate the model.
>
> Is it somehow possible to decouple the EMF validation from the
> implementation of the validating methods in order to separate model
> and validation rules into separate bundles? Or would that be something
> I'd have to add myself, i.e. some mechanism by eclipse extension
> points to search for registered validation bundles that validate the
> model?
>
> Cheers,
> Hauke
Re: Different Validation for a model [message #1707332 is a reply to message #1707109] Thu, 03 September 2015 19:34 Go to previous messageGo to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Alternatively, you can use EMF Validation Framework. It provides an ability to write constraints as Java/OCL code, provide them via plugin.xml and split you constraints between bundles.
Re: Different Validation for a model [message #1707362 is a reply to message #1707109] Fri, 04 September 2015 07:07 Go to previous messageGo to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 30
Registered: January 2015
Member
Hi Ed,

thanks for pointing to OCL. I wrote a Complete OCL file now, which
worked fine for my model. However, I do not find much information how to
connect the ecore with the OCL file. I.e. I want to express that the
usual EMF validation should delegate to this OCL validation using my OCL
file.
Did not find any extension point for that.

The documentation only briefly describes

"The CompleteOCLEObjectValidator is used to enable Complete OCL
documents to participate in the validation processing of an Xtext editor.
The APIs for merging Complete OCL and Ecore as intermediate Pivots and
then migrating the Pivot back to Ecore are experimental."

As I have no Xtext model but a plain ecore file, I'm a little lost how
to actually connect the things such that the validation can be used from
the usual ecore-tree-editor and pop up in the problem view.

Any hints where to look?

Cheers,
Hauke
Re: Different Validation for a model [message #1707402 is a reply to message #1707362] Fri, 04 September 2015 13:29 Go to previous messageGo to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 30
Registered: January 2015
Member
I found a recipe for my use case in the Eclipse wiki. Very glad for that.
I follow this recipe to connect my custom Ecore file with my custom
ocl-File: http://wiki.eclipse.org/EMF/Validation/Recipes

However, the recipe suggests to reuse some example projects which
results in having three additional projects with 9 Java classes and a
lot of plugin.xml config (e.g. editorActions) to glue everything
together. This is quite some unexpected overhead boilerplate code from
my point of view.

Is this really the way to use an CompleteOCL file?

Any opinion appreciated.

Cheers,
Hauke

Am 04.09.2015 09:07, schrieb Hauke Fuhrmann:
> Hi Ed,
>
> thanks for pointing to OCL. I wrote a Complete OCL file now, which
> worked fine for my model. However, I do not find much information how to
> connect the ecore with the OCL file. I.e. I want to express that the
> usual EMF validation should delegate to this OCL validation using my OCL
> file.
> Did not find any extension point for that.
>
> The documentation only briefly describes
>
> "The CompleteOCLEObjectValidator is used to enable Complete OCL
> documents to participate in the validation processing of an Xtext editor.
> The APIs for merging Complete OCL and Ecore as intermediate Pivots and
> then migrating the Pivot back to Ecore are experimental."
>
> As I have no Xtext model but a plain ecore file, I'm a little lost how
> to actually connect the things such that the validation can be used from
> the usual ecore-tree-editor and pop up in the problem view.
>
> Any hints where to look?
>
> Cheers,
> Hauke
Re: Different Validation for a model [message #1707411 is a reply to message #1707402] Fri, 04 September 2015 14:36 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6440
Registered: July 2009
Senior Member
Hi

No.

You will get on much better by following the up-to-date material in the
OCL documentation.

The wiki is a valiant effort in 2008 to make sense of a seriously
prehistoric approach. I did some minor repair work in 2012 to refer to
the OCLinEcore editor.

But this is not the way to go. See my reply on the OCL newsgroup.

Regards

Ed Willink


On 04/09/2015 14:29, Hauke Fuhrmann wrote:
> I found a recipe for my use case in the Eclipse wiki. Very glad for that.
> I follow this recipe to connect my custom Ecore file with my custom
> ocl-File: http://wiki.eclipse.org/EMF/Validation/Recipes
>
> However, the recipe suggests to reuse some example projects which
> results in having three additional projects with 9 Java classes and a
> lot of plugin.xml config (e.g. editorActions) to glue everything
> together. This is quite some unexpected overhead boilerplate code from
> my point of view.
>
> Is this really the way to use an CompleteOCL file?
>
> Any opinion appreciated.
>
> Cheers,
> Hauke
>
> Am 04.09.2015 09:07, schrieb Hauke Fuhrmann:
>> Hi Ed,
>>
>> thanks for pointing to OCL. I wrote a Complete OCL file now, which
>> worked fine for my model. However, I do not find much information how to
>> connect the ecore with the OCL file. I.e. I want to express that the
>> usual EMF validation should delegate to this OCL validation using my OCL
>> file.
>> Did not find any extension point for that.
>>
>> The documentation only briefly describes
>>
>> "The CompleteOCLEObjectValidator is used to enable Complete OCL
>> documents to participate in the validation processing of an Xtext
>> editor.
>> The APIs for merging Complete OCL and Ecore as intermediate Pivots and
>> then migrating the Pivot back to Ecore are experimental."
>>
>> As I have no Xtext model but a plain ecore file, I'm a little lost how
>> to actually connect the things such that the validation can be used from
>> the usual ecore-tree-editor and pop up in the problem view.
>>
>> Any hints where to look?
>>
>> Cheers,
>> Hauke
>
Previous Topic:EReference Tree
Next Topic:[EMF] long loading time
Goto Forum:
  


Current Time: Sat Aug 24 11:21:09 GMT 2019

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

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

Back to the top