[Bug 13187] map in xquery/xpath

http://www.w3.org/Bugs/Public/show_bug.cgi?id=13187

David Lee <dlee@calldei.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlee@calldei.com

--- Comment #1 from David Lee <dlee@calldei.com> 2011-07-21 22:48:17 UTC ---
XQuery and/or XPath need either a map or a nested sequence.
An extremely common use case is to load a coded value map which is used across
a complex xquery program.   Today you need to put this into an XML object and
use xpath hoping it is optimized.   By providing either a map or a nested
sequence then processors have the necessary hints to optimize the access.

These are actually subtly 2 separate use cases.


Maps:   provide a guaranteed (or at least implied) efficient mapping of
key->value pair for xquery processors.   Example: mapping codes to values. (say
ICD9 codes to descriptions.  So instead of of using  
collection("IDC9")/value[@code eq 'value']  you could preload the map so you
could use map:map( $icd9 , 'value' ).

Agreed this is primarily a hint to optimizers.  In theory any implementation
should be able to index arbitrary XML as maps.  But in practice it is very
difficult and rarely done.


As for sub-sequences.  This is a similar but not identical problem.

Maps *could* be implemented as sub-sequences such as 

(  "key" , ( "value1" , "value2" , "value3" ) ,
   "key2" ,( "value1" , "value2" , "value3" ) )


but this requires a major change in xquery semantics which would be not
backwards compatible.   I feel that sub-sequences should have been implemented
from the start (aka Lisp) but as they were initially flattened into single
level sequences it may be a hard step to implement them without backwards
comparability problems.


A Map as a top level object would solve most sub-sequence use cases without
backwards compatibility problems.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 21 July 2011 22:48:20 UTC