[xquery-talk] making a case for maps in xquery

James Fuller james.fuller.2007 at gmail.com
Fri Jul 22 03:35:28 PDT 2011


I have been using Saxon and MarkLogic implementation of map:map for
the past few months and am convinced of their usefulness.

(repeating some information from a w3c bug entry I previously entered
and thought I would raise here ....)

some adhoc usage scenarios;

* controller: keeping routing in memory makes things zippy, and a very
common map
for me nowadays is one where the keys are uri's and values whatever I need
(think url rewriting) or even functions to be passed ala HOX (higher order
xquery)

* memoize: maps makes it easy indeed to provide inline func caching ala

https://gist.github.com/954816

* working with json: maps make life a bit easier in this respect

* memory persistence layer: In a XML DB context maps become even more
useful as a kind of mem layer ... I know we should be trusting
underlying implementations to optimize this kind of thing but

Just as sequences seemed to enhance XQuery (and xpath's) conceptual
integrity ... I see Maps as a kind of final puzzle piece allowing
XQuery to be a more general purpose programming language ... which
admittedly may not be a goal of the W3C; but I think because its such
a productive language (as its cousin XSLT) we should 'grab' the
opportunity while its there.

Any other thoughts out there on the usage of maps ?

Jim Fuller


More information about the talk mailing list