W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: Semantic of the unique/key/keyref constraints.

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 19 Jun 2001 12:17:58 +0100
To: vdv@dyomedea.com
Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>, David Fallside <fallside@us.ibm.com>
Message-ID: <f5b66dsd8gp.fsf@cogsci.ed.ac.uk>
Eric van der Vlist <vdv@dyomedea.com> writes:

> Can anyone confirm which is right (my understanding or the primer) ?

<snip/>

> > 
> > If my interpretation is right, isn't it contrary to the example of
> > composed key given in the primer:
> > 
> > <unique name="dummy1">
> >  <selector xpath="r:regions/r:zip"/>
> >  <field    xpath="@code"/>
> >  <field    xpath="r:part/@number"/>
> > </unique>
> > 
> > where the field "r:part/@number" is pointing to 4 different nodes in
> > this case:
> > 
> > <regions>
> >  <zip code="95819">
> >   <part number="872-AA" quantity="1"/>
> >   <part number="926-AA" quantity="1"/>
> >   <part number="833-AA" quantity="1"/>
> >   <part number="455-BX" quantity="1"/>
> >  </zip>
> > ...

I think you're right, this example is bogus (the complete schemas are
all OK, but this out-of-line example is wrong).  It's clearly _part_
elements that are (meant to be) unique, so the 'selector' should be
"r:regions/r:zip/r:part".  If they're just supposed to be unique
within a single _occurrence_ of the <zip> elt, then all that's needed
is a single "field='@number'".  If they're supposed to be unique
across multiple <zip>s, then as it stands with the restricted XPath
expression subset the REC allows, I don't think you can do it.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Tuesday, 19 June 2001 07:17:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:21 GMT