Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Validation Framework] Validating extended models.
[Validation Framework] Validating extended models. [message #430596] Thu, 28 May 2009 18:08 Go to next message
Juan Pedro Silva is currently offline Juan Pedro SilvaFriend
Messages: 258
Registered: July 2009
Senior Member
Hi everybody.
I'm trying to use the validation framework through invariant operations
included in the ecore models (as described in the EMF book, second
edition, chapter 18), and launching the validation from within the
generated editor (runtime workbench).
I'm working on an extended EMF model, in a similar way to what is
described in the "Generating an Extended EMF Model" tutorial.

My problem is that if i run the validation on the root element (instance
of a meta-class declared on the base metamodel), the child elements
which are instances of the extension metamodel are not validated.
If the validation is run while selecting an element instance of a
meta-class declared on the extension metamodel, those constraints are
correctly evaluated. Most probably the cause is that the base model
validator is not aware of the extension model validator, and therefore
this one is not called at all.

The question would be, is there a way to make the validation of the base
metamodel include the extension metamodel constraints?. Ideally, without
the base model/code knowing about it. If not, perhaps modifying the base
metamodel generated code. I believe I will have to get the base
metamodel diagnostician or context or similar, and pass it to the
extension validator, but I don't know exactly what to pass and where to
pass it.

Any help will be greatly appreciated.
Best regards,
Juan Pedro
Re: [Validation Framework] Validating extended models. [message #430597 is a reply to message #430596] Thu, 28 May 2009 20:48 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Juan Pedro,

Comments below.

Juan Pedro Silva wrote:
> Hi everybody.
> I'm trying to use the validation framework through invariant
> operations included in the ecore models (as described in the EMF book,
> second edition, chapter 18), and launching the validation from within
> the generated editor (runtime workbench).
> I'm working on an extended EMF model, in a similar way to what is
> described in the "Generating an Extended EMF Model" tutorial.
>
> My problem is that if i run the validation on the root element
> (instance of a meta-class declared on the base metamodel), the child
> elements which are instances of the extension metamodel are not
> validated.
I wouldn't expect such a problem...
> If the validation is run while selecting an element instance of a
> meta-class declared on the extension metamodel, those constraints are
> correctly evaluated. Most probably the cause is that the base model
> validator is not aware of the extension model validator, and therefore
> this one is not called at all.
The EClass of each instance object should be considered and the package
for that class is determined, and the validator for that package is
used. Base classes are considered if the that package has no
validator. So goes the theory...
>
> The question would be, is there a way to make the validation of the
> base metamodel include the extension metamodel constraints?.
The validation should be dispatched to the right validator for the
derived model, but it's possible there's a bug I suppose.
> Ideally, without the base model/code knowing about it. If not, perhaps
> modifying the base metamodel generated code. I believe I will have to
> get the base metamodel diagnostician or context or similar, and pass
> it to the extension validator, but I don't know exactly what to pass
> and where to pass it.
Can you share an example illustrating the problem so I can analyze
what's going on... You've tried this with EMF 2.5?
>
> Any help will be greatly appreciated.
If I can reproduce the problem I'll help...
> Best regards,
> Juan Pedro


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Validation Framework] Validating extended models. [message #430603 is a reply to message #430597] Fri, 29 May 2009 10:44 Go to previous messageGo to next message
Juan Pedro Silva is currently offline Juan Pedro SilvaFriend
Messages: 258
Registered: July 2009
Senior Member
Ed, thanks for your interest.
I spent all morning trying to reproduce this behavior, regenerating the
project in different workbenches, tried Galileo and EMF 2.5 etc., only
to find that some containment reference in the base model had been
accidentally marked "derived", so no code was generated for it, and
therefore the validation chain was broken (I believe). Correcting this
fixed the problem. I don't know if this information is useful, but just
in case.

Once again, thanks for your help, for which I'm always grateful.
Regards,
Juan Pedro


Ed Merks escribió:
> Juan Pedro,
>
> Comments below.
>
> Juan Pedro Silva wrote:
>> Hi everybody.
>> I'm trying to use the validation framework through invariant
>> operations included in the ecore models (as described in the EMF
>> book, second edition, chapter 18), and launching the validation from
>> within the generated editor (runtime workbench).
>> I'm working on an extended EMF model, in a similar way to what is
>> described in the "Generating an Extended EMF Model" tutorial.
>>
>> My problem is that if i run the validation on the root element
>> (instance of a meta-class declared on the base metamodel), the child
>> elements which are instances of the extension metamodel are not
>> validated.
> I wouldn't expect such a problem...
>> If the validation is run while selecting an element instance of a
>> meta-class declared on the extension metamodel, those constraints are
>> correctly evaluated. Most probably the cause is that the base model
>> validator is not aware of the extension model validator, and
>> therefore this one is not called at all.
> The EClass of each instance object should be considered and the
> package for that class is determined, and the validator for that
> package is used. Base classes are considered if the that package has
> no validator. So goes the theory...
>>
>> The question would be, is there a way to make the validation of the
>> base metamodel include the extension metamodel constraints?.
> The validation should be dispatched to the right validator for the
> derived model, but it's possible there's a bug I suppose.
>> Ideally, without the base model/code knowing about it. If not,
>> perhaps modifying the base metamodel generated code. I believe I will
>> have to get the base metamodel diagnostician or context or similar,
>> and pass it to the extension validator, but I don't know exactly what
>> to pass and where to pass it.
> Can you share an example illustrating the problem so I can analyze
> what's going on... You've tried this with EMF 2.5?
>>
>> Any help will be greatly appreciated.
> If I can reproduce the problem I'll help...
>> Best regards,
>> Juan Pedro
Re: [Validation Framework] Validating extended models. [message #430605 is a reply to message #430603] Fri, 29 May 2009 10:50 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Juan Pedro,

Thanks for letting me know. I would have been surprised if this was so
fundamentally broken...


Juan Pedro Silva wrote:
> Ed, thanks for your interest.
> I spent all morning trying to reproduce this behavior, regenerating
> the project in different workbenches, tried Galileo and EMF 2.5 etc.,
> only to find that some containment reference in the base model had
> been accidentally marked "derived", so no code was generated for it,
> and therefore the validation chain was broken (I believe). Correcting
> this fixed the problem. I don't know if this information is useful,
> but just in case.
>
> Once again, thanks for your help, for which I'm always grateful.
> Regards,
> Juan Pedro
>
>
> Ed Merks escribió:
>> Juan Pedro,
>>
>> Comments below.
>>
>> Juan Pedro Silva wrote:
>>> Hi everybody.
>>> I'm trying to use the validation framework through invariant
>>> operations included in the ecore models (as described in the EMF
>>> book, second edition, chapter 18), and launching the validation from
>>> within the generated editor (runtime workbench).
>>> I'm working on an extended EMF model, in a similar way to what is
>>> described in the "Generating an Extended EMF Model" tutorial.
>>>
>>> My problem is that if i run the validation on the root element
>>> (instance of a meta-class declared on the base metamodel), the child
>>> elements which are instances of the extension metamodel are not
>>> validated.
>> I wouldn't expect such a problem...
>>> If the validation is run while selecting an element instance of a
>>> meta-class declared on the extension metamodel, those constraints
>>> are correctly evaluated. Most probably the cause is that the base
>>> model validator is not aware of the extension model validator, and
>>> therefore this one is not called at all.
>> The EClass of each instance object should be considered and the
>> package for that class is determined, and the validator for that
>> package is used. Base classes are considered if the that package has
>> no validator. So goes the theory...
>>>
>>> The question would be, is there a way to make the validation of the
>>> base metamodel include the extension metamodel constraints?.
>> The validation should be dispatched to the right validator for the
>> derived model, but it's possible there's a bug I suppose.
>>> Ideally, without the base model/code knowing about it. If not,
>>> perhaps modifying the base metamodel generated code. I believe I
>>> will have to get the base metamodel diagnostician or context or
>>> similar, and pass it to the extension validator, but I don't know
>>> exactly what to pass and where to pass it.
>> Can you share an example illustrating the problem so I can analyze
>> what's going on... You've tried this with EMF 2.5?
>>>
>>> Any help will be greatly appreciated.
>> If I can reproduce the problem I'll help...
>>> Best regards,
>>> Juan Pedro


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Strange exception when starting plug-in in new Eclipse instance
Next Topic:Generated Classes and Packages names
Goto Forum:
  


Current Time: Thu Apr 25 01:02:39 GMT 2024

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

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

Back to the top