<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>2832</bug_id>
          
          <creation_ts>2006-02-11 00:57:56 +0000</creation_ts>
          <short_desc>RQ-159 Key fields matching urtype (anyKey)</short_desc>
          <delta_ts>2007-05-01 23:30:38 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XML Schema</product>
          <component>Structures: XSD Part 1</component>
          <version>1.1 only</version>
          <rep_platform>Other</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>LATER</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>important, hard, idc cluster</status_whiteboard>
          <keywords>resolved</keywords>
          <priority>P4</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="C. M. Sperberg-McQueen">cmsmcq</reporter>
          <assigned_to name="C. M. Sperberg-McQueen">cmsmcq</assigned_to>
          <cc>sandygao</cc>
          
          <qa_contact name="XML Schema comments list">www-xml-schema-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>8197</commentid>
    <comment_count>0</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2006-02-11 00:57:56 +0000</bug_when>
    <thetext>This issue was originally reported by Neil Graham.

This was R-172
(http://www.w3.org/2001/05/xmlschema-rec-comments.html#pfiurTypeIdConstr).

Consider the schema:

      &lt;xsd:schema
        xmlns=&quot;http://schematests.com&quot;
        xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;
        targetNamespace=&quot;http://tests.com&quot;&gt;

        &lt;xsd:element name=&quot;root&quot;&gt;
            &lt;xsd:complexType&gt;
                &lt;xsd:sequence&gt;
                    &lt;xsd:element name=&quot;name&quot; maxOccurs=&quot;unbounded&quot;/&gt;
                &lt;/xsd:sequence&gt;
            &lt;/xsd:complexType&gt;
            &lt;xsd:key name=&quot;nameKey&quot;&gt;
                &lt;xsd:selector xpath=&quot;./name&quot;/&gt;
                &lt;xsd:field xpath=&quot;.&quot;/&gt;
            &lt;/xsd:key&gt;

        &lt;/xsd:element&gt;

      &lt;/xsd:schema&gt;

Since no type is declared for the local &quot;name&quot; element, by the
properties tableaus in [1], it must have the ur-type.

Consider the instance document

      &lt;my:root
        xmlns:my=&quot;http://tests.com&quot;
        xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
        xsi:schemaLocation=&quot;http://tests.com idAnytype.xsd&quot;&gt;
        &lt;name&gt;Jack Daniels&lt;name&gt;

        &lt;name&gt;Johnny Walker&lt;name&gt;

        &lt;name&gt;Sam Adams&lt;name&gt;
      &lt;my:root&gt;

From the 3rd point of [2]:

   3 For each node in the target node set all of the {fields}, with
     that node as the context node, evaluate to either an empty node-set 
     or a node-set with exactly one member, which must have a simple type. 

[3] tells us that the ur-type can behave as a simpleType &quot;according to
context&quot;:

   [Definition:]  A distinguished ur-type definition is present in 
   each XML Schema, serving as the root of the type definition hierarchy 
   for that schema. The ur-type definition, whose name is anyType, has the 
   unique characteristic that it can function as a complex or a simple 
   type definition, according to context.&quot;

This raises two questions:
 
* Is it valid for a &lt;field&gt; to match an element with the ur-type
definition under any circumstances?

* If such a match may sometimes be valid (presumably when the element
only contains textual content):

   - If the element contains text, in which value space should the
     schema-normalized value of the field be considered to lie?  This
     will be significant in the case of keyref matches, especially in
     light of the recent discussions concerning the incomparability of
     values from disjoint value spaces.

   - I presume that an error should be raised if the instance of the
     ur-typed element actually contains element content?  Or should
     the &lt;field&gt; match simply fail?

[1]: http://www.w3.org/TR/xmlschema-1/#declare-element


[2]:
http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#section-Identity-constraint-Definition-Validation-Rules
(in version of May 2001; or
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#d0e13819 in Second
Edition

[3]: http://www.w3.org/TR/xmlschema-1/#key-urType 

See:
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2002JulSep/0085.html

Henry&apos;s response:
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2002JulSep/0089.html

Discussed at the 2003-10-17 telecon.

    RESOLVED: (a) to class R-172 as clarification with erratum, and
    instruct the editor to draft an erratum which restricts fields to
    matching types which have LV mappings (informally, &apos;concrete&apos;
    simple types), and (b) make a note to come back to this in 1.1,
    after solving RQ-024 and RQ-141 (the issue about abstract simple
    types).

The underlying issue applies to both Structures and Datatypes.  This
Bugzilla entry is for Structures.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12840</commentid>
    <comment_count>1</comment_count>
    <who name="Sandy Gao">sandygao</who>
    <bug_when>2006-11-06 02:12:31 +0000</bug_when>
    <thetext>*** Bug 2170 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14565</commentid>
    <comment_count>2</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2007-03-28 19:01:33 +0000</bug_when>
    <thetext>Note that a 1.0 analogue of this issue is in bug 2169.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14567</commentid>
    <comment_count>3</comment_count>
    <who name="Noah Mendelsohn">noah_mendelsohn</who>
    <bug_when>2007-03-28 19:40:14 +0000</bug_when>
    <thetext>This issue was discussed at the Schema F2F meeting in Cambridge on 28 March 2007.  We did not reach consensus on making any changes to the Recommendation for Schema 1.1.  The issue is being closed with status LATER.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14569</commentid>
    <comment_count>4</comment_count>
    <who name="Noah Mendelsohn">noah_mendelsohn</who>
    <bug_when>2007-03-28 19:41:04 +0000</bug_when>
    <thetext>This issue was discussed at the Schema F2F meeting in Cambridge on 28 March 2007.  We did not reach consensus on making any changes to the Recommendation for Schema 1.1.  The issue is being closed with status LATER.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14961</commentid>
    <comment_count>5</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2007-05-01 23:30:38 +0000</bug_when>
    <thetext>The originator of the comment has indicated that he is content with the
disposition of this issue for XML Schema 1.1:

http://lists.w3.org/Archives/Public/www-xml-schema-comments/2007AprJun/0024.html

Accordingly, I am marking it CLOSED.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>