Re: Problem with UNIQUE constraint

On 27 Mar 2002 at 12:48, Jeni Tennison wrote:

> By the way, I think that you're probably using the identity constraint
> incorrectly. If you want to test that each Rec_SelRadioSrvc element
> has a unique combination of LineID and RadioService, then you need to
> place the identity constraint on the declaration of the element that's
> the *parent* of the Rec_SelRadioServc element, as follows:
> 
>   <xs:unique name="ID_SelRadioSrvc">
>     <xs:selector xpath="Rec_SelRadioSrvc"/>
>     <xs:field xpath="LineID"/>
>     <xs:field xpath="RadioService"/>
>   </xs:unique>
> 
> As you currently have it, all you're testing is that the LineID and
> RadioService of one Rec_SelRadioSrvc at a time. There isn't much point
> doing that unless you're using the identity constraint sneakily to
> test a co-occurrence constraint, which I don't think is the case here.

Yes, you are quite right.  I need to change the selector xpath to "*".

Gary

Received on Wednesday, 27 March 2002 19:30:32 UTC