Re: Defining uniqueness on optional element

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 UTC