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 10882 - [XQ31ReqUC] Why do external types introduced by external functions have to be subtypes of xs:anyAtomicType?
Summary: [XQ31ReqUC] Why do external types introduced by external functions have to be...
Status: NEW
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Requirements for Future Versions (show other bugs)
Version: Member-only Editors Drafts
Hardware: PC Windows NT
: 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: 2010-09-30 18:02 UTC by Oliver Hallam
Modified: 2014-05-20 16:48 UTC (History)
3 users (show)

See Also:


Attachments
sample file (deleted)
2013-03-11 07:26 UTC, tia
Details

Description Oliver Hallam 2010-09-30 18:02:46 UTC
Section 4.18 states:

An XQuery implementation may augment the type system of [XQuery and XPath Data Model (XDM) 1.1] with additional types that are designed to facilitate exchange of data with host programming languages, or it may provide mechanisms for the user to define such types. For example, a type might be provided that encapsulates an object returned by an external function, such as an SQL database connection. These additional types, if defined, are considered to be derived by restriction from xs:anyAtomicType.

This should say the implementation can augment XDM with additional item types, as I assume sequences of these types are also allowed.

I would also like to know why these types must be subtypes of xs:anyAtomicType, and not just subtypes of item().

There are many expressions in XQuery that take arguments of type xs:anyAtomicType and behaviours would have to be defined for these expressions.   I guess most of the time the behaviour would be to raise an error.  If they don't behave like atomic values, then maybe they shouldn't be atomic values.

For similar reasons that function items are not atomic values, atomic values are a often a poor fit for new types introduced.

I would suggest changing the text to the following:

An XQuery implementation may augment the type system of [XQuery and XPath Data Model (XDM) 1.1] with additional item types that are designed to facilitate exchange of data with host programming languages, or it may provide mechanisms for the user to define such types. For example, a type might be provided that encapsulates an object returned by an external function, such as an SQL database connection. These additional types, if defined, are considered to be derived by restriction from xs:anyAtomicType or subtypes of item() (but not node(), xs:anyAtomicType or function(*)).

I hate to say it but should these types not also be mentioned in the data model?
Comment 1 Michael Kay 2010-09-30 21:20:28 UTC
I agree, we should allow implementation-defined subtypes of item(). Saxon's extension types have traditionally been subtypes of anyAtomic, and there are definitely cases where this doesn't make much sense.

Such a change might have more consequences than we can immediately foresee, but having opened the door with function items to a third kind of item, I'm more confident that the language doesn't fundamentally break if you open things up at this point.

Michael Kay
Comment 2 Jonathan Robie 2010-11-03 19:06:36 UTC
I'm concerned about introducing new bugs. Statements we make about how types operate might be false if we change the organization of the type hierarchy. And I think this is just too late in the process for XQuery to change the type hierarchy.

I can't see how we would get any interop around such types, or how it would affect current implementations if we made this change.

I suggest we consider this in v.Next.
Comment 3 Jonathan Robie 2010-11-16 18:08:14 UTC
We did not have consensus to do this in XQuery 3.0 - there was consensus we would like this for future versions.
Comment 4 tia 2013-03-11 07:26:37 UTC
Created attachment 1335 [details]
sample file
Comment 5 Jonathan Robie 2013-03-11 17:01:01 UTC
(In reply to comment #4)
> Created attachment 1335 [details]
> sample file

A PowerPoint presentation on Second Quarter Widget Sales? Are attachments like this scanned for viruses in Bugzilla?
Comment 6 Michael Kay 2013-03-11 17:29:53 UTC
You opened it? You're a braver man than me.
Comment 7 Carine Bournez 2013-03-12 15:39:45 UTC
The content of attachment 1335 [details] has been deleted by
    Carine Bournez <carine@w3.org>
without providing any reason.

The token used to delete this attachment was generated at 2013-03-12 15:39:40 UTC.
Comment 8 Jonathan Robie 2014-05-20 16:48:49 UTC
Assigning to future requirements per Working Group decision (https://lists.w3.org/Archives/Member/w3c-xsl-query/2012Oct/0087.html).