Re: key/keyref problem

"Jun Wang" <t-junw@microsoft.com> writes:

> Could you give out some comments according to some skipped parts in
> Aung's emails?
>  
> Part I :
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Aung:
> >> B:  (this is what you and Eric come agreeement on how it should work,
>  
> >> if that is the case, how do you defind the scopeof
> >> the key 'B'? it cannot be all the way to the root element, can it? ) 
> >> <root> <element name="a">
> >>    <keyref   refer="B">
> >>    <element name="b">
> >>         <key   name="B">
> >>    </element>
> >> </element>
> >> </root>
>  
> Priscilla:
> >The scope of the key 'B' is the element 'b'.  All values of the
> field(s) have to be unique within an instance of 'b'.
>  
> Aung:
> 1. If scope of the key 'B' is the element 'b', then how can the <keyref
> refer="B">, which is outside of scope of element 'b', see the <key
> name="B"> ?
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  
> I have the same question as Aung.  And if you can give out some specific
> example or issue in Databases area which brings you to think
> IDConstraint should be implemented this way, our understanding will be
> even clearer...

The declaration for any element which may contain <b> elements at any
depth can sensibly contain a keyref definition which references that key.


> Part II: 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Aung:
> >> How about this: should this work? (how/why?)
> >> C:
> >> <root>
> >> <element name="a">
> >>         <key   name="A">
> >> </element>
> >> <element name="b">
> >>         <keyref   refer="A">
> >> </element>
> >> </root>
>  
> Priscilla:
> > No, because the key and keyref have to be defined in the same element,
> or
> the key has to be defined in a child element.  Neither is the case here.

Not quite, Priscilla -- since <b> is unconstrained, in a valid
instance an <a> might occur inside it, so the above is OK.

> Aung:
> OK, simply put, we agree with 2 easy cases, lets put it here ...
> case 2. if key and keyref are declared in different scope it, should
> fail.
> <r>
>     <a>
>         key=1
>     </a>
>     <b>
>         keyref=1    
>     </b>
> </r>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Yes, fails.

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 Wednesday, 22 August 2001 17:19:58 UTC