W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2009

Clarification request on XPath/XQuery functions and operators regarding implicit casts

From: Axel Polleres <axel.polleres@deri.org>
Date: Tue, 12 May 2009 23:48:11 +0100
Message-ID: <4A09FCAB.30903@deri.org>
To: public-qt-comments@w3.org
CC: RIF WG Chairs <team-rif-chairs@w3.org>
I would kindly ask for advice on the following questions regarding 
implicit casts and type promotions in XPath/XQuery functions

1) For instance, fn:year-from-dateTime
does not mention any implicit casts in its definition.
Does that imply a type error if I call


with an xs:string value s as parameter, even if s is in the lexical 
space of xs:dateTime or is a cast here implicit?

On the other hand, fn:years-from-duration
mentions explicitly casting in its definition:

"The result is obtained by casting $arg to an xs:yearMonthDuration (see 
17.1.4 Casting to duration types) and then computing the years component 
as described in Canonical representation."

Would that imply that fn:years-from-duration(s)
would accept an xs:string s castable to xs:yearMonthDuration
as argument?

In this case is this different treatment of the extraction functions
for years from dateTime and duration intended?

2) Similarly,
accepts as second argument xs:double.

Again the question is whether casting here is implicit, as e.g. the 
example suggests:

op:divide-yearMonthDuration(xs:yearMonthDuration("P2Y11M"), 1.5)

where 1.5 is a decimal value, isn't it?

In general, I would like to find where in the spec I would find hints on 
whether conversions in functions and operators are meant to be implicit 
or not, and, if they are, then why in some cases, e.g.
casting is mentioned explicitly?

Thanks for clarification,
Axel Polleres

Dr. Axel Polleres
Digital Enterprise Research Institute, National University of Ireland, 
email: axel.polleres@deri.org  url: http://www.polleres.net/
Received on Tuesday, 12 May 2009 22:48:55 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:39 UTC