<?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>30169</bug_id>
          
          <creation_ts>2017-08-19 15:54:33 +0000</creation_ts>
          <short_desc>[XP31] Definition of pure union type allows unions with unions that have lists</short_desc>
          <delta_ts>2017-12-13 09:07:50 +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>XPath 3.1</component>
          <version>Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>editorial</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Abel Braaksma">abel.braaksma</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>andrew_coleman</cc>
    
    <cc>mike</cc>
          
          <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>128852</commentid>
    <comment_count>0</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2017-08-19 15:54:33 +0000</bug_when>
    <thetext>The definition in section 2.5 reads:

   [Definition: A pure union type is an XML Schema union type that satisfies 
   the following constraints: (1) {variety} is union, (2) the {facets} property
   is empty, (3) no type in the transitive membership of the union type has 
   {variety} list, and (4) no type in the transitive membership of the union 
   type is a type with {variety} union having a non-empty {facets} property].

Item (4) appears to allow unions with members that are unions and repeats item (2) in its clause, but by doing so, it does not disallow variety list (item (3) is not repeated).

Perhaps we can make the definition recursive (not sure this makes this simpler)? 

(4) each type in the transitive membership of the union is a generalized atomic type.

Though I admit I may be reading / understanding this wrong. Does &quot;transitive membership&quot; here mean it includes any nested union members? If so, this does not seem to be the mathematical definition of &quot;transitive&quot;, but I&apos;m not a mathematician and I wonder whether the definition should need to rely on such knowledge.

Hardly a severe bug, the text around the definition makes clear what the intent is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128859</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2017-08-28 22:18:35 +0000</bug_when>
    <thetext>I don&apos;t think there is a bug here.

If a union type U includes a union type V in its transitive membership, and V has a list type L in its transitive membership, then L is also in the transitive membership of U, so U is not a pure union type, under rule (3).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128860</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2017-08-28 22:21:22 +0000</bug_when>
    <thetext>(Note: the definition of &quot;transitive membership&quot; of a union type is in XSD 1.1 part 2 §2.4.1.3. Perhaps it would be clearer if we linked to it.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128862</commentid>
    <comment_count>3</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2017-08-29 19:57:52 +0000</bug_when>
    <thetext>Thanks, I didn&apos;t know the term was defined somewhere. Linking would be good, since implementing XSD 1.1 is not mandatory. If we pick parts that need to be understood or implemented regardless, we should probably say so.

I agree now that there is no bug (given the XSD 1.1 definition), and suggestions for improvement would potentially cause(long) debates and hardly satisfy requirements for inclusion in a possible erratum.

I think then, that the following would be either simpler, or shorter, and satisfy the same constraints (just as an aside, I am not suggesting to rewrite what already works):

   [Definition: A pure union type is an XML Schema union type that satisfies 
   the following constraints: (1) {variety} is union, (2) the {facets} property
   is empty, (3) each type in the transitive membership is an [atomic type] 
   or has {variety} union and is a [pure union type].

(I prefer inclusive definitions, mixing exclusions with inclusions I find harder to grasp. But other readers mind find the recursiveness of the definition problematic)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128871</commentid>
    <comment_count>4</comment_count>
    <who name="Andrew Coleman">andrew_coleman</who>
    <bug_when>2017-09-04 15:03:14 +0000</bug_when>
    <thetext>This is a candidate item for XPath errata document.  Editor to decide on working.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128880</commentid>
    <comment_count>5</comment_count>
    <who name="Andrew Coleman">andrew_coleman</who>
    <bug_when>2017-09-07 17:07:37 +0000</bug_when>
    <thetext>Edit comment #4:

s/working/wording/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128919</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2017-10-13 15:36:49 +0000</bug_when>
    <thetext>I think the following recursive definition works:

A pure union type is a simple type that satisfies the following constraints: (1) {variety} is union, (2) the {facets} property is empty, (3) each type in the transitive membership of the union type is a generalized atomic type.

The existing notes are adequate to explain this to the uninitiated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128921</commentid>
    <comment_count>7</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2017-10-13 17:01:28 +0000</bug_when>
    <thetext>That seems to go back to my original suggestion? But yes, it works well and perhaps better than my later, longer proposals. 

Would be nice if we could also link [transitive membership], as suggested in comment#2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129011</commentid>
    <comment_count>8</comment_count>
    <who name="Andrew Coleman">andrew_coleman</who>
    <bug_when>2017-12-13 09:07:50 +0000</bug_when>
    <thetext>This has been resolved in the errata document:
https://www.w3.org/XML/2017/qt-errata/xpath-31-errata.html#E3</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>