Bug 4924 - [XQX] Arguably incorrect element definition in XQueryX's Schema
Summary: [XQX] Arguably incorrect element definition in XQueryX's Schema
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQueryX 1.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Jim Melton
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-09 00:07 UTC by Jim Melton
Modified: 2007-08-15 00:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Melton 2007-08-09 00:07:41 UTC
In the XQueryX Recommendation (http://www.w3.org/TR/xqueryx), the XML Schema defined at http://www.w3.org/TR/xqueryx/#Schema has an important design error.  While the schema as published correctly defines unenhanced XQueryX representations of XQuery semantics, several element definitions are done in such a manner that makes the schema not extensible to comprehend, say, the Update Facility and Full-Text. 

The element definitions in question are those whose definitions have an anonymous complex type.  The solution is to re-define them by creating a named complex type that is "the same as" each such anonymous complex type, and then defining each such element as a reference to the new complex type. 

For the purposes of defining the XQueryX extensions for the Update Facility, only one such element proved to be problematic: 

  <xsd:element name="functionDecl" substitutionGroup="prologPartTwoItem">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="functionName" type="QName"/>
        <xsd:element ref="paramList"/>
        <xsd:element ref="typeDeclaration" minOccurs="0"/>
        <xsd:choice>
          <xsd:element name="functionBody" type="exprWrapper"/>
          <xsd:element name="externalDefinition" type="emptyContent"/>
        </xsd:choice>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

The solution is pretty straightforward:

  <xsd:complexType name="functionDeclType">
      <xsd:sequence>
        <xsd:element name="functionName" type="QName"/>
        <xsd:element ref="paramList"/>
        <xsd:element ref="typeDeclaration" minOccurs="0"/>
        <xsd:choice>
          <xsd:element name="functionBody" type="exprWrapper"/>
          <xsd:element name="externalDefinition" type="emptyContent"/>
        </xsd:choice>
      </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="functionDecl" type="functionDeclType"
               substitutionGroup="prologPartTwoItem"/>

This allows the Update Facility to refine the functionDecl element by adding a new attribute to represent, for a given function being declared, whether or not that function is an updatable function:

  <xsd:element name="ufFunctionDecl" substitutionGroup="xqx:prologPartTwoItem">
    <xsd:complexType>
      <xsd:complexContent>
        <xsd:extension base="xqx:functionDeclType">
          <xsd:attribute name="updatingFunction" type="xsd:boolean"/>
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>
  </xsd:element>

The changes to the XQueryX Recommendation's XML Schema should be made as quickly as possible in the form of an erratum.
Comment 1 Jim Melton 2007-08-15 00:55:59 UTC
The Working Group discussed this bug and agreed that the proper way to address it was not to change only the definition of the functionDecl element, but to change the definitions of all elements that were defined using anonymous complex types instead of named complex types. 

The change must, of course, be done in the Errata document currently being developed for XQueryX 1.0.  Although the WG determined that the changes will not affect any existing application or instance documents and thus are editorial in nature, it observed that the changes will ultimately be reviewed in the context of reviewing the Errata document for publication. 

The elements whose definitions are affected, in addition to functionDecl, are:
pragma, singleType, typedVariableBinding, forClause, letClauseItem, letClause, orderModifier, orderBySpec, orderByClause, quantifiedExprInClause, typeswitchExprCaseClause, typeswitchExprDefaultClause, attributeList, Wildcard, attributeTest, elementTest, documentTest, piTest, xpathAxis, stepExpr, module, mainModule, libraryModule, versionDecl, prolog, copyNamespacesDecl, defaultNamespaceDecl, schemaImport, moduleImport, varDecl, optionDecl, param, and paramList. 

With this decision, we mark the bug FIXED and trust that you will mark it CLOSED.