<?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>7529</bug_id>
          
          <creation_ts>2009-09-07 14:34:08 +0000</creation_ts>
          <short_desc>[XQuery] General comparison argument conversion with xs:untypedAtomic and xs:NOTATION</short_desc>
          <delta_ts>2009-10-20 17:01:08 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XQuery 1.0</component>
          <version>2nd Edition Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Oliver Hallam">oliver</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>26910</commentid>
    <comment_count>0</comment_count>
    <who name="Oliver Hallam">oliver</who>
    <bug_when>2009-09-07 14:34:08 +0000</bug_when>
    <thetext>The errata XQ.E18 defines argument promotion for untyped atomic values in general comparisons as follows:

If T is a numeric type or is derived from a numeric type, then V is cast to xs:double.
If T is xs:dayTimeDuration or is derived from xs:dayTimeDuration, then V is cast to xs:dayTimeDuration.
If T is xs:yearMonthDuration or is derived from xs:yearMonthDuration, then V is cast to xs:yearMonthDuration.
In all other cases, V is cast to the primitive base type of T.


This definition is a bit wooly when it comes to comparing an xs:untypedAtomic value with an xs:NOTATION value.

xs:NOTATION is clearly the primitive base type of xs:NOTATION.  Should this raise a type error, or should a value be created with the abstract type xs:NOTATION for purposes of the comparison?

Nowhere in the specification is it defined what it means to cast to an abstract type, this issue is carefully avoided every time a cast is used otherwise.

This bug also affects XPath 2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26911</commentid>
    <comment_count>1</comment_count>
    <who name="Oliver Hallam">oliver</who>
    <bug_when>2009-09-07 14:34:59 +0000</bug_when>
    <thetext>&gt; xs:NOTATION is clearly the primitive base type of xs:NOTATION.

I meant to say here, 

xs:NOTATION is clearly the primitive base type of a value of type xs:NOTATION.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26912</commentid>
    <comment_count>2</comment_count>
    <who name="Oliver Hallam">oliver</who>
    <bug_when>2009-09-07 14:42:16 +0000</bug_when>
    <thetext>Since comparing an xs:QName with an xs:untypedAtomic raises an XPTY0004 type error, I would expect the same to happen with xs:NOTATION, although the specification really should make this explicit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28590</commentid>
    <comment_count>3</comment_count>
    <who name="Oliver Hallam">oliver</who>
    <bug_when>2009-10-20 16:43:55 +0000</bug_when>
    <thetext>18.1 (17.1 in 1.0) states:

[XML Schema Part 2: Datatypes Second Edition] defines xs:NOTATION as an abstract type. Thus, casting to xs:NOTATION from any other type including xs:NOTATION is not permitted and raises [err:XPST0080]XP. However, casting from one subtype of xs:NOTATION to another subtype of xs:NOTATION is permitted.

This does apply in this case and it is clear that the expression should raise XPST0080.

I have marked the bug report INVALID.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28592</commentid>
    <comment_count>4</comment_count>
    <who name="Oliver Hallam">oliver</who>
    <bug_when>2009-10-20 17:01:08 +0000</bug_when>
    <thetext>This XPST0800 error is a static error, and I believe only applies to cast/castable expressions.


It is defined as (http://www.w3.org/TR/xpath20/#ERRXPST0080) as:

It is a static error if the target type of a cast or castable expression is xs:NOTATION or xs:anyAtomicType.


F&amp;O (1.1) 18.1.1 states:

Casting is permitted from xs:string literals to xs:QName and types derived from xs:NOTATION. If the argument to such a cast is computed dynamically, [err:XPTY0004]XP is raised if the value is of any type other than xs:QName or xs:NOTATION (including the case where it is an xs:string). The process is described in more detail in 17.2 Constructor Functions for xs:QName and xs:NOTATION.

So I now think XPTY0004 is the right error.

It is not clear from the text that the paragraph in 18.1 only applies to cast and castable as expressions.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>