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 28810 - [XQ 3.1] Conformance: Maps, arrays, and the Higher Order Functions feature
Summary: [XQ 3.1] Conformance: Maps, arrays, and the Higher Order Functions feature
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3.1 (show other bugs)
Version: Last Call drafts
Hardware: PC All
: P2 normal
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: 2015-06-14 19:11 UTC by Michael Kay
Modified: 2015-08-11 19:33 UTC (History)
2 users (show)

See Also:


Attachments

Description Michael Kay 2015-06-14 19:11:12 UTC

    
Comment 1 Michael Kay 2015-06-14 19:15:35 UTC
XQuery 3.1 does not yet define updated conformance criteria.

Currently XQ 3.0 makes higher order functions an optional feature. Functions as values are not supported if this optional feature is not supported.

Maps and arrays are functions, but for maps in particular, I don't think we should make support optional: there are too many dependencies on maps in standard functions.

I think it's possible to define our conformance packages so higher order functions remain optional, but maps and arrays become part of minimal conformance. But we need to think about how to achieve this. For example, do we want to support the SequenceType function(*) for an item that could be a map or an array?
Comment 2 Josh Spiegel 2015-06-15 00:21:04 UTC
I would like higher order functions to remain an optional feature.  I think an  implementation that supports maps and arrays but not higher order functions should still be able support AnyFunctionTest and TypedFunctionTest in sequence type matching.
Comment 3 Michael Kay 2015-06-16 11:27:30 UTC
Note that if maps, arrays, and JSON are core features and higher order functions are optional, then it becomes impossible to invoke the "fallback" option of parse-json, json-doc, and json-to-xml.
Comment 4 Josh Spiegel 2015-07-01 20:40:19 UTC
With respect to FNO, if an implementation supports maps and arrays but not higher order functions, I think it should be able to partially support the following functions:

 fn:parse-json/fn:json-doc/fn:json-to-xml (except for fallback)
 fn:sort/array:sort (with one argument)

But it would not support:

 fn:apply
 fn:function-lookup
 fn:function-name
 fn:function-arity
 fn:for-each
 fn:filter
 fn:fold-left
 fn:fold-right
 fn:for-each-pair
 fn:load-xquery-module
 map:for-each
 array:for-each
 array:filter
 array:fold-left
 array:fold-right
 array:for-each-pair
Comment 5 Jonathan Robie 2015-07-01 21:00:56 UTC
Just looked at the XQuery 3.0 test suite results here:

http://dev.w3.org/2011/QT3-test-suite/ReportingResults/spec/XQ30.html

Looks like every vendor that reported results had support for higher order functions, the worst of these had 122/126.

Perhaps the simplest thing is to make higher order functions a mandatory feature?  I don't know of a serious implementation of XQuery 3.0 that does not support them.
Comment 6 Michael Kay 2015-07-01 21:37:17 UTC
For Saxonica, higher order functions are a chargeable option. We would like to keep it that way; we believe the facility is high value and worth paying extra for.
Comment 7 Josh Spiegel 2015-07-01 21:39:23 UTC
At meeting #530, the working group decided that higher order functions would remain optional:
https://lists.w3.org/Archives/Member/w3c-xsl-query/2013Feb/0030.html

I would also like to keep this decision.
Comment 8 Jonathan Robie 2015-07-01 21:40:26 UTC
OK, two vendors have said "don't go there", I withdraw the suggestion.
Comment 9 Jonathan Robie 2015-07-13 19:35:22 UTC
Good topic for the face-to-face.
Comment 10 Josh Spiegel 2015-07-16 14:40:32 UTC
This text in 5.2.6 will need to be adjusted:

"An implementation that does not provide the Higher-Order Function Feature MUST raise a static error [err:XQST0129] if it encounters a FunctionTest, dynamic function call, named function reference, inline function expression, or partial function application. Such an implementation MAY raise a type error [err:XPTY0004] if an expression evaluates to a sequence that contains a function."

Implementations that support maps and arrays but not higher-order functions should not be required to raise XQST0129 for function tests or dynamic function calls.
Comment 11 John Snelson 2015-07-16 15:24:34 UTC
DECISION: Accepted new text for section 5.2.6 Higher-Order Functions Feature:
"An implementation that does not provide the Higher-Order Function Feature MUST raise a static error [err:XQST0129] if it encounters a TypedFunctionTest, named function reference, inline function expression, or partial function application.". Also add an explanatory note: "The effect of this rule is that it is impossible to construct function items other than maps and arrays. Dynamic function calls are permitted, but the function that is called will necessarily be a map or array. The syntax function(*) is permitted to represent a type that allows maps and arrays, and every instance of this type will in practice be either a map or an array."
Comment 12 John Snelson 2015-07-16 15:42:50 UTC
DECISION: Add a tag to F&O for functions only provided in the "Higher-Order Functions" feature. fn:parse-json() and fn:json-doc() are not in the feature. The extended argument versions of fn:sort() and fn:array-sort() are in the feature. Other functions that take or return functions (that are not maps and arrays) are in the feature. fn:load-xquery-module() is in the feature. The XQuery 3.1 spec should say "any use of a function with this tag will result in [err:XPST0017].
Comment 13 Michael Kay 2015-07-17 20:12:19 UTC
The F+O part of this action is DONE. For example, fn:sort now has the "Properties" section:

Properties

The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·.

The two-argument form of this function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·.
Comment 14 Josh Spiegel 2015-08-11 19:33:49 UTC
The XQuery part of this action is also DONE.