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 29404 - [QT3] anyURI in fn:collection
Summary: [QT3] anyURI in fn:collection
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.1 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-29 23:34 UTC by Benito van der Zander
Modified: 2016-07-21 21:38 UTC (History)
3 users (show)

See Also:


Attachments

Description Benito van der Zander 2016-01-29 23:34:03 UTC
The FO says about fn:collection  "A dynamic error is raised [err:FODC0004] if $arg is not a valid xs:anyURI." 

But in XSD1.1 there are no restriction on valid anyURIs (compare 27742)

There are some tests (fn-collection-3, K2-SeqCollectionFunc-2, K2-SeqCollectionFunc-1, collection-902, cbcl-collection-001) testing for FODC0004 on invalid anyURIs
Comment 1 Abel Braaksma 2016-01-30 02:21:46 UTC
Possibly the error description should be updated to reflect that it should be valid according to RFC 3986, or the tests should specify an XSD 1.0 dependency. Note that for fn:doc the error description is slightly different:

A dynamic error may be raised [err:FODC0005] if $uri is not a valid URI reference.

But this may be vague on purpose. However, also in the case of fn:doc there is no mention of the URI to have to be valid according to the RFC, in fact, the term URI reference is not linked or defined clearly in this context.

Looking further, the function fn:collation-key, which takes a URI as well, has no error conditions at all for an invalid URI, I raised that separately: bug 29406.
Comment 2 Benito van der Zander 2016-01-30 09:59:55 UTC
The tests FODC0004 and FODC0005-1 in misc-CombinedErrorCodes might deserve a further examination, too
Comment 3 O'Neil Delpratt 2016-02-08 14:42:46 UTC
The WG agreed at the telcon on the 02/02/16 to add the dependency on XSD 1.0 for the tests specified.
Comment 4 O'Neil Delpratt 2016-02-08 15:50:58 UTC
I have reviewed this bug again and I think that this bug should be against the FO spec. The text for fn:collection needs changing to be consistant with fn:doc. i.e.: "A dynamic error may be raised [err:FODC0005] if $uri is not a valid URI."
Comment 5 Benito van der Zander 2016-02-16 04:14:52 UTC
The same issue exists for uri-collection ofc
Comment 6 Michael Kay 2016-03-08 15:59:16 UTC
I think the rule for all the "resource access" functions should be that when the URI is invalid, the processor is allowed to raise an error but is not required to do so.

The relevant functions are:

doc
doc-available
collection
uri-collection
unparsed-text
unparsed-text-lines
unparsed-text-available
json-doc

Current handling of invalid URIs is as follows:

doc: MAY raise FODC0005
doc-available: MUST raise FODC0005
collection: MUST raise FODC0004
uri-collection: MUST raise FODC0004
unparsed-text: no specific error; treated the same as "no resource found"
unparsed-text-lines - same as unparsed-text
unparsed-text-available - returns false
json-doc - same as unparsed-text

I propose to change doc-available to return false, aligning it with unparsed-text-available.

I propose to change collection and uri-collection from MUST to MAY, for alignment with doc().

I propose no change for the unparsed-text family of functions; the cost of a change to make them more consistent with doc and collection is greater than the benefit.
Comment 7 Andrew Coleman 2016-03-11 13:10:29 UTC
At the meeting on 2016-03-08, the WG agreed to adopt the changes proposed in comment 6.
Comment 8 Michael Kay 2016-03-21 22:58:23 UTC
The changes have been applied, and relevant tests have been updated.
Comment 9 Benito van der Zander 2016-05-13 19:47:21 UTC
In comment 3 I said

>The tests FODC0004 and FODC0005-1 in misc-CombinedErrorCodes might deserve a further examination, too

Since the collection tests were changed, those two should be changed, too
Comment 10 O'Neil Delpratt 2016-05-24 16:06:17 UTC
(In reply to Benito van der Zander from comment #9)
> In comment 3 I said
> 
> >The tests FODC0004 and FODC0005-1 in misc-CombinedErrorCodes might deserve a further examination, too
> 
> Since the collection tests were changed, those two should be changed, too

Yes I agree that with the changes mentioned in comment #6 that we should add the alternative error code FODC0002 in the test cases mentioned. I have made the change and committed them to cvs.