Errata for XQuery 1.0 and XPath 2.0 Formal Semantics

23 November 2007

Latest version:
http://www.w3.org/XML/2007/qt-errata/xquery-semantics-errata.html
Editor:
Michael Dyck, jmdyck@ibiblio.org

Abstract

This document addresses errors in the XQuery 1.0 and XPath 2.0 Formal Semantics Recommendation published on 23 January 2007. It records all errors that, at the time of this document's publication, have solutions that have been approved by the XSL Working Group and/or the XML Query Working Group. For updates see the latest version of that document.

The errata are numbered, classified as Substantive, Editorial, or Markup, and are listed in reverse chronological order of their date of origin. Each entry contains the following information:

Colored boxes and shading are used to help distinguish new text from old, however these visual clues are not essential to an understanding of the change. The styling of old and new text is an approximation to its appearance in the published Recommendation, but is not normative. Hyperlinks are shown underlined in the erratum text, but the links are not live.

A number of indexes appear at the end of the document.

Substantive corrections are proposed by the XSL Working Group and/or the XQuery Working Group (both part of the XML Activity), which have consensus that they are appropriate; they are not to be considered normative until approved by a Call for Review of Proposed Corrections or a Call for Review of an Edited Recommendation.

Please report errors in this document using W3C's public Bugzilla system (instructions can be found at http://www.w3.org/XML/2005/04/qt-bugzilla). If access to that system is not feasible, you may send your comments to the W3C XSLT/XPath/XQuery public comments mailing list, public-qt-comments@w3.org. It will be very helpful if you include the string [FSerrata] in the subject line of your report, whether made in Bugzilla or in email. Each Bugzilla entry and email message should contain only one error report. Archives of the comments and responses are available at http://lists.w3.org/Archives/Public/public-qt-comments/.

Status of this Document

This is a public draft. None of the errata reported in this document have been approved by a Call for Review of Proposed Corrections or a Call for Review of an Edited Recommendation. As a consequence, they must not be considered to be normative.

Table of Contents

  Errata

     FS.E020   Correct errors in examples in section 2.4.4.

     FS.E019   Correct a normalization error in section 4.3.2 Filter Expressions.

     FS.E018   Correct various errors in section 8.2.3.1.1.

     FS.E017   Update the "Processing Model" diagram.

     FS.E016   For internal function fs:idiv, correct the operand types and supporting op: function given in the Binary Operators table.

     FS.E015   Fix some small errors in section 8.4.

     FS.E014   Fix small errors in section 7.2.3.

     FS.E013   Fix small errors in sections 7.2.1 and 7.2.2.

     FS.E012   Static Type Analysis must allow for empty text nodes introduced during normalization of direct element constructors.

     FS.E011   Correct/simplify/complete the Normalization rules defining []ElementContent and []AttributeContent, and simplify the corresponding Dynamic Evaluation rules.

     FS.E010   Clean up due to the removal of op:anyURI-equal from the F+O spec.

     FS.E009   Fix some errors in the productions for FunctionSig and TypeList.

     FS.E008   Fix a bug in the normalization of function calls.

     FS.E007   Fix miscellaneous small errors in section 5.

     FS.E006   Fix problems involving the domains of statEnv.funcType and dynEnv.funcDefn: Although section 3.1.1 declares the domain of statEnv.funcType to be (expanded-QName, arity), some inference rules neglect the arity.

     FS.E005   Put 'Expr' in parentheses when it occurs as a function argument.

     FS.E004   Fix typo in function signature.

     FS.E003   Complete the changes entailed by adding a local-namespaces component to the Core CompElemConstructor.

     FS.E002   Both Core and Formal grammars had symbols 'NamespaceBinding' and 'NamespaceBindings'.

     FS.E001   Make normalization of DirAttributeValue more explicit.

  Indexes

    Index by affected section

    Index by Bugzilla entry

    Index by section

    Index by production


FS.E020 - editorial

See Bug 4766

Description

Correct errors in examples in section 2.4.4.

History

26 Jun 2007: Proposed

26 Jun 2007: Accepted

4 Oct 2007: Issued

Changes

  1. In 2.4.4 Top level definitions / Example 1, replace:

                      define type UKAddress extends ipo:Address {
                        attribute exportCode of type ipo:UKPostcode
                        element postcode of type positiveInteger
                      };
                    

    with:

                      define type UKAddress extends ipo:Address {
                        attribute exportCode of type positiveInteger,
                        element postcode of type ipo:UKPostcode
                      };
                    
  2. In 2.4.4 Top level definitions / Example 6, replace:

    A type declaration with one element name of type xs:string follows by one or more elements street of type xs:string.

                      define type Address {
                        element name of type xs:string,
                        element street of type xs:string*
                      }
                    

    with:

    A type declaration with one element name of type xs:string followed by one or more elements street of type xs:string.

                      define type Address {
                        element name of type xs:string,
                        element street of type xs:string+
                      }
                    
  3. In 2.4.4 Top level definitions / Example 7, replace:

                      define type USAddress extends Address {
                        element zip name of type xs:integer
                      }
                    

    with:

                      define type USAddress extends Address {
                        element zip of type xs:integer
                      }
                    

FS.E019 - substantive

See Bug 4578

Description

Correct a normalization error in section 4.3.2 Filter Expressions.

History

24 May 2007: Proposed

30 May 2007: Accepted

4 Oct 2007: Issued

Change

In 4.3.2 Filter Expressions / Normalization / rule 2, replace:

let $fs:sequence := [PrimaryExpr PredicateList]Expr return
fn:subsequence($fs:sequence, $fs:last,1)

with:

let $fs:sequence := [PrimaryExpr PredicateList]Expr return
let $fs:last := fn:count($fs:sequence) return
fn:subsequence($fs:sequence, $fs:last,1)

FS.E018 - substantive

See Bug 4242

See Bug 4261

See Bug 4512

See Bug 4581

See Bug 5129

See Bug 3269

Description

Correct various errors in section 8.2.3.1.1.

History

28 Apr 2007: Proposed

3 May 2007: Accepted

3 Oct 2007: Issued

Changes

  1. The following 6 changes resolve bugs 4242, 4261(a), and 4581 (by adding a "?" at the end of the result types), and some of 3269 (by fixing the input types in four of the rules).

  2. In rule 2 / conclusion, replace:

    statEnv |-  test QName2 with element of element * OptTypeSpecifier : element QName2 OptTypeSpecifier

    with:

    statEnv |-  test QName2 with element of element * OptTypeSpecifier : element QName2 OptTypeSpecifier ?
  3. In rule 5 / conclusion, replace:

    statEnv |-  test *:LocalPart2 with element of element * OptTypeSpecifier : element *:LocalPart2 OptTypeSpecifier

    with:

    statEnv |-  test *:LocalPart2 with element of element * OptTypeSpecifier : element * OptTypeSpecifier ?
  4. In rule 7 / conclusion, replace:

    statEnv |-  test Prefix2:* with element of element * OptTypeSpecifier : element Prefix2:* OptTypeSpecifier

    with:

    statEnv |-  test Prefix2:* with element of element * OptTypeSpecifier : element * OptTypeSpecifier ?
  5. In rule 10 / conclusion, replace:

    statEnv |-  test QName2 with attribute of attribute * OptTypeReference : attribute QName2 OptTypeReference

    with:

    statEnv |-  test QName2 with attribute of attribute * OptTypeReference : attribute QName2 OptTypeReference ?
  6. In rule 13 / conclusion, replace:

    statEnv |-  test *:LocalPart2 with attribute of attribute * OptTypeReference : attribute *:LocalPart2 OptTypeReference

    with:

    statEnv |-  test *:LocalPart2 with attribute of attribute * OptTypeReference : attribute * OptTypeReference ?
  7. In rule 15 / conclusion, replace:

    statEnv |-  test Prefix2:* with attribute of attribute * OptTypeReference : attribute Prefix2:* OptTypeReference

    with:

    statEnv |-  test Prefix2:* with attribute of attribute * OptTypeReference : attribute * OptTypeReference ?
  8. The following 3 changes resolve bugs 4261(b), 4261(c), and 5129, respectively.

  9. In rule 4, delete premises 2 and 3:

    statEnv.namespace(Prefix1) = (NamespaceKind,AnyURI)
    fn:namespace-uri-from-QName(expanded-QName1) = AnyURI
  10. In rule 6 / premise 2, replace:

    statEnv.namespace(Prefix 1 ) = (NamespaceKind,AnyURI)

    with:

    statEnv.namespace(Prefix 2 ) = (NamespaceKind,AnyURI)
  11. In rule 14 / premise 2, replace:

    statEnv |-  QName1 of elem/type expands to expanded-QName1

    with:

    statEnv |-  QName1 of attr expands to expanded-QName1
  12. The following 7 changes resolve bug 4261(d).

  13. Between rules 1 and 2, insert this rule:

    statEnv |-  QName1 of elem/type expands to expanded-QName1
    statEnv |-  QName2 of elem/type expands to expanded-QName2
    not( expanded-QName1 = expanded-QName2 )

    statEnv |-  test QName2 with element of element QName1 OptTypeSpecifier 1 : empty
  14. Between rules 4 and 5, insert this rule:

    statEnv |-  QName1 of elem/type expands to expanded-QName1
    fn:local-name-from-QName(expanded-QName1) = LocalPart1
    not( LocalPart1 = LocalPart2 )

    statEnv |-  test *:LocalPart2 with element of element QName1 OptTypeSpecifier 1 : empty
  15. Between rules 6 and 7, insert this rule:

    statEnv |-  QName1 of elem/type expands to expanded-QName1
    fn:namespace-uri-from-QName(expanded-QName1) = AnyURI1
    statEnv.namespace(Prefix2) = (NamespaceKind,AnyURI 2)
    not( AnyURI1 = AnyURI2 )

    statEnv |-  test Prefix2:* with element of element QName1 OptTypeSpecifier 1 : empty
  16. Between rules 9 and 10, insert this rule:

    statEnv |-  QName1 of attr expands to expanded-QName1
    statEnv |-  QName2 of attr expands to expanded-QName2
    not( expanded-QName1 = expanded-QName2 )

    statEnv |-  test QName2 with attribute of attribute QName1 OptTypeReference : empty
  17. Between rules 12 and 13, insert this rule:

    statEnv |-  QName1 of attr expands to expanded-QName1
    fn:local-name-from-QName(expanded-QName1) = LocalPart1
    not( LocalPart1 = LocalPart2 )

    statEnv |-  test *:LocalPart2 with attribute of attribute QName1 OptTypeReference : empty
  18. Between rules 14 and 15, insert this rule:

    statEnv |-  QName1 of attr expands to expanded-QName1
    fn:namespace-uri-from-QName(expanded-QName1) = AnyURI1
    statEnv.namespace(Prefix2) = (NamespaceKind,AnyURI 2)
    not( AnyURI1 = AnyURI2 )

    statEnv |-  test Prefix2:* with attribute of attribute QName1 OptTypeReference : empty
  19. Delete rule 17:

    Lastly, if none of the above rules holds, then the type of the input expression is empty.

    ElementNameOrWildcard 1 = NameTest
    TypeSpecifier1 = of type xs:anyType
    statEnv |-  not(element ElementNameOrWildcard 1 TypeSpecifier1 <: element ElementNameOrWildcard 2 TypeSpecifier2)
    statEnv |-  not(element ElementNameOrWildcard 2 TypeSpecifier2 <: element ElementNameOrWildcard 1 TypeSpecifier1)
    statEnv |-  TypeSpecifier1 expands to Type1
    statEnv |-  TypeSpecifier2 expands to Type2
    statEnv |-  not(Type1 <: Type2)
    statEnv |-  not(Type2 <: Type1)

    statEnv |-  test NameTest with element of element ElementNameOrWildcard 2 TypeSpecifier2 : empty
  20. The following 2 changes resolve bug 4512(a).

  21. In rule 8 / conclusion, replace:

    statEnv |-  test * with element of element QName OptTypeSpecifier : element QName OptTypeSpecifier

    with:

    statEnv |-  test * with element of ElementType : ElementType
  22. In rule 16 / conclusion, replace:

    statEnv |-  test * with attribute of attribute QName OptTypeReference : attribute QName OptTypeReference

    with:

    statEnv |-  test * with attribute of AttributeType : AttributeType
  23. The following 2 changes resolve bug 4512(b).

  24. Between rules 8 and 9, insert this rule:

    not( Type is an element type )

    statEnv |-  test NameTest with element of Type : empty
  25. Between rule 16 and 17, insert this rule:

    not( Type is an attribute type )

    statEnv |-  test NameTest with attribute of Type : empty
  26. The next 2 changes resolve some more of bug 3269.

  27. Delete rule 3:


    statEnv |-  test QName2 with element of element OptTypeSpecifier : element QName2 OptTypeSpecifier
  28. Delete rule 11:


    statEnv |-  test QName2 with attribute of attribute OptTypeReference : attribute QName2 OptTypeReference

FS.E017 - editorial

See Bug 4371

Description

Update the "Processing Model" diagram.

History

6 Mar 2007: Proposed

6 Mar 2007: Accepted

2 Oct 2007: Issued

Change

In 3.2.1 Processing model, in the diagram, add a box labelled "Modules", and an arrow labelled "(SQ3)" pointing from the "Modules" box to the "Static context" box.

FS.E016 - substantive

See Bug 3847

Description

For internal function fs:idiv, correct the operand types and supporting op: function given in the Binary Operators table.

History

18 Oct 2006: Proposed

14 Feb 2007: Accepted

2 Oct 2007: Issued

Change

In C.2 Mapping of Overloaded Internal Functions / Binary Operators table, replace:

fs:idiv(A, B) xs:integer xs:integer op:integer-div(A, B) xs:integer

with:

fs:idiv(A, B) xs:integer xs:integer op:numeric-integer-divide(A, B) xs:integer
fs:idiv(A, B) xs:decimal xs:decimal op:numeric-integer-divide(A, B) xs:integer
fs:idiv(A, B) xs:float xs:float op:numeric-integer-divide(A, B) xs:integer
fs:idiv(A, B) xs:double xs:double op:numeric-integer-divide(A, B) xs:integer

FS.E015 - editorial

See Bug 1783

Description

Fix some small errors in section 8.4.

History

6 Oct 2006: Proposed

16 Jan 2007: Accepted

2 Oct 2007: Issued

Change

In 8.4 Judgments for FLWOR and other expressions on sequences, replace:

[Definition: A Prime types is a choice of item types].

with:

[Definition: A prime type is a choice of item types.]

FS.E014 - editorial

See Bug 1756

Description

Fix small errors in section 7.2.3.

History

8 Sep 2006: Proposed

16 Jan 2007: Accepted

9 Aug 2007: Proposed

9 Aug 2007: Accepted

2 Oct 2007: Issued

Changes

  1. In 7.2.3 The fn:abs, fn:ceiling, fn:floor, fn:round, and fn:round-half-to-even functions / Static Type Analysis / para 1, replace:

    Note that the fact that the type should be the least is cannot expressed by the inference rule notation used here.

    with:

    Note that the fact that the type should be the least is not expressed by the inference rule notation used here.

    and delete:

    Instead of writing a separate judgment for each function, we write one rule for the functions whose name is either (FN-URI,"abs"), (FN-URI,"ceiling"), (FN-URI,"floor"), (FN-URI,"round"), or (FN-URI,"round-half-to-even") functions.

  2. In 7.2.3 The fn:abs, fn:ceiling, fn:floor, fn:round, and fn:round-half-to-even functions / Static Type Analysis / rule 1 / premise 5, replace:

    { (FN-URI,"ceiling"), (FN-URI,"floor"), (FN-URI,"round"), (FN-URI,"round-half-to-even") }

    with:

    { (FN-URI,"abs"), (FN-URI,"ceiling"), (FN-URI,"floor"), (FN-URI,"round"), (FN-URI,"round-half-to-even") }

FS.E013 - editorial

See Bug 1754

Description

Fix small errors in sections 7.2.1 and 7.2.2.

History

5 Oct 2006: Proposed

16 Jan 2007: Accepted

2 Oct 2007: Issued

Changes

  1. In 7.2.1 The fn:last context function / Dynamic Evaluation / rule 1 / conclusion, replace:

    dynEnv |-  function (FN-URI,"last")() with types on values yields Value

    with:

    dynEnv |-  function (FN-URI,"last") with types on values yields Value
  2. In 7.2.2 The fn:position context function / Dynamic Evaluation / rule 1 / conclusion, replace:

    dynEnv |-  function (FN-URI,"position")() with types on values yields Value

    with:

    dynEnv |-  function (FN-URI,"position") with types on values yields Value

FS.E012 - editorial

See Bug 3771

Description

Static Type Analysis must allow for empty text nodes introduced during normalization of direct element constructors.

History

10 Oct 2006: Proposed

19 Oct 2006: Accepted

2 Oct 2007: Issued

Changes

  1. In 4.7.3.1 Computed Element Constructors / Static Type Analysis, replace:

    The content expression must return a sequence of nodes with all the attribute nodes before any element, processing-instructions or comment nodes. Note that the type allows text nodes interleaved with attribute nodes in the beginning. Although this results in a looser type checking, this accounts for the possible presence of empty text nodes resulting from normalization of direct element constructors (See [4.7.1 Direct Element Constructors]).

    with:

    The content expression must return a sequence of nodes with attribute nodes at the beginning.

    and in each of the four rules, in the last premise, replace:

    (attribute*, (element | comment | processing-instruction)*) & text*

    with:

    attribute *, (element | text | comment | processing-instruction) *

  2. In 7.1.5 The fs:item-sequence-to-node-sequence function / Static Type Analysis, insert:

    If the input sequence contains any attribute nodes, they must precede any other items, with the exception that text nodes are allowed throughout. This exception results in looser type checking, but it is necessitated by the possible presence of empty text nodes introduced by normalization of direct element constructors (see [4.7.1 Direct Element Constructors]).

    and in the subsequent rule, replace:

    attribute*, (element|document|text|processing-instruction|comment|xs:string| xs:float| ...|xs:NOTATION)*

    with:

    ( attribute*, (element|document|processing-instruction|comment|xs:string| xs:float|...|xs:NOTATION)* ) & text*

FS.E011 - editorial

See Bug 3758

See Bug 3760

Description

Correct/simplify/complete the Normalization rules defining []ElementContent and []AttributeContent, and simplify the corresponding Dynamic Evaluation rules.

History

10 Oct 2006: Proposed

19 Oct 2006: Accepted

1 Oct 2007: Issued

Changes

  1. In 4.7.1 Direct Element Constructors / Normalization, delete:

    We distinguish between direct element constructors that contain only one element-content unit and those that contain more than one element-content unit.

    and delete rule 3:

     
    [ElementContentUnit 1]ElementContent
    ==
    fs:item-sequence-to-node-sequence(( [ ElementContentUnit 1]ElementContentUnit))

    and after the former rule 4 / now rule 3, insert:

    (Note that this rule should be understood to cover the degenerate cases of n=0 and n=1, where the element constructor's content consists of zero or one element-content units.)

  2. In 4.7.1.1 Attributes / Normalization, replace:

    As with literal XML elements, we need to distinguish between direct attribute constructors that contain one attribute-content unit and those that contain multiple attribute-content units, because the rule for converting sequences of atomic values into strings is applied to sequences within distinct enclosed expressions. If the direct attribute constructor contains exactly one attribute-content unit, we simply normalize that unit by applying the normalization rule for attribute content units:

     
    [ AttributeContentUnit1 ]AttributeContent
    ==
    [AttributeContentUnit1]AttributeContentUnit

    If the direct attribute constructor contains more than one attribute-content unit, we normalize each unit individually and ...

    with:

    To apply []AttributeContent to zero or more attribute-content units, we normalize each unit individually and ...

    and after the former rule 5 / now rule 4, insert:

    (Note that this rule should be understood to cover the degenerate cases of n=0 and n=1, where the attribute constructor's content consists of zero or one attribute-content units.)

  3. In 4.7.3.2 Computed Attribute Constructors / Dynamic Evaluation, replace:

    Second, the function fs:item-sequence-to-untypedAtomic is applied to the content expression and this function call is evaluated in the dynamic environment. Recall from [4.7.3.2 Computed Attribute Constructors] that during normalization, we do not convert the content of direct attribute constructors that contain one attribute-content unit. This guarantees that useful type information is preserved for static analysis. Since the conversion function fs:item-sequence-to-untypedAtomic was not applied to all attribute constructors during normalization, we have to apply it at evaluation time. (As before, it is possible to elide the application of fs:item-sequence-to-untypedAtomic injected during normalization and the application injected during evaluation.)

    with:

    Second, the content expression is evaluated in the dynamic environment.

    and in rule 1 / premise 1, replace:

    dynEnv |-  fs:item-sequence-to-untypedAtomic(( Expr)) => AtomicValue

    with:

    dynEnv |-  Expr => AtomicValue

    and in rule 2 / premise 4, replace:

    dynEnv |-  fs:item-sequence-to-untypedAtomic(( Expr2)) => AtomicValue2

    with:

    dynEnv |-  Expr2 => AtomicValue2

FS.E010 - editorial

See Bug 3670

Description

Clean up due to the removal of op:anyURI-equal from the F+O spec.

History

26 Sep 2006: Proposed

26 Sep 2006: Accepted

30 Sep 2007: Issued

Changes

  1. In C.2 Mapping of Overloaded Internal Functions / Notation 2, replace:

    fs:eq(A, B) xs:anyURI xs:anyURI op:anyURI-equal(A, B) xs:boolean
    ...
    fs:ne(A, B) xs:anyURI xs:anyURI fn:not(op:anyURI-equal(A, B)) xs:boolean

    with:

    fs:eq(A, B) xs:anyURI xs:anyURI op:numeric-equal(fn:compare(A, B), 0) xs:boolean
    ...
    fs:ne(A, B) xs:anyURI xs:anyURI fn:not(op:numeric-equal(fn:compare(A, B), 0)) xs:boolean
  2. In 8.5.1 Type Promotion / Semantics, insert:

    xs:anyURI can be promoted to xs:string:


    statEnv |-  xs:anyURI can be promoted to xs:string

FS.E009 - editorial

See Bug 3142

Description

Fix some errors in the productions for FunctionSig and TypeList.

History

21 Apr 2006: Proposed

24 Apr 2006: Accepted

29 Sep 2007: Issued

Change

In 3.1.1 Static Context / Notation and A.2 Formal BNF / Non-Terminals, replace:

[85 (Formal)]    FunctionSig    ::=    "declare" "function" expanded-QName "(" TypeList? ")" "as" SequenceType
[86 (Formal)]    TypeList    ::=    SequenceType ("," Type)*

with:

[85 (Formal)]    FunctionSig    ::=    "declare" "function" expanded-QName "(" TypeList? ")" "as" Type
[86 (Formal)]    TypeList    ::=    Type ("," Type)*

FS.E008 - editorial

See Bug 1680

Description

Fix a bug in the normalization of function calls.

History

17 Jul 2005: Proposed

24 Apr 2006: Accepted

29 Sep 2007: Issued

Changes

  1. In 4.1.5 Function Calls / Normalization / rule 1 / premise 2, replace:

    statEnv.typeDefn(expanded-QName) = define type QName2 AtomicTypeDerivation

    with:

    statEnv |-  not(expanded-QName denotes a constructor function)
  2. In 4.12.5 Constructor Functions, add the subsection:

    Notation

    Calls to constructor functions are normalized differently from other function calls, so we introduce an auxiliary judgment to detect whether the function being called is a constructor function.

    statEnv |- expanded-QNamedenotes a constructor function

    This judgment holds when the expanded function name maps to an atomic type in the in-scope schema types.

    statEnv.typeDefn(expanded-QName) = define type QName AtomicTypeDerivation

    statEnv |-  expanded-QName denotes a