Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Validation does not work for certain models
Validation does not work for certain models [message #417513] Fri, 14 March 2008 09:05 Go to next message
petr is currently offline petrFriend
Messages: 7
Registered: July 2009
Junior Member
Hi,

Does anyone know why the same validation plug-in works for one emf model
and does not work for the other one. It does not use constraint for one
of my models.

my case is following:

true(constraintProvider)
-> validation(constraints)
--> Non-Empty Name(constraint) -> class ModelConstraint.java
--> (description)
--> (message)
--> A(target) // Class from model M1
--> B(target) // Class from model M2
http://first.model1.com (package)
http://first.model2.com (package)

So, model2 is not validated by ModelConstraint

Is there any rule that should be obeyed for an emf model in order to be
able to validate it? Maybe package configuration? I have compared M1 and
M2 but they seem to be similar.

Any idea?

-Petr
Re: Validation does not work for certain models [message #417516 is a reply to message #417513] Fri, 14 March 2008 14:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Petr,

I'm not sure that I quite follow your notation. I think it would be
expanded to the plugin.xml syntax like this:

<constraintProvider>
<package nsURI="http://first.model1.com"/>
<package nsURI="http://first.model2.com"/>
<constraints>
<constraint
id="..."
name="Non-Empty Name"
class="com.first.ModelConstraint">
<description>...</description>
<message>...</message>
<target class="A"/>
<target class="B"/>
</constraints>
</constraintProvider>

Is that roughly correct?

You should be able to attach constraints to any well-formed EMF model. I
can imagine a few reasons why this might not work as you expect:

- the M2 model's package nsURI is not specified by your
constraint provider (but I think you did that).
- the model M1 contains a class with the same name as the B from M2.
In that case, you need to qualify the reference to B as
<target class="M2.B"/>

Is there any relationship between M1 and M2? Do the classes in M2 extend
the classes in M1? If so, constraints defined on M1 classes will only be
applied to their specializations in M2 if M2 is explicitly referenced by
the constraint provider. But, as I said, I think you're already doing
that.

HTH,

Christian


Petr Baranov wrote:

> Hi,
>
> Does anyone know why the same validation plug-in works for one emf model
> and does not work for the other one. It does not use constraint for one
> of my models.
>
> my case is following:
>
> true(constraintProvider)
> -> validation(constraints)
> --> Non-Empty Name(constraint) -> class ModelConstraint.java
> --> (description)
> --> (message)
> --> A(target) // Class from model M1
> --> B(target) // Class from model M2
> http://first.model1.com (package)
> http://first.model2.com (package)
>
> So, model2 is not validated by ModelConstraint
>
> Is there any rule that should be obeyed for an emf model in order to be
> able to validate it? Maybe package configuration? I have compared M1 and
> M2 but they seem to be similar.
>
> Any idea?
>
> -Petr
Re: Validation does not work for certain models [message #418017 is a reply to message #417516] Wed, 02 April 2008 11:00 Go to previous message
petr is currently offline petrFriend
Messages: 7
Registered: July 2009
Junior Member
Hi Christian,

Thank you for your reply.

My problem has been solved now.

Regards,
Petr


Christian W. Damus wrote:
> Hi, Petr,
>
> I'm not sure that I quite follow your notation. I think it would be
> expanded to the plugin.xml syntax like this:
>
> <constraintProvider>
> <package nsURI="http://first.model1.com"/>
> <package nsURI="http://first.model2.com"/>
> <constraints>
> <constraint
> id="..."
> name="Non-Empty Name"
> class="com.first.ModelConstraint">
> <description>...</description>
> <message>...</message>
> <target class="A"/>
> <target class="B"/>
> </constraints>
> </constraintProvider>
>
> Is that roughly correct?
>
> You should be able to attach constraints to any well-formed EMF model. I
> can imagine a few reasons why this might not work as you expect:
>
> - the M2 model's package nsURI is not specified by your
> constraint provider (but I think you did that).
> - the model M1 contains a class with the same name as the B from M2.
> In that case, you need to qualify the reference to B as
> <target class="M2.B"/>
>
> Is there any relationship between M1 and M2? Do the classes in M2 extend
> the classes in M1? If so, constraints defined on M1 classes will only be
> applied to their specializations in M2 if M2 is explicitly referenced by
> the constraint provider. But, as I said, I think you're already doing
> that.
>
> HTH,
>
> Christian
>
>
> Petr Baranov wrote:
>
>> Hi,
>>
>> Does anyone know why the same validation plug-in works for one emf model
>> and does not work for the other one. It does not use constraint for one
>> of my models.
>>
>> my case is following:
>>
>> true(constraintProvider)
>> -> validation(constraints)
>> --> Non-Empty Name(constraint) -> class ModelConstraint.java
>> --> (description)
>> --> (message)
>> --> A(target) // Class from model M1
>> --> B(target) // Class from model M2
>> http://first.model1.com (package)
>> http://first.model2.com (package)
>>
>> So, model2 is not validated by ModelConstraint
>>
>> Is there any rule that should be obeyed for an emf model in order to be
>> able to validate it? Maybe package configuration? I have compared M1 and
>> M2 but they seem to be similar.
>>
>> Any idea?
>>
>> -Petr
>
Previous Topic:[EMF Transactions] No custom NotificationFilters?
Next Topic:ProgressMonitor for XML load/save
Goto Forum:
  


Current Time: Sun May 12 09:08:40 GMT 2024

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

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

Back to the top