Re: [Bug 11716] Identity constraints: grammatical typo

>> Secondly, I think it's almost certainly intended that the key
>> sequence for each selected node should contain one value (or absent)
>> for each field in the constraint, and the rules fail to ensure this,
>> especially in the case where the field expression selects an empty
>> node-sequence.
> So I think we disagree here about a matter of substance, which
> none-the-less, curiously, doesn't affect any visible aspect of
> processor behaviour (I don't think).

Actually, this is very close to the user enquiry which led me to start 
this thread.

Given this schema:

<xs:element name="root">
   . . .
   <xs:key name="regKey">  <!-- or xs:unique -->
    <xs:selector xpath=".//vehicle"/>
    <xs:field xpath="@national-reg"/>
    <xs:field xpath="@local-reg"/>
   </xs:key>
  </xs:element>

is this instance valid?

<root>
<vehicle local-reg="ABC123"/>
<vehicle national-reg="ABC123"/>
</root>

My assumption has been that the two key sequences are (.absent., 
"ABC123") and ("ABC123", .absent.) respectively, and these are not 
equal. However, when I responded to the user on this one, I overlooked 
the impact of clause 4, whose effect appears to be:

* for xs:key, the instance is invalid because the target node set and 
qualified node-set are not equal

* for xs:unique, the instance is valid because the qualified node-set is 
empty. And counter-intuitively, the following instance is also valid for 
the same reason:

<root>
<vehicle local-reg="ABC123"/>
<vehicle local-reg="ABC123"/>
</root>

So it seems that to avoid the problem of defining what the key sequence 
is for a node where one of the fields selects nothing, we should compute 
the qualified node set first, and then compute the key sequence only for 
nodes in the qualified node set.

Michael Kay
Saxonica


>
> I suppose it doesn't matter, except insofar as it confuses readers,
> since I _think_ both of us believe that clause 4 of the rule under
> discussion will rule the node corresponding to the<vehicle... above
> _out_ of the *qualified node set*, so the document will not be
> schema-valid. . .
>
> ht
> - -- 
>         Henry S. Thompson, School of Informatics, University of Edinburgh
>        10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
>                  Fax: (44) 131 651-1426, e-mail: ht@inf.ed.ac.uk
>                         URL: http://www.ltg.ed.ac.uk/~ht/
>   [mail from me _always_ has a .sig like this -- mail without it is forged spam]
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (GNU/Linux)
>
> iD8DBQFNLdnLkjnJixAXWBoRAqnvAJ9mrzPtHAtL0FCIhIYwa9R1ZjW5IQCfTSMH
> dIVMSGuV6faGUH8soPsQ/Ms=
> =nWsA
> -----END PGP SIGNATURE-----
>
>

Received on Wednesday, 12 January 2011 17:26:24 UTC