This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 30169 - [XP31] Definition of pure union type allows unions with unions that have lists
Summary: [XP31] Definition of pure union type allows unions with unions that have lists
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 3.1 (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: P2 editorial
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-19 15:54 UTC by Abel Braaksma
Modified: 2017-12-13 09:07 UTC (History)
2 users (show)

See Also:


Attachments

Description Abel Braaksma 2017-08-19 15:54:33 UTC
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 "transitive membership" here mean it includes any nested union members? If so, this does not seem to be the mathematical definition of "transitive", but I'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.
Comment 1 Michael Kay 2017-08-28 22:18:35 UTC
I don'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).
Comment 2 Michael Kay 2017-08-28 22:21:22 UTC
(Note: the definition of "transitive membership" 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.)
Comment 3 Abel Braaksma 2017-08-29 19:57:52 UTC
Thanks, I didn'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)
Comment 4 Andrew Coleman 2017-09-04 15:03:14 UTC
This is a candidate item for XPath errata document.  Editor to decide on working.
Comment 5 Andrew Coleman 2017-09-07 17:07:37 UTC
Edit comment #4:

s/working/wording/
Comment 6 Michael Kay 2017-10-13 15:36:49 UTC
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.
Comment 7 Abel Braaksma 2017-10-13 17:01:28 UTC
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.
Comment 8 Andrew Coleman 2017-12-13 09:07:50 UTC
This has been resolved in the errata document:
https://www.w3.org/XML/2017/qt-errata/xpath-31-errata.html#E3