[Bug 4995] Scoping of sml identity constraints (key, keyref, unique)

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4995





------- Comment #2 from kumarp@microsoft.com  2007-10-24 05:36 -------
I have added examples of id constraints with and without the proposed scope
attribute below. They are based on the discussion in the "Proposal for allowing
smlkeyref.doc" document.

Example that uses the proposed 'scope' attribute.
-------------------------------------------------

<element name="courses"> 
    <sequence> 
        <element name="students"/> 
        <element name="student" maxOccurs="unbounded">
           <sequence>
                  <element name="ID"/>
           </sequence>
        </element>
    </sequence> 
    <sml:keyref name="CourseStudents" refer="StudentIDisKeyRemote"
scope="deref(students)"> 
        <sml:selector xpath="course/student"/> 
        <sml:field xpath="ID"/> 
    </sml:keyref> 
</element> 


Example that achieves the intended goal without using the scope attribute.
--------------------------------------------------------------------------

<element name="courses"> 
    <sequence> 
        <element name="students"/> 
        <element name="student" maxOccurs="unbounded">
           <sequence>
                  <element name="ID"/>
           </sequence>
        </element>
    </sequence> 
    <sml:keyref name="CourseStudents" refer="StudentIDisKeyLocal"> 
        <sml:selector xpath="course/student"/> 
        <sml:field xpath="ID"/> 
    </sml:keyref>
    <sml:key name="StudentIDisKeyLocal" >
        <sml:selector xpath="deref(students)/student"/> 
        <sml:field xpath="ID"/> 
    </sml:key>
</element> 

Received on Wednesday, 24 October 2007 05:36:29 UTC