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

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

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Tue, 19 Jun 2001 13:51:08 +0200
Message-ID: <3B2F3CAC.C8B01DEA@dyomedea.com>
To: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>
Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>, David Fallside <fallside@us.ibm.com>
"Henry S. Thompson" wrote:
> 
> ht@cogsci.ed.ac.uk (Henry S. Thompson) writes:
> 
> > 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.
> 
> I wasn't completely clear here.  The simple alternative offered above
> requires <part> to be unique wrt @number throughout the
> <purchaseReport>.  This means they're unique across multiple zips,
> _whether or not_ the zips are different.  It's _allowing_ the same
> part number under different zips that can't be accommodated by the REC
> as it stands.

Yes, to fully implement the key/ref tests in the example, instead of a
composite key, you would probably want to define 2 simple keys:

1) A key on regions/zip/@code to check that the zip code are unique and
non null within the scope of the regions element,
2) A key on regions/zip/part/@number defined under regions/zip to test
that the part numbers are unique within the scope of a zip code.

And to illustrate the use of composite keys, you need an example with,
for instance a first, middle and last name forming a key together with a
birth date.

Thanks

Eric
> 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/

-- 
Pour y voir plus clair dans la nebuleuse XML...
                                          http://dyomedea.com/formation/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
Received on Tuesday, 19 June 2001 07:51:15 GMT

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