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 28448 - dm:map-get and timezones
Summary: dm:map-get and timezones
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Data Model 3.1 (show other bugs)
Version: Working drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Norman Walsh
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-08 20:42 UTC by Josh Spiegel
Modified: 2015-05-05 15:20 UTC (History)
1 user (show)

See Also:


Attachments

Description Josh Spiegel 2015-04-08 20:42:21 UTC
Currently a map cannot contain among its keys both date/time values with a timezone and date/time values without a timezone.  This rule is stated in FNO, XQuery, and XDM.  But I don't think the definition dm:map-get specifies what should happen if the $map argument contains keys without a timezone but the $item argument has a timezone.  

Consider this query:

  let $without_tz := xs:dateTime('2015-04-08T01:30:00') 
  let $with_tz := adjust-dateTime-to-timezone($without_tz, implicit-timezone())
  return (
     $without_tz eq $with_tz,
     map:get(
       map{ $without_tz : 1 }, 
       $with_tz
     )
  )

I think this evaluates to (true, 1).  map:get finds an entry within the map that has the same key value (based on fn:deep-equals).  That is, the values are normalized using the implicit timezone on the dynamic context.  

However, I don't see how dm:map-get can behave this way since there is no implicit timezone.  Should it raise an error or return the empty sequence?
Comment 1 Michael Kay 2015-04-14 22:05:25 UTC
This was discussed on the telcon today. 3 possible solutions were proposed:

(a) treat the value as "not found"

(b) throw an error

(c) remove the accessor from the spec (no-one actually references it).

Josh was inclined towards (b). Both MK and Josh felt that the accessor functions here were rather pointless.

Coming to this again after the meeting, I think the accessors map:get() and map:contains() as currently defined are pointless not just because no-one currently uses them, but because they are not fit for use: they fail to define behaviour precisely enough to underpin operations in the language such as map:get(); for example they don't say anything about how equality of keys is established. One solution to this might be to have a more primitive accessor function: in place of the current three accessors, have a single accessor map:entries() which returns an array of 2-member arrays, each 2-member array being a key/value pair.
Comment 2 Josh Spiegel 2015-05-05 15:20:13 UTC
The working group decided to accept the suggestion in comment 1 to have a single accessor map:entries() which returns an array of 2-member arrays, each 2-member array being a key/value pair.