W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2003

Re: Defining uniqueness on optional element

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 27 Mar 2003 11:21:14 +0000
To: Cams Ismael <Ismael.Cams@siemens.com>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <f5bn0jhys0l.fsf@erasmus.inf.ed.ac.uk>

Cams Ismael <Ismael.Cams@siemens.com> writes:

Perhaps _I_ misunderstood.  Here's what you _can't_ currently work with:

<root>
 <mayHaveDaughter f1="a"/>
 <mayHaveDaughter f1="b"/>
 <mayHaveDaughter f1="c">
  <d>1</d>
 </mayHaveDaughter>
 <mayHaveDaughter f1="c"/>
  <d>2</d>
 </mayHaveDaughter>
</root>

There's no way to write identity constraints which make this OK but
rule out the obvious bad cases.  The problem is not that it's an
_error_ for a field of a unique constraint to be missing, it's just
that if a field _is_ missing then the selected element is not
considered at all.  So in the above example, a two-part unique on
'root' which selects 'mayHaveDaughter' with fields '@f1' and 'd' will
not constrain empty 'mayHaveDaughter' elements at all.

What you want, but can't currently have, is _two_ constraints, one of
which selects mayHaveDaughter[d] and has the two fields, and one of
which selects mayHaveDaughter[not(d)] and has only the '@f1' field.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                      Half-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/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Thursday, 27 March 2003 06:21:41 GMT

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