← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-1189804 into lp:zorba

 

Matthias Brantner has proposed merging lp:~zorba-coders/zorba/bug-1189804 into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
Related bugs:
  Bug #1189804 in Zorba: "Update core module "unordered-map""
  https://bugs.launchpad.net/zorba/+bug/1189804

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h	2013-08-01 09:41:39 +0000
+++ include/zorba/pregenerated/diagnostic_list.h	2013-08-25 03:24:25 +0000
@@ -692,6 +692,10 @@
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0040_INCONSISTENT_EDIT;
 
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0041_INVALID_OPTION_TYPE;
+
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0042_ITEM_NOT_IN_COLLECTION;
+
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED;
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0002_COLLECTION_ALREADY_IMPORTED;

=== modified file 'modules/CMakeLists.txt'
--- modules/CMakeLists.txt	2013-08-13 19:19:44 +0000
+++ modules/CMakeLists.txt	2013-08-25 03:24:25 +0000
@@ -13,6 +13,7 @@
 # limitations under the License.
 
 ADD_SUBDIRECTORY(atomic)
+ADD_SUBDIRECTORY(store)
 ADD_SUBDIRECTORY(com)
 ADD_SUBDIRECTORY(org)
 ADD_SUBDIRECTORY(functx)

=== modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt'
--- modules/com/zorba-xquery/www/modules/CMakeLists.txt	2013-08-07 08:08:22 +0000
+++ modules/com/zorba-xquery/www/modules/CMakeLists.txt	2013-08-25 03:24:25 +0000
@@ -36,8 +36,6 @@
 DECLARE_ZORBA_MODULE(FILE introspection/sctx.xq VERSION 2.0
   URI "http://www.zorba-xquery.com/modules/introspection/sctx";)
 
-DECLARE_ZORBA_MODULE(FILE store/data-structures/unordered-map.xq VERSION 2.0
-  URI "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";)
 DECLARE_ZORBA_MODULE(FILE store/documents/dynamic.xq VERSION 2.0
   URI "http://www.zorba-xquery.com/modules/store/dynamic/documents";)
 DECLARE_ZORBA_MODULE(FILE store/dynamic/collections/ddl.xq VERSION 2.0

=== removed file 'modules/com/zorba-xquery/www/modules/store/data-structures/unordered-map.xq'
--- modules/com/zorba-xquery/www/modules/store/data-structures/unordered-map.xq	2013-08-09 08:27:30 +0000
+++ modules/com/zorba-xquery/www/modules/store/data-structures/unordered-map.xq	1970-01-01 00:00:00 +0000
@@ -1,256 +0,0 @@
-xquery version "3.0";
-(:
- : Copyright 2006-2012 The FLWOR Foundation.
- :
- : Licensed under the Apache License, Version 2.0 (the "License");
- : you may not use this file except in compliance with the License.
- : You may obtain a copy of the License at
- :
- : http://www.apache.org/licenses/LICENSE-2.0
- :
- : Unless required by applicable law or agreed to in writing, software
- : distributed under the License is distributed on an "AS IS" BASIS,
- : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- : See the License for the specific language governing permissions and
- : limitations under the License.
-:)
-
-(:~
- : <p>This module defines a set of functions for working with maps. A map
- : is identified by a QName and can be created using the map:create or
- : map:create-transient functions and deleted using the map:delete function,
- : respectively.</p>
- :
- : <p>The lifetime of a transient map is limited by the execution of the 
- : current XQuery program. A non-transient (or persistent) map lives until 
- : it is explicitly deleted. Accordingly, it's also available
- : to other XQuery programs.</p>
- :
- : <p>The key of a particular entry in the map can consist of a tuple of
- : atomic values (called attributes). The actual type of each attribute
- : is determined when the map is created. The value of each attribute can
- : be an arbitrary sequence of items.</p>
- :
- : @see <a href="../../html/data_lifecycle.html">Data Lifecycle</a>
- : @see <a href="modules_http:__zorba.io_modules_zorba-errors.html">http://zorba.io/errors</a>
- :
- : @author Matthias Brantner
- :
- : @project Zorba/Data Store/Data Structures/Unordered Map
- :)
-module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
-
-declare namespace zerr = "http://zorba.io/errors";;
-declare namespace err = "http://www.w3.org/2005/xqt-errors";;
-declare namespace an = "http://zorba.io/annotations";;
-
-declare namespace ver = "http://zorba.io/options/versioning";;
-declare option ver:module-version "2.0";
-
-(:~
- : Create a map with a given name and a set of type identifiers for each key
- : attribute. Note that the function is variadic and might take an arbitrary
- : number of type identifiers for the key attributes. Also note that the 
- : function is sequential and immediately creates the map in the store.
- :
- : @param $name the name of the map
- : @param $key-type an arbitrary number of types, one
- :        for each key attribute.
- :
- : @return the function is sequential and immediately creates
- :         the corresponding map but returns the empty-sequence.
- :
- : @error err:XPTY0004 if any of the attribute types is not a subtype of
- :        xs:anyAtomicType.
- : @error zerr:ZSTR0001 if a map with the given name already exists.
- :)
-declare %an:variadic %an:sequential function map:create(
-  $name as xs:QName,
-  $key-type as xs:QName) as empty-sequence() external;
-
-(:~
- : Create a transient map with a given name and a set of type identifiers
- : for each key attribute. Note that the function is variadic and might
- : take an arbitrary number of type identifiers for the key attributes.
- :
- : @param $name the name of the map
- : @param $key-type an arbitrary number of types, one
- :        for each key attribute.
- :
- : @return the function is sequential and immediately creates
- :         the corresponding map but returns the empty-sequence.
- :
- : @error err:XPTY0004 if any of the attribute types is not a subtype of
- :        xs:anyAtomicType.
- : @error zerr:ZSTR0001 if a map with the given name already exists.
- :)
-declare %an:variadic %an:sequential function map:create-transient(
-  $name as xs:QName,
-  $key-type as xs:QName) as empty-sequence() external;
-
-(:~
- : Destroys the map with the given name.
- : 
- : @param $name the name of the map to delete
- :
- : @return the function is sequential and immediately deletes
- :         the map but returns the empty-sequence.
- :
- : @error zerr:ZDDY0023 if a map with the given name does not exist.
- :)
-declare %an:sequential function map:delete(
-  $name as xs:QName) as empty-sequence() external;
-
-(:~
- : Inserts a new entry into the map with the given name. Note that the
- : function is variadic and might take an arbitrary number of key attributes.
- : If an entry with the given key already exists in the map, the value
- : sequences of the existing entry and the sequence passed using $value
- : argument are concatenated.
- :
- : Note that it is possible to insert entries with empty key attributes.
- : However as the getting the entries is based on the "eq" comparison and
- : as "eq" with an empty sequence always return false, it is not possible
- : to retrieve these entries.
- :
- : @param $name the name of the map
- : @param $value the value of the entry to insert
- : @param $key an arbitrary number of key attributes.
- :
- : @return the function is sequential and immediately inserts
- :         the entry into the map but returns the
- :         empty-sequence.
- :
- : @error zerr:ZDDY0023 if a map with the given name does not exist.
- : @error zerr:ZDDY0025 if the given number of key attributes does not match
- :        the number of key attributes specified when creating
- :        the map (see the map:create function).
- : @error zerr:ZXQD0005 if any of the given key attributes can not
- :        be cast (or is not a subtype) of the corresponding key attribute
- :        specified when creating the map.
- :
- : @see map:create
- :
- :)
-declare %an:variadic %an:sequential function map:insert(
-  $name as xs:QName,
-  $value as item()*,
-  $key as xs:anyAtomicType?) as empty-sequence() external;
-
-(:~
- : Returns the value of the entry with the given key from the map.
- :
- : Note that it is possible to insert entries with empty key attributes.
- : However as the getting the entries is based on the "eq" comparison and
- : as "eq" with an empty sequence always return false, it is not possible
- : to retrieve these entries.
- :
- : @param $name the name of the map
- : @param an arbitrary number of search key attributes.
- :
- : @return the value of the entry in the map identified
- :         by the given key. The empty-sequence will be returned
- :         if no entry with the given key is contained in the map.
- :
- : @error zerr:ZDDY0023 if a map with the given name does not exist.
- : @error zerr:ZDDY0025 if the given number of key attributes does not match
- :        the number of key attributes specified when creating
- :        the map (see the map:create function).
- : @error zerr:ZXQD0005 if any of the given key attributes can not
- :        be cast (or is not a subtype) of the corresponding key attribute
- :        specified when creating the map.
- :
- : @see map:create
- :)
-declare %an:variadic function map:get(
-  $name as xs:QName,
-  $key as xs:anyAtomicType?) as item()* external;
-
-(:~
- : Removes an entry identified by the given key from the map.
- :
- : Note that it is possible to insert entries with empty key attributes.
- : However as the removing the entries is based on the "eq" comparison and
- : as "eq" with an empty sequence always return false, it is not possible
- : to remove these entries.
- :
- : @param $name the name of the map
- : @param an arbitrary number of search key attributes.
- :
- : @return the function is sequential and immediately removes
- :         the entry into the map but returns the
- :         empty-sequence.
- :
- : @error zerr:ZDDY0023 if a map with the given name does not exist.
- : @error zerr:ZDDY0025 if the given number of key attributes does not match
- :        the number of key attributes specified when creating
- :        the map (see the map:create function).
- : @error zerr:ZXQD0005 if any of the given key attributes can not
- :        be cast (or is not a subtype) of the corresponding key attribute
- :        specified when creating the map.
- :
- : @see map:create
- :)
-declare %an:variadic %an:sequential function map:remove(
-  $name as xs:QName,
-  $key as xs:anyAtomicType?) as empty-sequence() external;
-
-(:~
- : Returns the keys of all entries of a map. The keys
- : are returned as sequence of nodes of the form:
- :
- : <pre>
- : &lt;key xmlns="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";>
- :   &lt;attribute value="key1_value"/>
- :   &lt;attribute value="key2_value"/>
- :   &lt;attribute value="key3_value"/>
- : &lt;/key>
- : </pre>
- :
- : The following condition always holds:
- : <tt>map:size($name) eq fn:count(map:keys($name))</tt>
- :
- : @param $name the name of the map
- :
- : @return all keys in the map.
- :
- : @error zerr:ZDDY0023 if a map with the given name does not exist.
- : 
- :)
-declare function map:keys(
-  $name as xs:QName) as node()* external;
-
-(:~
- : The number of entries in a map.
- :
- : The following condition always holds:
- : <tt>map:size($name) eq fn:count(map:keys($name))</tt>
- : 
- : @param $name the name of the map
- :
- : @return the number of entries in the map.
- :
- : @error zerr:ZDDY0023 if a map with the given name does not exist.
- :)
-declare function map:size($name as xs:QName) as xs:integer external;
-
-(:~
- : The function returns a sequence of QNames of the maps that are
- : available. The sequence will be empty if there are no maps.
- :
- : @return A sequence of QNames, one for each available map, or an emtpy sequence.
- :
- :)
-declare function map:available-maps() as xs:QName* external;
-
-(:~
- : The function returns true if the map identified by the given QName
- : is transient, false otherwise.
- :
- : @param $name the name of the map
- :
- : @return true if the map is transient, false otherwise.
- :
- : @error zerr:ZDDY0023 if a map with the given name does not exist.
- :)
-declare function map:is-transient($name as xs:QName) as xs:boolean external;

=== modified file 'modules/pregenerated/zorba-errors.xq'
--- modules/pregenerated/zorba-errors.xq	2013-08-07 05:28:39 +0000
+++ modules/pregenerated/zorba-errors.xq	2013-08-25 03:24:25 +0000
@@ -602,6 +602,14 @@
 
 (:~
 :)
+declare variable $zerr:ZDDY0041 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0041");
+
+(:~
+:)
+declare variable $zerr:ZDDY0042 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0042");
+
+(:~
+:)
 declare variable $zerr:ZDST0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0001");
 
 (:~

=== added directory 'modules/store'
=== added file 'modules/store/CMakeLists.txt'
--- modules/store/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ modules/store/CMakeLists.txt	2013-08-25 03:24:25 +0000
@@ -0,0 +1,16 @@
+# Copyright 2013 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DECLARE_ZORBA_MODULE(FILE unordered-maps.xq VERSION 1.0
+  URI "http://zorba.io/modules/unordered-maps";)

=== added file 'modules/store/unordered-maps.xq'
--- modules/store/unordered-maps.xq	1970-01-01 00:00:00 +0000
+++ modules/store/unordered-maps.xq	2013-08-25 03:24:25 +0000
@@ -0,0 +1,302 @@
+jsoniq version "1.0";
+
+(:
+ : Copyright 2013 The FLWOR Foundation.
+ :
+ : Licensed under the Apache License, Version 2.0 (the "License");
+ : you may not use this file except in compliance with the License.
+ : You may obtain a copy of the License at
+ :
+ : http://www.apache.org/licenses/LICENSE-2.0
+ :
+ : Unless required by applicable law or agreed to in writing, software
+ : distributed under the License is distributed on an "AS IS" BASIS,
+ : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ : See the License for the specific language governing permissions and
+ : limitations under the License.
+:)
+
+(:~
+ : This module defines a set of functions for working with maps. A map
+ : is identified by a string and can be created using the map:create function
+ : and dropped using the map:drop function.
+ : <p/>
+ : It is possible to create persistent and transient maps. The lifetime of a
+ : transient map is limited by the execution of the current query.
+ : A persistent map lives until it is explicitly dropped.
+ : Accordingly, it is also available to other requests.
+ : <p/>
+ : For example,
+ : <pre>map:create("my-map", ["string", "integer"], { "persistent" : false })</pre>
+ : will create a transient map named my-map having two keys.
+ : The types of the keys are string and integer.
+ : <p/>
+ : The key of a particular entry in the map can consist of a tuple of
+ : atomic values (called key attributes). The actual type of each attribute
+ : is determined when the map is created. The value of each entry is a
+ : sequence of items. If an item in this sequence is a object or array,
+ : this item needs to belong to a collection, otherwise, an error is raised.
+ :
+ : @author Matthias Brantner
+ :)
+module namespace map = "http://zorba.io/modules/unordered-maps";;
+
+declare namespace an = "http://zorba.io/annotations";;
+declare namespace zerr = "http://zorba.io/errors";;
+
+declare namespace ver = "http://zorba.io/options/versioning";;
+declare option ver:module-version "1.0";
+
+(:~
+ : Constant containing the field name of the options object
+ : indiciating whether a map is persistent or transient.
+ :)
+declare variable $map:PERSISTENT as string := "persistent";
+
+(:~
+ : Create a persistent map with a given name and type identifiers for the key
+ : attributes.
+ : <p/>
+ : If the map has only one key attribute, a single type identifier is given,
+ : for more than one key attribute an array of type identifiers is given.
+ : Calling this function is equivalent to calling create with the options
+ : <code>{ "persistent" : true }</code>
+ : Note that the function is sequential and immediately creates the map.
+ : <p/>
+ : Each key-type should be specified as string (e.g. "integer",
+ : "string", "boolean", "double", or "datetime").
+ : <p/>
+ : For example,
+ : <pre>map:create("my-map", "string")</pre> or
+ : <pre>map:create("my-map", ["string", "integer"])</pre>.
+ :
+ : @param $name the name of the map (the restrictions on collection names apply)
+ : @param $key-type one type identifier or an array of type identifiers for the
+ :        key attributes
+ :
+ : @return the function is sequential and immediately creates
+ :         the corresponding map. It returns the empty-sequence.
+ :
+ : @error err:XPTY0004 if any of the key attribute types is not a subtype of
+ :        anyAtomicType.
+ : @error zerr:ZSTR0001 if a map with the given name already exists.
+ : @error zerr:ZDDY1000 if the given name is not a legal collection name
+ : @error zerr:ZDDY1002 if any of the given options has an invalid type
+ :
+ : @see map:create#3
+ :)
+declare %an:sequential function map:create(
+  $name as string,
+  $key-types as item) as empty-sequence() external;
+
+(:~
+ : Create a map with a given name, type identifiers for the key attributes, and
+ : options.
+ : <p/>
+ : If the map has only one key attribute, a single type identifier is given,
+ : for more than one key attribute an array of type identifiers is given.
+ : Currently only one option is supported: To create a transient map the object
+ : <code>{ "persistent" : false }</code>
+ : has to be passed to the $options parameter.
+ : Note that the function is sequential and immediately creates the map in the
+ : store.
+ :
+ : @param $name the name of the map (the restrictions on collection names apply)
+ : @param $key-type one type identifier or an array of type identifiers for the
+ :        key attributes
+ : @param $options an object describing options for the map
+ :
+ : @return the function is sequential and immediately creates
+ :         the corresponding map but returns the empty-sequence.
+ :
+ : @error err:XPTY0004 if any of the attribute types is not a subtype of
+ :        anyAtomicType.
+ : @error zerr:ZSTR0001 if a map with the given name already exists.
+ : @error zerr:ZDDY1000 if the given name is not a legal collection name
+ : @error zerr:ZDDY1002 if any of the given options has an invalid type
+ :
+ : @see map:create#2
+ :)
+declare %an:sequential function map:create(
+  $name as string,
+  $key-types as item,
+  $options as object) as empty-sequence() external;
+
+(:~
+ : Deletes the map with the given name.
+ :
+ : @param $name the name of the map to drop
+ :
+ : @return the function is sequential and immediately drops
+ :         the map. It returns the empty-sequence.
+ :
+ : @error zerr:ZDDY0023 if a map with the given name does not exist.
+ :)
+declare %an:sequential function map:drop(
+  $name as string) as empty-sequence() external;
+
+(:~
+ : Inserts a new entry into the map with the given name.
+ : <p/>
+ : If the map has only one key attribute, a single key value is given, for
+ : more than one key attribute an array of key values is given.
+ : If an entry with the given key already exists in the map, the value
+ : sequences of the existing entry and the sequence passed using $value
+ : argument are concatenated.
+ : <p/>
+ : If an item in the value sequence is an object or array, this
+ : item needs to belong to a collection, otherwise, an an error
+ : is raised.
+ : <p/>
+ : Note that it is possible to insert entries with empty key attributes
+ : or key attributes having the value <code>null</code>. However, as 
+ : the comparison with an empty sequence or null always returns false, 
+ : it is not possible to retrieve these entries.
+ : <p/>
+ : For example,
+ : <pre>map:insert("my-map", "key", "value")</pre> or
+ : <pre>map:insert("my-map", [ "key1", "key2" ] , (42, "value"))</pre>.
+ :
+ :
+ : @param $name the name of the map
+ : @param $key either a single attribute key or an array of keys
+ : @param $value the value of the entry to insert
+ :
+ : @return the function is sequential and immediately inserts
+ :         the entry into the map. It returns the empty-sequence.
+ :
+ : @error zerr:ZDDY0023 if a map with the given name does not exist.
+ : @error zerr:ZDDY0025 if the given number of key attributes does not match
+ :        the number of key attributes specified when creating
+ :        the map (see the map:create function).
+ : @error zerr:ZXQD0005 if any of the given key attributes can not
+ :        be cast (or is not a subtype) of the corresponding key attribute
+ :        specified when creating the map.
+ : @error zerr:ZDDY1003 if the value to insert is an object or array
+ :        it must belong to a collection.
+ :)
+declare %an:sequential function map:insert(
+  $name as string,
+  $key as item,
+  $value as item*) as empty-sequence() external;
+
+(:~
+ : Returns the value of the entry with the given key from the map.
+ : <p/>
+ : If the map has only one key attribute, a single key value is given, for
+ : more than one key attribute an array of key values is given.
+ : <p/>
+ : Note that it is possible to insert entries with empty key attributes.
+ : However as the getting the entries is based on the "eq" comparison and
+ : as "eq" with an empty sequence always return false, it is not possible
+ : to retrieve these entries.
+ : <p/>
+ : For example,
+ : <pre>map:get("my-map", "key")</pre> or
+ : <pre>map:get("my-map", [ "key1", "key2" ])</pre>.
+ :
+ : @param $name the name of the map
+ : @param $key either a single attribute key or an array of keys
+ :
+ : @return the value of the entry in the map identified
+ :         by the given key. The empty-sequence will be returned
+ :         if no entry with the given key is contained in the map.
+ :
+ : @error zerr:ZDDY0023 if a map with the given name does not exist.
+ : @error zerr:ZDDY0025 if the given number of key attributes does not match
+ :        the number of key attributes specified when creating
+ :        the map (see the map:create function).
+ : @error zerr:ZXQD0005 if any of the given key attributes can not
+ :        be cast (or is not a subtype) of the corresponding key attribute
+ :        specified when creating the map.
+ :
+ : @see map:create
+ :)
+declare function map:get(
+  $name as string,
+  $key as item) as item* external;
+
+(:~
+ : Removes an entry identified by the given key from the map.
+ : <p/>
+ : If the map has only one key attribute, a single key value is given, for
+ : more than one key attribute an array of key values is given.
+ : <p/>
+ : Note that it is possible to insert entries with empty key attributes.
+ : However as the removing the entries is based on the "eq" comparison and
+ : as "eq" with an empty sequence always return false, it is not possible
+ : to delete these entries.
+ :
+ : @param $name the name of the map
+ : @param $key either a single attribute key or an array of keys
+ :
+ : @return the function is sequential and immediately deletes
+ :         the entry into the map but returns the
+ :         empty-sequence.
+ :
+ : @error zerr:ZDDY0023 if a map with the given name does not exist.
+ : @error zerr:ZDDY0025 if the given number of key attributes does not match
+ :        the number of key attributes specified when creating
+ :        the map (see the map:create function).
+ : @error zerr:ZXQD0005 if any of the given key attributes can not
+ :        be cast (or is not a subtype) of the corresponding key attribute
+ :        specified when creating the map.
+ :
+ : @see map:create
+ :)
+declare %an:sequential function map:delete(
+  $name as string,
+  $key as item) as empty-sequence() external;
+
+(:~
+ : Returns the keys of all entries of a map. The keys
+ : are returned as sequence of arrays.
+ : <p/>
+ : The following condition always holds:
+ : <tt>map:size($name) eq count(map:keys($name))</tt>
+ :
+ : @param $name the name of the map
+ :
+ : @return an sequence of arrays each array containing the values of all
+ :   attributes of one key.
+ :
+ : @error zerr:ZDDY0023 if a map with the given name does not exist.
+ :)
+declare function map:keys($name as string) as array()* external;
+
+(:~
+ : Returns the number of entries in a map.
+ : <p/>
+ : The following condition always holds:
+ : <tt>map:size($name) eq count(map:keys($name))</tt>
+ :
+ : @param $name the name of the map
+ :
+ : @return the number of entries in the map.
+ :
+ : @error zerr:ZDDY0023 if a map with the given name does not exist.
+ :)
+declare function map:size($name as string) as integer external;
+
+(:~
+ : The function returns a sequence of names of the maps that are
+ : available (persistent and non-persistent). The sequence will be
+ : empty if there are no maps.
+ : <p/>
+ :
+ : @return A sequence of string, one for each available map, or
+ : an empty sequence.
+ :)
+declare function map:available-maps() as string* external;
+
+(:~
+ : The function returns the options that were passed during creation or the
+ : default options if no options were passed.
+ :
+ : @param $name the name of the map
+ :
+ : @return an options object
+ :
+ : @error zerr:ZDDY0023 if a map with the given name does not exist.
+ :)
+declare function map:options($name as string) as object external;

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2013-08-09 09:08:04 +0000
+++ src/context/static_context.cpp	2013-08-25 03:24:25 +0000
@@ -407,8 +407,8 @@
 "http://www.zorba-xquery.com/modules/store/dynamic/documents";;
 
 const char*
-static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS =
-"http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
+static_context::ZORBA_STORE_UNORDERED_MAPS_FN_NS =
+"http://zorba.io/modules/unordered-maps";;
 
 const char*
 static_context::JSONIQ_DM_NS =
@@ -536,7 +536,7 @@
             ns == ZORBA_NODEPOS_FN_NS ||
 
             ns == ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS ||
-            ns == ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS ||
+            ns == ZORBA_STORE_UNORDERED_MAPS_FN_NS ||
             ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DDL_FN_NS ||
             ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS ||
             ns == ZORBA_STORE_STATIC_COLLECTIONS_DDL_FN_NS ||

=== modified file 'src/context/static_context.h'
--- src/context/static_context.h	2013-07-26 20:43:25 +0000
+++ src/context/static_context.h	2013-08-25 03:24:25 +0000
@@ -533,7 +533,7 @@
   static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DDL_FN_NS;
   static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DML_FN_NS;
   static const char* ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS;
-  static const char* ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS;
+  static const char* ZORBA_STORE_UNORDERED_MAPS_FN_NS;
 
   static const char* JSONIQ_DM_NS;
   static const char* JSONIQ_FN_NS;

=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2013-08-16 21:24:42 +0000
+++ src/diagnostics/diagnostic_en.xml	2013-08-25 03:24:25 +0000
@@ -2848,6 +2848,14 @@
       <value>attempt to edit an item with a template of a different kind (for example an object with a node).</value>
     </diagnostic>
 
+    <diagnostic code="ZDDY0041" name="INVALID_OPTION_TYPE">
+      <value>"$1": invalid type for option "$2"</value>
+    </diagnostic>
+
+    <diagnostic code="ZDDY0042" name="ITEM_NOT_IN_COLLECTION">
+      <value>"$1": map insertion requires $2 to belong to a collection</value>
+    </diagnostic>
+
     <diagnostic code="ZDST0001" name="COLLECTION_ALREADY_DECLARED">
       <value>"$1": collection already declared</value>
     </diagnostic>

=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp	2013-08-01 09:41:39 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp	2013-08-25 03:24:25 +0000
@@ -1017,6 +1017,12 @@
 ZorbaErrorCode ZDDY0040_INCONSISTENT_EDIT( "ZDDY0040" );
 
 
+ZorbaErrorCode ZDDY0041_INVALID_OPTION_TYPE( "ZDDY0041" );
+
+
+ZorbaErrorCode ZDDY0042_ITEM_NOT_IN_COLLECTION( "ZDDY0042" );
+
+
 ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED( "ZDST0001" );
 
 

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2013-08-16 21:24:42 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2013-08-25 03:24:25 +0000
@@ -356,6 +356,8 @@
   { "ZDDY0038", "\"$1\": illegal edit from queue collection" },
   { "ZDDY0039", "attempt to edit non-root node in collection \"$1\"" },
   { "ZDDY0040", "attempt to edit an item with a template of a different kind (for example an object with a node)." },
+  { "ZDDY0041", "\"$1\": invalid type for option \"$2\"" },
+  { "ZDDY0042", "\"$1\": map insertion requires $2 to belong to a collection" },
   { "ZDST0001", "\"$1\": collection already declared" },
   { "ZDST0002", "\"$1\": collection already imported into module \"$2\"" },
   { "ZDST0003", "\"$1\": collection declaration not allowed in main module" },

=== modified file 'src/functions/pregenerated/func_maps.cpp'
--- src/functions/pregenerated/func_maps.cpp	2013-03-05 23:11:50 +0000
+++ src/functions/pregenerated/func_maps.cpp	2013-08-25 03:24:25 +0000
@@ -31,7 +31,7 @@
 
 
 
-PlanIter_t zorba_store_data_structure_unordered_map_create::codegen(
+PlanIter_t zorba_store_unordered_maps_create::codegen(
   CompilerCB*,
   static_context* sctx,
   const QueryLoc& loc,
@@ -41,27 +41,17 @@
   return new MapCreateIterator(sctx, loc, argv);
 }
 
-PlanIter_t zorba_store_data_structure_unordered_map_create_transient::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new MapCreateTransientIterator(sctx, loc, argv);
-}
-
-PlanIter_t zorba_store_data_structure_unordered_map_delete::codegen(
-  CompilerCB*,
-  static_context* sctx,
-  const QueryLoc& loc,
-  std::vector<PlanIter_t>& argv,
-  expr& ann) const
-{
-  return new MapDestroyIterator(sctx, loc, argv);
-}
-
-PlanIter_t zorba_store_data_structure_unordered_map_get::codegen(
+PlanIter_t zorba_store_unordered_maps_drop::codegen(
+  CompilerCB*,
+  static_context* sctx,
+  const QueryLoc& loc,
+  std::vector<PlanIter_t>& argv,
+  expr& ann) const
+{
+  return new MapDropIterator(sctx, loc, argv);
+}
+
+PlanIter_t zorba_store_unordered_maps_get::codegen(
   CompilerCB*,
   static_context* sctx,
   const QueryLoc& loc,
@@ -71,7 +61,7 @@
   return new MapGetIterator(sctx, loc, argv);
 }
 
-PlanIter_t zorba_store_data_structure_unordered_map_insert::codegen(
+PlanIter_t zorba_store_unordered_maps_insert::codegen(
   CompilerCB*,
   static_context* sctx,
   const QueryLoc& loc,
@@ -81,17 +71,17 @@
   return new MapInsertIterator(sctx, loc, argv);
 }
 
-PlanIter_t zorba_store_data_structure_unordered_map_remove::codegen(
+PlanIter_t zorba_store_unordered_maps_delete::codegen(
   CompilerCB*,
   static_context* sctx,
   const QueryLoc& loc,
   std::vector<PlanIter_t>& argv,
   expr& ann) const
 {
-  return new MapRemoveIterator(sctx, loc, argv);
+  return new MapDeleteIterator(sctx, loc, argv);
 }
 
-PlanIter_t zorba_store_data_structure_unordered_map_keys::codegen(
+PlanIter_t zorba_store_unordered_maps_keys::codegen(
   CompilerCB*,
   static_context* sctx,
   const QueryLoc& loc,
@@ -101,7 +91,7 @@
   return new MapKeysIterator(sctx, loc, argv);
 }
 
-PlanIter_t zorba_store_data_structure_unordered_map_size::codegen(
+PlanIter_t zorba_store_unordered_maps_size::codegen(
   CompilerCB*,
   static_context* sctx,
   const QueryLoc& loc,
@@ -111,7 +101,7 @@
   return new MapSizeIterator(sctx, loc, argv);
 }
 
-PlanIter_t zorba_store_data_structure_unordered_map_available_maps::codegen(
+PlanIter_t zorba_store_unordered_maps_available_maps::codegen(
   CompilerCB*,
   static_context* sctx,
   const QueryLoc& loc,
@@ -121,14 +111,14 @@
   return new AvailableMapsIterator(sctx, loc, argv);
 }
 
-PlanIter_t zorba_store_data_structure_unordered_map_is_transient::codegen(
+PlanIter_t zorba_store_unordered_maps_options::codegen(
   CompilerCB*,
   static_context* sctx,
   const QueryLoc& loc,
   std::vector<PlanIter_t>& argv,
   expr& ann) const
 {
-  return new MapIsTransientIterator(sctx, loc, argv);
+  return new MapOptionsIterator(sctx, loc, argv);
 }
 
 void populate_context_maps(static_context* sctx)
@@ -136,124 +126,125 @@
 
 
       {
-    std::vector<xqtref_t> lParamTypes;
-    lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);
-    lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_create,
-        (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","create";), 
-        lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true),
-        FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_N);
-
-  }
-
-
-
-
-      {
-    std::vector<xqtref_t> lParamTypes;
-    lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);
-    lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_create_transient,
-        (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","create-transient";), 
-        lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true),
-        FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_TRANSIENT_N);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_delete,
-        (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","delete";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
-        GENV_TYPESYSTEM.EMPTY_TYPE),
-        FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_DELETE_1);
-
-  }
-
-
-
-
-      {
-    std::vector<xqtref_t> lParamTypes;
-    lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);
-    lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_get,
-        (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","get";), 
-        lParamTypes, GENV_TYPESYSTEM.ITEM_TYPE_STAR, true),
-        FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_GET_N);
-
-  }
-
-
-
-
-      {
-    std::vector<xqtref_t> lParamTypes;
-    lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);
-    lParamTypes.push_back(GENV_TYPESYSTEM.ITEM_TYPE_STAR);
-    lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_insert,
-        (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","insert";), 
-        lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true),
-        FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_INSERT_N);
-
-  }
-
-
-
-
-      {
-    std::vector<xqtref_t> lParamTypes;
-    lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);
-    lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_remove,
-        (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","remove";), 
-        lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true),
-        FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_REMOVE_N);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_keys,
-        (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","keys";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
-        GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR),
-        FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_KEYS_1);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_size,
-        (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","size";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
+    DECL_WITH_KIND(sctx, zorba_store_unordered_maps_create,
+        (createQName("http://zorba.io/modules/unordered-maps","","create";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
+        GENV_TYPESYSTEM.ITEM_TYPE_ONE, 
+        GENV_TYPESYSTEM.EMPTY_TYPE),
+        FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_CREATE_2);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, zorba_store_unordered_maps_create,
+        (createQName("http://zorba.io/modules/unordered-maps","","create";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
+        GENV_TYPESYSTEM.ITEM_TYPE_ONE, 
+        GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE, 
+        GENV_TYPESYSTEM.EMPTY_TYPE),
+        FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_CREATE_3);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, zorba_store_unordered_maps_drop,
+        (createQName("http://zorba.io/modules/unordered-maps","","drop";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
+        GENV_TYPESYSTEM.EMPTY_TYPE),
+        FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_DROP_1);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, zorba_store_unordered_maps_get,
+        (createQName("http://zorba.io/modules/unordered-maps","","get";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
+        GENV_TYPESYSTEM.ITEM_TYPE_ONE, 
+        GENV_TYPESYSTEM.ITEM_TYPE_STAR),
+        FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_GET_2);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, zorba_store_unordered_maps_insert,
+        (createQName("http://zorba.io/modules/unordered-maps","","insert";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
+        GENV_TYPESYSTEM.ITEM_TYPE_ONE, 
+        GENV_TYPESYSTEM.ITEM_TYPE_STAR, 
+        GENV_TYPESYSTEM.EMPTY_TYPE),
+        FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_INSERT_3);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, zorba_store_unordered_maps_delete,
+        (createQName("http://zorba.io/modules/unordered-maps","","delete";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
+        GENV_TYPESYSTEM.ITEM_TYPE_ONE, 
+        GENV_TYPESYSTEM.EMPTY_TYPE),
+        FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_DELETE_2);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, zorba_store_unordered_maps_keys,
+        (createQName("http://zorba.io/modules/unordered-maps","","keys";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
+        GENV_TYPESYSTEM.JSON_ARRAY_TYPE_STAR),
+        FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_KEYS_1);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, zorba_store_unordered_maps_size,
+        (createQName("http://zorba.io/modules/unordered-maps","","size";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
         GENV_TYPESYSTEM.INTEGER_TYPE_ONE),
-        FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_SIZE_1);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_available_maps,
-        (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","available-maps";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_STAR),
-        FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_AVAILABLE_MAPS_0);
-
-  }
-
-
-
-
-      {
-    DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_is_transient,
-        (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","is-transient";), 
-        GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
-        GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
-        FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_IS_TRANSIENT_1);
+        FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_SIZE_1);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, zorba_store_unordered_maps_available_maps,
+        (createQName("http://zorba.io/modules/unordered-maps","","available-maps";), 
+        GENV_TYPESYSTEM.STRING_TYPE_STAR),
+        FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_AVAILABLE_MAPS_0);
+
+  }
+
+
+
+
+      {
+    DECL_WITH_KIND(sctx, zorba_store_unordered_maps_options,
+        (createQName("http://zorba.io/modules/unordered-maps","","options";), 
+        GENV_TYPESYSTEM.STRING_TYPE_ONE, 
+        GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE),
+        FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_OPTIONS_1);
 
   }
 

=== modified file 'src/functions/pregenerated/func_maps.h'
--- src/functions/pregenerated/func_maps.h	2013-03-05 23:11:50 +0000
+++ src/functions/pregenerated/func_maps.h	2013-08-25 03:24:25 +0000
@@ -38,85 +38,66 @@
 
 
 
-//zorba-store-data-structure-unordered-map:create
-class zorba_store_data_structure_unordered_map_create : public function
-{
-public:
-  zorba_store_data_structure_unordered_map_create(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
-
-  bool accessesDynCtx() const { return true; }
-
-  CODEGEN_DECL();
-};
-
-
-//zorba-store-data-structure-unordered-map:create-transient
-class zorba_store_data_structure_unordered_map_create_transient : public function
-{
-public:
-  zorba_store_data_structure_unordered_map_create_transient(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
-
-  bool accessesDynCtx() const { return true; }
-
-  CODEGEN_DECL();
-};
-
-
-//zorba-store-data-structure-unordered-map:delete
-class zorba_store_data_structure_unordered_map_delete : public function
-{
-public:
-  zorba_store_data_structure_unordered_map_delete(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
-
-  bool accessesDynCtx() const { return true; }
-
-  CODEGEN_DECL();
-};
-
-
-//zorba-store-data-structure-unordered-map:get
-class zorba_store_data_structure_unordered_map_get : public function
-{
-public:
-  zorba_store_data_structure_unordered_map_get(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  bool accessesDynCtx() const { return true; }
-
-  CODEGEN_DECL();
-};
-
-
-//zorba-store-data-structure-unordered-map:insert
-class zorba_store_data_structure_unordered_map_insert : public function
-{
-public:
-  zorba_store_data_structure_unordered_map_insert(const signature& sig, FunctionConsts::FunctionKind kind)
+//zorba-store-unordered-maps:create
+class zorba_store_unordered_maps_create : public function
+{
+public:
+  zorba_store_unordered_maps_create(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
+
+  bool accessesDynCtx() const { return true; }
+
+  CODEGEN_DECL();
+};
+
+
+//zorba-store-unordered-maps:drop
+class zorba_store_unordered_maps_drop : public function
+{
+public:
+  zorba_store_unordered_maps_drop(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
+
+  bool accessesDynCtx() const { return true; }
+
+  CODEGEN_DECL();
+};
+
+
+//zorba-store-unordered-maps:get
+class zorba_store_unordered_maps_get : public function
+{
+public:
+  zorba_store_unordered_maps_get(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  bool accessesDynCtx() const { return true; }
+
+  CODEGEN_DECL();
+};
+
+
+//zorba-store-unordered-maps:insert
+class zorba_store_unordered_maps_insert : public function
+{
+public:
+  zorba_store_unordered_maps_insert(const signature& sig, FunctionConsts::FunctionKind kind)
     : 
     function(sig, kind)
   {
@@ -133,11 +114,11 @@
 };
 
 
-//zorba-store-data-structure-unordered-map:remove
-class zorba_store_data_structure_unordered_map_remove : public function
+//zorba-store-unordered-maps:delete
+class zorba_store_unordered_maps_delete : public function
 {
 public:
-  zorba_store_data_structure_unordered_map_remove(const signature& sig, FunctionConsts::FunctionKind kind)
+  zorba_store_unordered_maps_delete(const signature& sig, FunctionConsts::FunctionKind kind)
     : 
     function(sig, kind)
   {
@@ -152,62 +133,62 @@
 };
 
 
-//zorba-store-data-structure-unordered-map:keys
-class zorba_store_data_structure_unordered_map_keys : public function
-{
-public:
-  zorba_store_data_structure_unordered_map_keys(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  bool accessesDynCtx() const { return true; }
-
-  CODEGEN_DECL();
-};
-
-
-//zorba-store-data-structure-unordered-map:size
-class zorba_store_data_structure_unordered_map_size : public function
-{
-public:
-  zorba_store_data_structure_unordered_map_size(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  bool accessesDynCtx() const { return true; }
-
-  CODEGEN_DECL();
-};
-
-
-//zorba-store-data-structure-unordered-map:available-maps
-class zorba_store_data_structure_unordered_map_available_maps : public function
-{
-public:
-  zorba_store_data_structure_unordered_map_available_maps(const signature& sig, FunctionConsts::FunctionKind kind)
-    : 
-    function(sig, kind)
-  {
-
-  }
-
-  bool accessesDynCtx() const { return true; }
-
-  CODEGEN_DECL();
-};
-
-
-//zorba-store-data-structure-unordered-map:is-transient
-class zorba_store_data_structure_unordered_map_is_transient : public function
-{
-public:
-  zorba_store_data_structure_unordered_map_is_transient(const signature& sig, FunctionConsts::FunctionKind kind)
+//zorba-store-unordered-maps:keys
+class zorba_store_unordered_maps_keys : public function
+{
+public:
+  zorba_store_unordered_maps_keys(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  bool accessesDynCtx() const { return true; }
+
+  CODEGEN_DECL();
+};
+
+
+//zorba-store-unordered-maps:size
+class zorba_store_unordered_maps_size : public function
+{
+public:
+  zorba_store_unordered_maps_size(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  bool accessesDynCtx() const { return true; }
+
+  CODEGEN_DECL();
+};
+
+
+//zorba-store-unordered-maps:available-maps
+class zorba_store_unordered_maps_available_maps : public function
+{
+public:
+  zorba_store_unordered_maps_available_maps(const signature& sig, FunctionConsts::FunctionKind kind)
+    : 
+    function(sig, kind)
+  {
+
+  }
+
+  bool accessesDynCtx() const { return true; }
+
+  CODEGEN_DECL();
+};
+
+
+//zorba-store-unordered-maps:options
+class zorba_store_unordered_maps_options : public function
+{
+public:
+  zorba_store_unordered_maps_options(const signature& sig, FunctionConsts::FunctionKind kind)
     : 
     function(sig, kind)
   {

=== modified file 'src/functions/pregenerated/function_enum.h'
--- src/functions/pregenerated/function_enum.h	2013-08-16 13:00:06 +0000
+++ src/functions/pregenerated/function_enum.h	2013-08-25 03:24:25 +0000
@@ -444,16 +444,16 @@
   ZORBA_STORE_DOCUMENTS_DOCUMENT_1,
   ZORBA_STORE_DOCUMENTS_AVAILABLE_DOCUMENTS_0,
   ZORBA_STORE_DOCUMENTS_IS_AVAILABLE_DOCUMENT_1,
-  ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_N,
-  ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_TRANSIENT_N,
-  ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_DELETE_1,
-  ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_GET_N,
-  ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_INSERT_N,
-  ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_REMOVE_N,
-  ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_KEYS_1,
-  ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_SIZE_1,
-  ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_AVAILABLE_MAPS_0,
-  ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_IS_TRANSIENT_1,
+  ZORBA_STORE_UNORDERED_MAPS_CREATE_2,
+  ZORBA_STORE_UNORDERED_MAPS_CREATE_3,
+  ZORBA_STORE_UNORDERED_MAPS_DROP_1,
+  ZORBA_STORE_UNORDERED_MAPS_GET_2,
+  ZORBA_STORE_UNORDERED_MAPS_INSERT_3,
+  ZORBA_STORE_UNORDERED_MAPS_DELETE_2,
+  ZORBA_STORE_UNORDERED_MAPS_KEYS_1,
+  ZORBA_STORE_UNORDERED_MAPS_SIZE_1,
+  ZORBA_STORE_UNORDERED_MAPS_AVAILABLE_MAPS_0,
+  ZORBA_STORE_UNORDERED_MAPS_OPTIONS_1,
   FN_CODEPOINTS_TO_STRING_1,
   FN_STRING_TO_CODEPOINTS_1,
   FN_COMPARE_2,

=== modified file 'src/runtime/indexing/index_func_impl.cpp'
--- src/runtime/indexing/index_func_impl.cpp	2012-08-03 10:25:31 +0000
+++ src/runtime/indexing/index_func_impl.cpp	2013-08-25 03:24:25 +0000
@@ -48,7 +48,7 @@
 
   store::Item_t lKeyNodeName;
   GENV_ITEMFACTORY->createQName(lKeyNodeName,
-      static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS,
+      static_context::ZORBA_STORE_UNORDERED_MAPS_FN_NS,
       "", "key");
 
   IndexKeysIteratorState* state;

=== modified file 'src/runtime/pregenerated/iterator_enum.h'
--- src/runtime/pregenerated/iterator_enum.h	2013-08-16 13:00:06 +0000
+++ src/runtime/pregenerated/iterator_enum.h	2013-08-25 03:24:25 +0000
@@ -328,15 +328,14 @@
   TYPE_AvailableDocumentsIterator,
   TYPE_IsAvailableDocumentIterator,
   TYPE_MapCreateIterator,
-  TYPE_MapCreateTransientIterator,
-  TYPE_MapDestroyIterator,
+  TYPE_MapDropIterator,
   TYPE_MapGetIterator,
   TYPE_MapInsertIterator,
-  TYPE_MapRemoveIterator,
+  TYPE_MapDeleteIterator,
   TYPE_MapKeysIterator,
   TYPE_MapSizeIterator,
   TYPE_AvailableMapsIterator,
-  TYPE_MapIsTransientIterator,
+  TYPE_MapOptionsIterator,
   TYPE_CodepointsToStringIterator,
   TYPE_StringToCodepointsIterator,
   TYPE_CompareStrIterator,

=== modified file 'src/runtime/spec/mappings.xml'
--- src/runtime/spec/mappings.xml	2013-08-09 09:20:54 +0000
+++ src/runtime/spec/mappings.xml	2013-08-25 03:24:25 +0000
@@ -73,8 +73,8 @@
       prefix="zorba-store-documents"/>
 
     <zorba:namespace
-      uri="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";
-      prefix="zorba-store-data-structure-unordered-map"/>
+      uri="http://zorba.io/modules/unordered-maps";
+      prefix="zorba-store-unordered-maps"/>
 
     <zorba:namespace
       uri="http://zorba.io/modules/full-text";

=== modified file 'src/runtime/spec/store/maps.xml'
--- src/runtime/spec/store/maps.xml	2013-02-07 17:24:36 +0000
+++ src/runtime/spec/store/maps.xml	2013-08-25 03:24:25 +0000
@@ -33,66 +33,41 @@
 
     <zorba:function>
 
-      <zorba:signature
-        variadic="true"
-        localname="create"
-        prefix="zorba-store-data-structure-unordered-map">
-        <zorba:param>xs:QName</zorba:param> <!-- name of the hashmap -->
-        <zorba:param>xs:QName</zorba:param> <!-- list of key types -->
-        <zorba:output>empty-sequence()</zorba:output>
-      </zorba:signature>
-
-      <zorba:methods>
-        <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/>
-        <zorba:accessesDynCtx returnValue="true"/>
-      </zorba:methods>
-
-    </zorba:function>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="MapCreateTransientIterator" >
-
-    <zorba:description author="Matthias Brantner">
-    </zorba:description>
-
-    <zorba:function> 
-
-      <zorba:signature
-        variadic="true"
-        localname="create-transient"
-        prefix="zorba-store-data-structure-unordered-map">
-        <zorba:param>xs:QName</zorba:param> <!-- name of the hashmap -->
-        <zorba:param>xs:QName</zorba:param> <!-- list of key types -->
-        <zorba:output>empty-sequence()</zorba:output>
-      </zorba:signature>
-
-      <zorba:methods>
-        <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/>
-        <zorba:accessesDynCtx returnValue="true"/>
-      </zorba:methods>
-
-    </zorba:function>
-
-</zorba:iterator>
-
-<!--
-/*******************************************************************************
-********************************************************************************/
--->
-<zorba:iterator name="MapDestroyIterator" >
-
-    <zorba:description author="Matthias Brantner">
-    </zorba:description>
-
-    <zorba:function> 
-
-      <zorba:signature localname="delete" prefix="zorba-store-data-structure-unordered-map">
-        <zorba:param>xs:QName</zorba:param>
+      <zorba:signature localname="create" prefix="zorba-store-unordered-maps">
+        <zorba:param>xs:string</zorba:param> <!-- name of the hashmap -->
+        <zorba:param>item()</zorba:param> <!-- list of key types -->
+        <zorba:output>empty-sequence()</zorba:output>
+      </zorba:signature>
+
+      <zorba:signature localname="create" prefix="zorba-store-unordered-maps">
+        <zorba:param>xs:string</zorba:param> <!-- name of the hashmap -->
+        <zorba:param>item()</zorba:param> <!-- list of key types -->
+        <zorba:param>object()</zorba:param> <!-- options object -->
+        <zorba:output>empty-sequence()</zorba:output>
+      </zorba:signature>
+
+      <zorba:methods>
+        <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/>
+        <zorba:accessesDynCtx returnValue="true"/>
+      </zorba:methods>
+
+    </zorba:function>
+
+</zorba:iterator>
+
+<!--
+/*******************************************************************************
+********************************************************************************/
+-->
+<zorba:iterator name="MapDropIterator" >
+
+    <zorba:description author="Matthias Brantner">
+    </zorba:description>
+
+    <zorba:function> 
+
+      <zorba:signature localname="drop" prefix="zorba-store-unordered-maps">
+        <zorba:param>xs:string</zorba:param>
         <zorba:output>empty-sequence()</zorba:output>
       </zorba:signature>
 
@@ -116,9 +91,9 @@
 
     <zorba:function> 
 
-      <zorba:signature variadic="true" localname="get" prefix="zorba-store-data-structure-unordered-map">
-        <zorba:param>xs:QName</zorba:param>
-        <zorba:param>xs:anyAtomicType?</zorba:param>
+      <zorba:signature localname="get" prefix="zorba-store-unordered-maps">
+        <zorba:param>xs:string</zorba:param>
+        <zorba:param>item()</zorba:param>
         <zorba:output>item()*</zorba:output>
       </zorba:signature>
 
@@ -146,10 +121,10 @@
 
     <zorba:function> 
 
-      <zorba:signature variadic="true" localname="insert" prefix="zorba-store-data-structure-unordered-map">
-        <zorba:param>xs:QName</zorba:param>
-        <zorba:param>item()*</zorba:param> <!-- value -->
-        <zorba:param>xs:anyAtomicType?</zorba:param> <!-- list of keys -->
+      <zorba:signature localname="insert" prefix="zorba-store-unordered-maps">
+        <zorba:param>xs:string</zorba:param>
+        <zorba:param>item()</zorba:param>
+        <zorba:param>item()*</zorba:param>
         <zorba:output>empty-sequence()</zorba:output>
       </zorba:signature>
 
@@ -167,7 +142,7 @@
 /*******************************************************************************
 ********************************************************************************/
 -->
-<zorba:iterator name="MapRemoveIterator" >
+<zorba:iterator name="MapDeleteIterator" >
 
     <zorba:description author="Matthias Brantner">
     </zorba:description>
@@ -175,12 +150,11 @@
     <zorba:function> 
 
       <zorba:signature
-        variadic="true"
-        localname="remove"
-        prefix="zorba-store-data-structure-unordered-map">
+        localname="delete"
+        prefix="zorba-store-unordered-maps">
 
-        <zorba:param>xs:QName</zorba:param>
-        <zorba:param>xs:anyAtomicType?</zorba:param>
+        <zorba:param>xs:string</zorba:param>
+        <zorba:param>item()</zorba:param>
         <zorba:output>empty-sequence()</zorba:output>
       </zorba:signature>
 
@@ -204,9 +178,9 @@
 
     <zorba:function> 
 
-      <zorba:signature localname="keys" prefix="zorba-store-data-structure-unordered-map">
-        <zorba:param>xs:QName</zorba:param>
-        <zorba:output>node()*</zorba:output>
+      <zorba:signature localname="keys" prefix="zorba-store-unordered-maps">
+        <zorba:param>xs:string</zorba:param>
+        <zorba:output>array()*</zorba:output>
       </zorba:signature>
 
       <zorba:methods>
@@ -219,8 +193,6 @@
       <zorba:member type="store::Index::KeyIterator_t" name="theIter"/>
     </zorba:state>
 
-    <zorba:member type="store::NsBindings" name="theNSBindings" brief=""/>
-
 </zorba:iterator>
 
 <!--
@@ -234,8 +206,8 @@
 
     <zorba:function> 
 
-      <zorba:signature localname="size" prefix="zorba-store-data-structure-unordered-map">
-        <zorba:param>xs:QName</zorba:param>
+      <zorba:signature localname="size" prefix="zorba-store-unordered-maps">
+        <zorba:param>xs:string</zorba:param>
         <zorba:output>xs:integer</zorba:output>
       </zorba:signature>
 
@@ -258,8 +230,8 @@
 
     <zorba:function> 
 
-      <zorba:signature localname="available-maps" prefix="zorba-store-data-structure-unordered-map">
-        <zorba:output>xs:QName*</zorba:output>
+      <zorba:signature localname="available-maps" prefix="zorba-store-unordered-maps">
+        <zorba:output>xs:string*</zorba:output>
       </zorba:signature>
 
       <zorba:methods>
@@ -285,16 +257,16 @@
 /*******************************************************************************
 ********************************************************************************/
 -->
-<zorba:iterator name="MapIsTransientIterator" >
+<zorba:iterator name="MapOptionsIterator" >
 
     <zorba:description author="Matthias Brantner">
     </zorba:description>
 
     <zorba:function> 
 
-      <zorba:signature localname="is-transient" prefix="zorba-store-data-structure-unordered-map">
-        <zorba:param>xs:QName</zorba:param>
-        <zorba:output>xs:boolean</zorba:output>
+      <zorba:signature localname="options" prefix="zorba-store-unordered-maps">
+        <zorba:param>xs:string</zorba:param>
+        <zorba:output>object()</zorba:output>
       </zorba:signature>
 
       <zorba:methods>

=== modified file 'src/runtime/store/maps_impl.cpp'
--- src/runtime/store/maps_impl.cpp	2013-06-11 05:40:04 +0000
+++ src/runtime/store/maps_impl.cpp	2013-08-25 03:24:25 +0000
@@ -49,6 +49,29 @@
 
 /*******************************************************************************
 ********************************************************************************/
+zstring
+getMapURI(
+    const static_context* sctx,
+    const QueryLoc& aLoc)
+{
+  return "http://zorba.io/maps";;
+}
+
+/*******************************************************************************
+********************************************************************************/
+void
+createMapQName(
+    store::Item_t& name,
+    const static_context* sctx,
+    const QueryLoc& loc)
+{
+  GENV_ITEMFACTORY->createQName(name, getMapURI(sctx, loc),
+      "", name->getStringValue()); 
+}
+
+
+/*******************************************************************************
+********************************************************************************/
 void
 castOrCheckIndexType(
     store::Item_t& aKeyItem,
@@ -100,6 +123,213 @@
 /*******************************************************************************
 ********************************************************************************/
 void
+createKeysArray(
+    store::IndexKey& aKey,
+    store::Item_t& aArray)
+{
+  std::vector<store::Item_t> lValues;
+
+  size_t i = 1;
+
+  // build [ key1, null, key3 ]
+  for (store::ItemVector::iterator lIter = aKey.begin();
+       lIter != aKey.end();
+       ++lIter, ++i)
+  {
+    lValues.resize(i);
+
+    store::Item_t lValue = *lIter;
+    if (lValue)
+    {
+      lValues[i - 1] = (*lIter);
+    }
+    else
+    {
+      GENV_ITEMFACTORY->createJSONNull(lValues[i - 1]);
+    }
+  }
+
+  GENV_ITEMFACTORY->createJSONArray(aArray, lValues);
+}
+
+
+/*******************************************************************************
+********************************************************************************/
+void
+processTypes(
+    const store::Item_t& aMapName,
+    const QueryLoc& loc,
+    std::vector<store::Item_t>& aTypes)
+{
+  for (size_t i = 0; i < aTypes.size(); ++i)
+  {
+    store::Item_t& lType = aTypes[i];
+
+    if (!lType->isAtomic())
+    {
+      RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc,
+          ERROR_PARAMS(*(GENV_TYPESYSTEM.create_value_type(lType)),
+          "anyAtomicType",
+          aMapName->getStringValue()));
+    }
+
+    if (TypeOps::is_subtype(lType->getTypeCode(), store::XS_STRING))
+    {
+      zstring t = lType->getStringValue();
+      std::transform(t.begin(), t.end(), t.begin(), zorba::unicode::to_lower);
+      if (t == "string")
+        lType = GENV_TYPESYSTEM.XS_STRING_QNAME;
+      else if (t == "integer")
+        lType = GENV_TYPESYSTEM.XS_INTEGER_QNAME;
+      else if (t == "boolean")
+        lType = GENV_TYPESYSTEM.XS_BOOLEAN_QNAME;
+      else if (t == "datetime")
+        lType = GENV_TYPESYSTEM.XS_DATETIME_QNAME;
+      else if (t == "date")
+        lType = GENV_TYPESYSTEM.XS_DATE_QNAME;
+      else if (t == "time")
+        lType = GENV_TYPESYSTEM.XS_TIME_QNAME;
+      else if (t == "duration")
+        lType = GENV_TYPESYSTEM.XS_DURATION_QNAME;
+      else if (t == "daytimeduration")
+        lType = GENV_TYPESYSTEM.XS_DT_DURATION_QNAME;
+      else if (t == "yearmonthduration")
+        lType = GENV_TYPESYSTEM.XS_YM_DURATION_QNAME;
+      else if (t == "float")
+        lType = GENV_TYPESYSTEM.XS_FLOAT_QNAME;
+      else if (t == "double")
+        lType = GENV_TYPESYSTEM.XS_DOUBLE_QNAME;
+      else if (t == "decimal")
+        lType = GENV_TYPESYSTEM.XS_DECIMAL_QNAME;
+      else if (t == "long")
+        lType = GENV_TYPESYSTEM.XS_LONG_QNAME;
+      else if (t == "int")
+        lType = GENV_TYPESYSTEM.XS_INT_QNAME;
+      else if (t == "short")
+        lType = GENV_TYPESYSTEM.XS_SHORT_QNAME;
+      else if (t == "byte")
+        lType = GENV_TYPESYSTEM.XS_BYTE_QNAME;
+      else if (t == "base64binary")
+        lType = GENV_TYPESYSTEM.XS_BASE64BINARY_QNAME;
+      else if (t == "hexbinary")
+        lType = GENV_TYPESYSTEM.XS_HEXBINARY_QNAME;
+      else if (t == "null")
+        lType = GENV_TYPESYSTEM.JS_NULL_QNAME;
+      else
+        RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc,
+            ERROR_PARAMS(t,
+            "anyAtomicType",
+            aMapName->getStringValue()));
+    }
+    else if (!TypeOps::is_subtype(lType->getTypeCode(), store::XS_QNAME))
+    {
+      RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc,
+          ERROR_PARAMS(*(GENV_TYPESYSTEM.create_value_type(lType)),
+          "QName",
+          aMapName->getStringValue()));
+    }
+  }
+}
+
+/*******************************************************************************
+********************************************************************************/
+bool
+prepareKeyAttributes(
+    const QueryLoc& loc,
+    const static_context* sctx,
+    const store::Item_t& aKey,
+    store::Index* aMap,
+    std::vector<store::Item_t>& aKeyAttrs)
+{
+  if (aKey->isArray())
+  {
+    ulong lNumKeys = to_xs_long(aKey->getArraySize());
+    aKeyAttrs.resize(lNumKeys);
+    for (size_t i = 0; i < lNumKeys; ++i)
+    {
+      aKeyAttrs[i] = aKey->getArrayValue(xs_integer(i+1));
+    }
+  }
+  else
+  {
+    aKeyAttrs.push_back(aKey);
+  }
+
+  const store::IndexSpecification& lSpec = aMap->getSpecification();
+
+  store::Item_t lName = aMap->getName();
+
+  if (lSpec.getNumColumns() != aKeyAttrs.size())
+  {
+    RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
+    ERROR_PARAMS(lName->getLocalName(),
+                 "map",
+                 aKeyAttrs.size(),
+                 lSpec.getNumColumns()));
+  }
+
+  bool lValidProbe = true;
+
+  for (size_t i = 0; i < aKeyAttrs.size(); ++i)
+  {
+    store::Item_t& lTmp = aKeyAttrs[i];
+
+    if (! lTmp->isAtomic())
+    {
+      store::Item_t lVal;
+      store::Iterator_t lValIter;
+      lTmp->getTypedValue(lVal, lValIter);
+      if (! lValIter.isNull())
+      {
+        RAISE_ERROR(err::XPTY0004, loc,
+        ERROR_PARAMS(ZED(XPTY0004_NoMultiSeqTypePromotion_2),
+                     lSpec.theKeyTypes.at(i)));
+      }
+      lTmp = lVal;
+    }
+
+    namespace_context tmp_ctx(sctx);
+    castOrCheckIndexType(lTmp, lSpec.theKeyTypes[i], lName, &tmp_ctx, loc);
+
+    if (lTmp == NULL ||
+        (lTmp->isAtomic() && lTmp->getTypeCode() == store::JS_NULL))
+    {
+      lValidProbe = false;
+    }
+  }
+  return lValidProbe;
+}
+
+
+/*******************************************************************************
+********************************************************************************/
+void
+processOption(
+    const QueryLoc& loc,
+    const store::Item_t& aOption,
+    bool& aIsPersistent)
+{
+  assert(aOption->isObject());
+  zstring lTmp("persistent");
+
+  store::Item_t lPersistentItem;
+  GENV_ITEMFACTORY->createString(lPersistentItem, lTmp);
+
+  lPersistentItem = aOption->getObjectValue(lPersistentItem);
+  if (!lPersistentItem->isAtomic()
+      || lPersistentItem->getTypeCode() != store::XS_BOOLEAN)
+  {
+    RAISE_ERROR(zerr::ZDDY0041_INVALID_OPTION_TYPE,
+      loc, ERROR_PARAMS(
+        lPersistentItem->getType()->getLocalName(), "persistent", "boolean"));
+  }
+  aIsPersistent = lPersistentItem->getBooleanValue();
+}
+
+
+/*******************************************************************************
+********************************************************************************/
+void
 checkMapTypes(
     std::vector<store::Item_t>& aTypes,
     const store::Item_t& aMapName,
@@ -164,124 +394,105 @@
     store::Item_t& result,
     PlanState& aPlanState) const
 {
-  store::Item_t              lQName;
+  store::Item_t              lName;
+  store::Item_t              lTypeParam;
   std::vector<store::Item_t> lTypes;
-  std::vector<zstring>       lCollations;
-  std::auto_ptr<store::PUL>  lPul;
-  long                       lTimezone = 0;
-
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  consumeNext(lQName, theChildren[0].getp(), aPlanState);
-
-  if (GENV_STORE.getMap(lQName)
-      || aPlanState.theLocalDynCtx->getMap(lQName.getp()))
-  {
-    RAISE_ERROR(
-      zerr::ZSTR0001_INDEX_ALREADY_EXISTS,
-      loc,
-      ERROR_PARAMS( lQName->getStringValue() )
-    );
-  }
-
-  lCollations.resize(theChildren.size() - 1);
-  lTypes.resize(theChildren.size() - 1);
-
-  for (size_t i = 1; i < theChildren.size(); ++i)
-  {
-    consumeNext(lTypes[i-1], theChildren[i].getp(), aPlanState);
-  }
-
-  checkMapTypes(lTypes, lQName, loc);
-
-  lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList());
-  lPul->addCreateHashMap(&loc, lQName, lTypes, lCollations, lTimezone);
-
-  apply_updates(
-      aPlanState.theCompilerCB,
-      aPlanState.theGlobalDynCtx,
-      theSctx,
-      lPul.get(),
-      loc);
-
-  result = NULL;
-
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-********************************************************************************/
-bool
-MapCreateTransientIterator::nextImpl(
-    store::Item_t& result,
-    PlanState& aPlanState) const
-{
-  store::Item_t              lQName;
-  store::IndexSpecification  lSpec;
-  store::Index_t             lIndex;
-  std::vector<std::string>   lCollations;
-
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
-
-  consumeNext(lQName, theChildren[0].getp(), aPlanState);
-
-  if (GENV_STORE.getMap(lQName)
-      || aPlanState.theLocalDynCtx->getMap(lQName.getp()))
-  {
-    RAISE_ERROR(
-      zerr::ZSTR0001_INDEX_ALREADY_EXISTS,
-      loc,
-      ERROR_PARAMS( lQName->getStringValue() )
-    );
-  }
-
-  lCollations.resize(theChildren.size() - 1);
-  lSpec.theKeyTypes.resize(theChildren.size() - 1);
-
-  for (size_t i = 1; i < theChildren.size(); ++i)
-  {
-    consumeNext(lSpec.theKeyTypes[i-1], theChildren[i].getp(), aPlanState);
-  }
-
-  checkMapTypes(lSpec.theKeyTypes, lQName, loc);
-
-  lSpec.theNumKeyColumns = lSpec.theKeyTypes.size();
-  lSpec.theIsTemp = true;
-  lSpec.theCollations = lCollations;
-  lSpec.theTimezone = 0;
-
-  lIndex = GENV_STORE.createMap(lQName, lSpec);
-  
-  aPlanState.theLocalDynCtx->bindMap(lIndex->getName(), lIndex);
-
-  result = NULL;
-
-  STACK_END(state);
-}
-
-
-/*******************************************************************************
-********************************************************************************/
-bool
-MapDestroyIterator::nextImpl(
-    store::Item_t& result,
-    PlanState& aPlanState) const
-{
-  store::Item_t              lQName;
+  bool                       lPersistent = true;
+
+  PlanIteratorState* state;
+  DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
+
+  consumeNext(lName, theChildren[0].getp(), aPlanState);
+  createMapQName(lName, theSctx, loc);
+
+  if (GENV_STORE.getMap(lName)
+      || aPlanState.theLocalDynCtx->getMap(lName.getp()))
+  {
+    RAISE_ERROR(
+      zerr::ZSTR0001_INDEX_ALREADY_EXISTS,
+      loc,
+      ERROR_PARAMS( lName->getStringValue() )
+    );
+  }
+
+  consumeNext(lTypeParam, theChildren[1].getp(), aPlanState);
+
+  if (lTypeParam->isArray())
+  {
+    long lSize = to_xs_long(lTypeParam->getArraySize());
+    lTypes.resize(lSize);
+    for (long i = 1; i <= lSize; ++i)
+    {
+      lTypes[i-1] = lTypeParam->getArrayValue(xs_integer(i));
+    }
+  }
+  else
+  {
+    lTypes.push_back(lTypeParam);
+  }
+
+  if (theChildren.size() == 3)
+  {
+    store::Item_t lOptions;
+    consumeNext(lOptions, theChildren[2].getp(), aPlanState);
+    processOption(loc, lOptions, lPersistent);
+  }
+
+  processTypes(lName, loc, lTypes);
+  checkMapTypes(lTypes, lName, loc);
+
+  if (lPersistent)
+  {
+    std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());
+    std::vector<zstring>       lCollations(lTypes.size());
+    lPul->addCreateHashMap(&loc, lName, lTypes, lCollations, 0);
+
+    apply_updates(
+        aPlanState.theCompilerCB,
+        aPlanState.theGlobalDynCtx,
+        theSctx,
+        lPul.get(),
+        loc);
+  }
+  else
+  {
+    store::IndexSpecification lSpec;
+    lSpec.theKeyTypes.swap(lTypes);
+    lSpec.theNumKeyColumns = lSpec.theKeyTypes.size();
+    lSpec.theIsTemp = true;
+    lSpec.theCollations.resize(lSpec.theKeyTypes.size());
+    lSpec.theTimezone = 0;
+    store::Index_t lMap = GENV_STORE.createMap(lName, lSpec);
+
+    aPlanState.theLocalDynCtx->bindMap(lMap->getName(), lMap);
+  }
+
+  result = NULL;
+
+  STACK_END(state);
+}
+
+
+/*******************************************************************************
+********************************************************************************/
+bool
+MapDropIterator::nextImpl(
+    store::Item_t& result,
+    PlanState& aPlanState) const
+{
+  store::Item_t              lName;
   store::Index*              lIndex;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
 
-  consumeNext(lQName, theChildren[0].getp(), aPlanState);
+  consumeNext(lName, theChildren[0].getp(), aPlanState);
+  createMapQName(lName, theSctx, loc);
 
-  if (getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex))
+  if (getMap(lName, loc, aPlanState.theLocalDynCtx, lIndex))
   {
     std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());
-    lPul->addDestroyHashMap(&loc, lQName);
+    lPul->addDestroyHashMap(&loc, lName);
 
     apply_updates(
         aPlanState.theCompilerCB,
@@ -292,7 +503,7 @@
   }
   else
   {
-    aPlanState.theLocalDynCtx->unbindMap(lQName.getp());
+    aPlanState.theLocalDynCtx->unbindMap(lName.getp());
   }
 
   result = NULL;
@@ -300,6 +511,7 @@
   STACK_END(state);
 }
 
+
 /*******************************************************************************
 ********************************************************************************/
 bool
@@ -307,55 +519,35 @@
     store::Item_t& result,
     PlanState& aPlanState) const
 {
-  store::Item_t              lQName;
-  std::vector<store::Item_t> lKey;
-  store::Index*              lIndex;
-  ulong i;
-  store::Item_t              lKeyItem;
+  store::Item_t              lName;
+  store::Item_t              lKey;
+  std::vector<store::Item_t> lKeyAttrs;
+  store::Index*              lMap;
   store::IndexSpecification  lSpec;
+  bool                       lValidProbe;
 
   MapGetIteratorState* state;
   DEFAULT_STACK_INIT(MapGetIteratorState, state, aPlanState);
 
-  consumeNext(lQName, theChildren[0].getp(), aPlanState);
-
-  getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);
-
-  lSpec = lIndex->getSpecification();
-
-  if (lSpec.getNumColumns() != theChildren.size() - 1)
-  {
-    RAISE_ERROR(
-      zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS,
-      loc,
-      ERROR_PARAMS(
-        lQName->getStringValue(),
-        "map",
-        theChildren.size() - 1,
-        lSpec.getNumColumns() )
-    );
-  }
-
-  state->theCond = lIndex->createCondition(store::IndexCondition::POINT_VALUE);
-
-  for (i = 1; i < theChildren.size(); ++i)
-  {
-    if (!consumeNext(lKeyItem, theChildren[i], aPlanState)) 
+  consumeNext(lName, theChildren[0].getp(), aPlanState);
+  createMapQName(lName, theSctx, loc);
+
+  getMap(lName, loc, aPlanState.theLocalDynCtx, lMap);
+
+  consumeNext(lKey, theChildren[1].getp(), aPlanState);
+
+  state->theCond = lMap->createCondition(store::IndexCondition::POINT_VALUE);
+  lValidProbe = prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs);
+
+  if (lValidProbe)
+  {
+    for (size_t i = 0; i < lKeyAttrs.size(); ++i)
     {
-      // Return the empty seq if any of the search key items is the empty seq.
-      break;
+      state->theCond->pushItem(lKeyAttrs[i]);
     }
 
-    namespace_context tmp_ctx(theSctx);
-    castOrCheckIndexType(lKeyItem, lSpec.theKeyTypes[i-1], lQName, &tmp_ctx, loc);
-
-    state->theCond->pushItem(lKeyItem);
-  }
-
-  if (i == theChildren.size())
-  {
     state->theIter = GENV_STORE.getIteratorFactory()->
-      createIndexProbeIterator(lIndex);
+      createIndexProbeIterator(lMap);
 
     state->theIter->init(state->theCond);
     state->theIter->open();
@@ -377,53 +569,31 @@
     store::Item_t& result,
     PlanState& aPlanState) const
 {
-  store::Item_t              lQName;
-  std::vector<store::Item_t> lKey;
-  store::IndexSpecification  lSpec;
-  store::Index*              lIndex;
+  store::Item_t              lName;
+  store::Item_t              lKey;
+  std::vector<store::Item_t> lKeyAttrs;
+  store::Index*              lMap;
   bool                       lPersistent;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
 
-  consumeNext(lQName, theChildren[0].getp(), aPlanState);
-
-  lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);
-
-  lSpec = lIndex->getSpecification();
-
-  if (lSpec.getNumColumns() != theChildren.size() - 2)
-  {
-    RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
-    ERROR_PARAMS(lQName->getStringValue(),
-                 "map",
-                 theChildren.size() - 2,
-                 lSpec.getNumColumns()));
-  }
-
-  lKey.resize(theChildren.size() - 2);
-  for (size_t i = 2; i < theChildren.size(); ++i)
-  {
-    if (consumeNext(lKey[i-2], theChildren[i].getp(), aPlanState))
-    {
-      namespace_context tmp_ctx(theSctx);
-      castOrCheckIndexType(
-          lKey[i-2],
-          lSpec.theKeyTypes[i-2],
-          lQName,
-          &tmp_ctx,
-          loc);
-    }
-  }
+  consumeNext(lName, theChildren[0].getp(), aPlanState);
+  createMapQName(lName, theSctx, loc);
+
+  lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap);
+
+  consumeNext(lKey, theChildren[1].getp(), aPlanState);
+
+  prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs);
 
   if (lPersistent)
   {
-    std::auto_ptr<store::PUL>  lPul;
     store::Iterator_t lValue
-      = new PlanIteratorWrapper(theChildren[1], aPlanState);
+      = new PlanIteratorWrapper(theChildren[2], aPlanState);
 
-    lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList());
-    lPul->addInsertIntoHashMap(&loc, lQName, lKey, lValue);
+    std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());
+    lPul->addInsertIntoHashMap(&loc, lName, lKeyAttrs, lValue);
 
     apply_updates(
         aPlanState.theCompilerCB,
@@ -435,18 +605,27 @@
   else
   {
     store::Item_t lValue;
-    while (consumeNext(lValue, theChildren[1], aPlanState))
+    while (consumeNext(lValue, theChildren[2], aPlanState))
     {
+      if ((lValue->isNode() || lValue->isArray() || lValue->isObject())
+          && lValue->getCollection() == 0)
+      {
+        zstring lType = "node";
+        if (lValue->isArray()) lType = "array";
+        else if (lValue->isObject()) lType = "object";
+
+        RAISE_ERROR(zerr::ZDDY0042_ITEM_NOT_IN_COLLECTION, loc,
+        ERROR_PARAMS(lName->getLocalName(), lType));
+      }
+
       std::auto_ptr<store::IndexKey> k(new store::IndexKey());
-      for (std::vector<store::Item_t>::const_iterator lIter = lKey.begin();
-           lIter != lKey.end();
-           ++lIter)
+      for (size_t i = 0; i < lKeyAttrs.size(); ++i)
       {
-        k->push_back(*lIter);
+        k->push_back(lKeyAttrs[i]);
       }
 
       store::IndexKey* lKeyPtr = k.get();
-      if (!lIndex->insert(lKeyPtr, lValue))
+      if (!lMap->insert(lKeyPtr, lValue))
       {
         // the index took the ownership over the key if the index
         // did _not_ already contain an entry with the same key
@@ -464,51 +643,32 @@
 /*******************************************************************************
 ********************************************************************************/
 bool
-MapRemoveIterator::nextImpl(
+MapDeleteIterator::nextImpl(
     store::Item_t& result,
     PlanState& aPlanState) const
 {
-  store::Item_t              lQName;
-  std::vector<store::Item_t> lKey;
-  store::Index*              lIndex;
-  ulong i;
-  store::Item_t              lKeyItem;
-  std::auto_ptr<store::PUL>  lPul;
-  store::IndexSpecification  lSpec;
+  store::Item_t              lName;
+  store::Item_t              lKey;
+  std::vector<store::Item_t> lKeyAttrs;
+  store::Index*              lMap;
   bool                       lPersistent;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
 
-  consumeNext(lQName, theChildren[0].getp(), aPlanState);
-
-  lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);
-
-  lSpec = lIndex->getSpecification();
-
-  if (lSpec.getNumColumns() != theChildren.size() - 1)
-  {
-    RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
-    ERROR_PARAMS(lQName->getStringValue(),
-                 "map",
-                 theChildren.size() - 1,
-                 lSpec.getNumColumns()));
-  }
-
-  lKey.resize(theChildren.size()-1);
-  for (i = 1; i < theChildren.size(); ++i)
-  {
-    if (consumeNext(lKey[i-1], theChildren[i], aPlanState)) 
-    {
-      namespace_context tmp_ctx(theSctx);
-      castOrCheckIndexType(lKey[i-1], lSpec.theKeyTypes[i-1], lQName, &tmp_ctx, loc);
-    }
-  }
+  consumeNext(lName, theChildren[0].getp(), aPlanState);
+  createMapQName(lName, theSctx, loc);
+
+  lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap);
+
+  consumeNext(lKey, theChildren[1].getp(), aPlanState);
+
+  prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs);
 
   if (lPersistent)
   {
-    lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList());
-    lPul->addRemoveFromHashMap(&loc, lQName, lKey);
+    std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());
+    lPul->addRemoveFromHashMap(&loc, lName, lKeyAttrs);
 
     apply_updates(
         aPlanState.theCompilerCB,
@@ -520,14 +680,12 @@
   else
   {
     store::IndexKey k;
-    for (std::vector<store::Item_t>::const_iterator lIter = lKey.begin();
-         lIter != lKey.end();
-         ++lIter)
+    for (size_t i = 0; i < lKeyAttrs.size(); ++i)
     {
-      k.push_back(*lIter);
+      k.push_back(lKeyAttrs[i]);
     }
     store::Item_t lValue;
-    lIndex->remove(&k, lValue, true);
+    lMap->remove(&k, lValue, true);
   }
 
   result = NULL;
@@ -537,78 +695,33 @@
 
 
 /*******************************************************************************
-
 ********************************************************************************/
 bool
 MapKeysIterator::nextImpl(
     store::Item_t& result,
     PlanState& aPlanState) const
 {
-  store::Item_t    lQName;
+  store::Item_t    lName;
   store::Index*    lIndex;
   store::IndexKey  lKey;
   store::Item_t    lTypeName;
-  zstring          lBaseURI =
-    static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS;
-
-  store::Item_t lKeyNodeName;
-  GENV_ITEMFACTORY->createQName(lKeyNodeName,
-      static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS,
-      "", "key");
 
   MapKeysIteratorState* state;
   DEFAULT_STACK_INIT(MapKeysIteratorState, state, aPlanState);
 
-  consumeNext(lQName, theChildren[0].getp(), aPlanState);
+  consumeNext(lName, theChildren[0].getp(), aPlanState);
+  createMapQName(lName, theSctx, loc);
 
-  getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);
+  getMap(lName, loc, aPlanState.theLocalDynCtx, lIndex);
 
   state->theIter = lIndex->keys();
 
   state->theIter->open();
 
-  // generate result elements of the form
-  // <key>
-  //   <attribute value="key1_value"/>
-  //   <attribute value="key2_value"/>
-  //   <attribute value="key3_value"/>
-  // </key>
   while (state->theIter->next(lKey))
   {
-    lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
-
-    GENV_ITEMFACTORY->createElementNode(
-        result, NULL, lKeyNodeName, lTypeName,
-        true, false, theNSBindings, lBaseURI);
-
-    for (store::ItemVector::iterator lIter = lKey.begin();
-         lIter != lKey.end();
-         ++lIter)
-    {
-      store::Item_t lAttrElem, lAttrNodeName;
-      store::Item_t lNameAttr, lValueAttr, lValueAttrName;
-
-      GENV_ITEMFACTORY->createQName(lAttrNodeName,
-          static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS,
-          "", "attribute");
-
-      lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
-
-      GENV_ITEMFACTORY->createElementNode(
-          lAttrElem, result, lAttrNodeName, lTypeName,
-          true, false, theNSBindings, lBaseURI);
-
-      store::Item_t& lValue = (*lIter);
-      if (! lValue.isNull())
-      {
-        GENV_ITEMFACTORY->createQName(lValueAttrName, "", "", "value");
-
-        lTypeName = lValue->getType();
-
-        GENV_ITEMFACTORY->createAttributeNode(
-            lValueAttr, lAttrElem.getp(), lValueAttrName, lTypeName, lValue);
-      }
-    }
+    createKeysArray(lKey, result);
+
     STACK_PUSH(true, state);
   }
 
@@ -623,17 +736,18 @@
     store::Item_t& result,
     PlanState& aPlanState) const
 {
-  store::Item_t              lQName;
-  store::Index*              lIndex;
+  store::Item_t lName;
+  store::Index* lMap;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
 
-  consumeNext(lQName, theChildren[0].getp(), aPlanState);
-
-  getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);
-
-  GENV_ITEMFACTORY->createInteger(result, xs_integer(lIndex->size()));
+  consumeNext(lName, theChildren[0].getp(), aPlanState);
+  createMapQName(lName, theSctx, loc);
+
+  getMap(lName, loc, aPlanState.theLocalDynCtx, lMap);
+
+  GENV_ITEMFACTORY->createInteger(result, xs_integer(lMap->size()));
 
   STACK_PUSH(true, state);
 
@@ -642,7 +756,6 @@
 
 
 /*******************************************************************************
-
 ********************************************************************************/
 AvailableMapsIteratorState::~AvailableMapsIteratorState()
 {
@@ -676,16 +789,22 @@
 bool
 AvailableMapsIterator::nextImpl(store::Item_t& result, PlanState& planState) const
 {
+  store::Item_t lNameItem;;
+  zstring       lLocalName;
+
   AvailableMapsIteratorState * state;
-  store::Item_t              nameItem;
-
   DEFAULT_STACK_INIT(AvailableMapsIteratorState, state, planState);
 
   for ((state->persistentMapNamesIter = GENV_STORE.listMapNames())->open ();
-       state->persistentMapNamesIter->next(nameItem); ) 
+       state->persistentMapNamesIter->next(lNameItem); ) 
   {
-    result = nameItem;
-    STACK_PUSH( true, state);
+    if (lNameItem->getNamespace() != getMapURI(theSctx, loc))
+    {
+      continue;
+    }
+    lLocalName = lNameItem->getLocalName();
+    GENV_ITEMFACTORY->createString(result, lLocalName);
+    STACK_PUSH(true, state);
   }
 
   state->persistentMapNamesIter->close();
@@ -696,7 +815,13 @@
        state->transientMapNamesIter != state->transientMapNames.end();
        ++state->transientMapNamesIter)
   {
-    result = *state->transientMapNamesIter;
+    lNameItem = *state->transientMapNamesIter;
+    if (lNameItem->getNamespace() != getMapURI(theSctx, loc))
+    {
+      continue;
+    }
+    lLocalName = lNameItem->getLocalName();
+    GENV_ITEMFACTORY->createString(result, lLocalName);
     STACK_PUSH( true, state);
   }
 
@@ -707,22 +832,29 @@
 /*******************************************************************************
 ********************************************************************************/
 bool
-MapIsTransientIterator::nextImpl(
+MapOptionsIterator::nextImpl(
     store::Item_t& result,
     PlanState& aPlanState) const
 {
-  store::Item_t lQName;
-  store::Index* lIndex;
-  bool          lPersistent;
+  store::Item_t              lName;
+  store::Index*              lMap;
+  bool                       lPersistent;
+  std::vector<store::Item_t> lNames(1);
+  std::vector<store::Item_t> lValues(1);
+  zstring lTmp("persistent");
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
 
-  consumeNext(lQName, theChildren[0].getp(), aPlanState);
-
-  lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);
-
-  GENV_ITEMFACTORY->createBoolean(result, !lPersistent);
+  consumeNext(lName, theChildren[0].getp(), aPlanState);
+  createMapQName(lName, theSctx, loc);
+
+  lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap);
+
+  GENV_ITEMFACTORY->createString(lNames[0], lTmp);
+  GENV_ITEMFACTORY->createBoolean(lValues[0], lPersistent);
+
+  GENV_ITEMFACTORY->createJSONObject(result, lNames, lValues);
 
   STACK_PUSH(true, state);
 

=== modified file 'src/runtime/store/pregenerated/maps.cpp'
--- src/runtime/store/pregenerated/maps.cpp	2013-03-05 23:11:50 +0000
+++ src/runtime/store/pregenerated/maps.cpp	2013-08-25 03:24:25 +0000
@@ -62,60 +62,32 @@
 // </MapCreateIterator>
 
 
-// <MapCreateTransientIterator>
-SERIALIZABLE_CLASS_VERSIONS(MapCreateTransientIterator)
-
-void MapCreateTransientIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>*)this);
-}
-
-
-void MapCreateTransientIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-MapCreateTransientIterator::~MapCreateTransientIterator() {}
-
-// </MapCreateTransientIterator>
-
-
-// <MapDestroyIterator>
-SERIALIZABLE_CLASS_VERSIONS(MapDestroyIterator)
-
-void MapDestroyIterator::serialize(::zorba::serialization::Archiver& ar)
-{
-  serialize_baseclass(ar,
-  (NaryBaseIterator<MapDestroyIterator, PlanIteratorState>*)this);
-}
-
-
-void MapDestroyIterator::accept(PlanIterVisitor& v) const
-{
-  v.beginVisit(*this);
-
-  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
-  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
-  for ( ; lIter != lEnd; ++lIter ){
-    (*lIter)->accept(v);
-  }
-
-  v.endVisit(*this);
-}
-
-MapDestroyIterator::~MapDestroyIterator() {}
-
-// </MapDestroyIterator>
+// <MapDropIterator>
+SERIALIZABLE_CLASS_VERSIONS(MapDropIterator)
+
+void MapDropIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar,
+  (NaryBaseIterator<MapDropIterator, PlanIteratorState>*)this);
+}
+
+
+void MapDropIterator::accept(PlanIterVisitor& v) const
+{
+  v.beginVisit(*this);
+
+  std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+  std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+  for ( ; lIter != lEnd; ++lIter ){
+    (*lIter)->accept(v);
+  }
+
+  v.endVisit(*this);
+}
+
+MapDropIterator::~MapDropIterator() {}
+
+// </MapDropIterator>
 
 
 // <MapGetIterator>
@@ -186,17 +158,17 @@
 // </MapInsertIterator>
 
 
-// <MapRemoveIterator>
-SERIALIZABLE_CLASS_VERSIONS(MapRemoveIterator)
+// <MapDeleteIterator>
+SERIALIZABLE_CLASS_VERSIONS(MapDeleteIterator)
 
-void MapRemoveIterator::serialize(::zorba::serialization::Archiver& ar)
+void MapDeleteIterator::serialize(::zorba::serialization::Archiver& ar)
 {
   serialize_baseclass(ar,
-  (NaryBaseIterator<MapRemoveIterator, PlanIteratorState>*)this);
+  (NaryBaseIterator<MapDeleteIterator, PlanIteratorState>*)this);
 }
 
 
-void MapRemoveIterator::accept(PlanIterVisitor& v) const
+void MapDeleteIterator::accept(PlanIterVisitor& v) const
 {
   v.beginVisit(*this);
 
@@ -209,9 +181,9 @@
   v.endVisit(*this);
 }
 
-MapRemoveIterator::~MapRemoveIterator() {}
+MapDeleteIterator::~MapDeleteIterator() {}
 
-// </MapRemoveIterator>
+// </MapDeleteIterator>
 
 
 // <MapKeysIterator>
@@ -221,8 +193,6 @@
 {
   serialize_baseclass(ar,
   (NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>*)this);
-
-    ar & theNSBindings;
 }
 
 
@@ -314,17 +284,17 @@
 // </AvailableMapsIterator>
 
 
-// <MapIsTransientIterator>
-SERIALIZABLE_CLASS_VERSIONS(MapIsTransientIterator)
+// <MapOptionsIterator>
+SERIALIZABLE_CLASS_VERSIONS(MapOptionsIterator)
 
-void MapIsTransientIterator::serialize(::zorba::serialization::Archiver& ar)
+void MapOptionsIterator::serialize(::zorba::serialization::Archiver& ar)
 {
   serialize_baseclass(ar,
-  (NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>*)this);
+  (NaryBaseIterator<MapOptionsIterator, PlanIteratorState>*)this);
 }
 
 
-void MapIsTransientIterator::accept(PlanIterVisitor& v) const
+void MapOptionsIterator::accept(PlanIterVisitor& v) const
 {
   v.beginVisit(*this);
 
@@ -337,9 +307,9 @@
   v.endVisit(*this);
 }
 
-MapIsTransientIterator::~MapIsTransientIterator() {}
+MapOptionsIterator::~MapOptionsIterator() {}
 
-// </MapIsTransientIterator>
+// </MapOptionsIterator>
 
 
 

=== modified file 'src/runtime/store/pregenerated/maps.h'
--- src/runtime/store/pregenerated/maps.h	2013-03-05 23:11:50 +0000
+++ src/runtime/store/pregenerated/maps.h	2013-08-25 03:24:25 +0000
@@ -71,56 +71,25 @@
  *    
  * Author: Matthias Brantner
  */
-class MapCreateTransientIterator : public NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(MapCreateTransientIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapCreateTransientIterator,
-    NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  MapCreateTransientIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~MapCreateTransientIterator();
-
-  void accept(PlanIterVisitor& v) const;
-
-  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
-};
-
-
-/**
- * 
- *    
- * Author: Matthias Brantner
- */
-class MapDestroyIterator : public NaryBaseIterator<MapDestroyIterator, PlanIteratorState>
-{ 
-public:
-  SERIALIZABLE_CLASS(MapDestroyIterator);
-
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDestroyIterator,
-    NaryBaseIterator<MapDestroyIterator, PlanIteratorState>);
-
-  void serialize( ::zorba::serialization::Archiver& ar);
-
-  MapDestroyIterator(
-    static_context* sctx,
-    const QueryLoc& loc,
-    std::vector<PlanIter_t>& children)
-    : 
-    NaryBaseIterator<MapDestroyIterator, PlanIteratorState>(sctx, loc, children)
-  {}
-
-  virtual ~MapDestroyIterator();
+class MapDropIterator : public NaryBaseIterator<MapDropIterator, PlanIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(MapDropIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDropIterator,
+    NaryBaseIterator<MapDropIterator, PlanIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  MapDropIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<MapDropIterator, PlanIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~MapDropIterator();
 
   void accept(PlanIterVisitor& v) const;
 
@@ -209,25 +178,25 @@
  *    
  * Author: Matthias Brantner
  */
-class MapRemoveIterator : public NaryBaseIterator<MapRemoveIterator, PlanIteratorState>
+class MapDeleteIterator : public NaryBaseIterator<MapDeleteIterator, PlanIteratorState>
 { 
 public:
-  SERIALIZABLE_CLASS(MapRemoveIterator);
+  SERIALIZABLE_CLASS(MapDeleteIterator);
 
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapRemoveIterator,
-    NaryBaseIterator<MapRemoveIterator, PlanIteratorState>);
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDeleteIterator,
+    NaryBaseIterator<MapDeleteIterator, PlanIteratorState>);
 
   void serialize( ::zorba::serialization::Archiver& ar);
 
-  MapRemoveIterator(
+  MapDeleteIterator(
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children)
     : 
-    NaryBaseIterator<MapRemoveIterator, PlanIteratorState>(sctx, loc, children)
+    NaryBaseIterator<MapDeleteIterator, PlanIteratorState>(sctx, loc, children)
   {}
 
-  virtual ~MapRemoveIterator();
+  virtual ~MapDeleteIterator();
 
   void accept(PlanIterVisitor& v) const;
 
@@ -255,8 +224,6 @@
 
 class MapKeysIterator : public NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>
 { 
-protected:
-  store::NsBindings theNSBindings; //
 public:
   SERIALIZABLE_CLASS(MapKeysIterator);
 
@@ -270,8 +237,7 @@
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children)
     : 
-    NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>(sctx, loc, children),
-    theNSBindings()
+    NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>(sctx, loc, children)
   {}
 
   virtual ~MapKeysIterator();
@@ -364,25 +330,25 @@
  *    
  * Author: Matthias Brantner
  */
-class MapIsTransientIterator : public NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>
+class MapOptionsIterator : public NaryBaseIterator<MapOptionsIterator, PlanIteratorState>
 { 
 public:
-  SERIALIZABLE_CLASS(MapIsTransientIterator);
+  SERIALIZABLE_CLASS(MapOptionsIterator);
 
-  SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapIsTransientIterator,
-    NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>);
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapOptionsIterator,
+    NaryBaseIterator<MapOptionsIterator, PlanIteratorState>);
 
   void serialize( ::zorba::serialization::Archiver& ar);
 
-  MapIsTransientIterator(
+  MapOptionsIterator(
     static_context* sctx,
     const QueryLoc& loc,
     std::vector<PlanIter_t>& children)
     : 
-    NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>(sctx, loc, children)
+    NaryBaseIterator<MapOptionsIterator, PlanIteratorState>(sctx, loc, children)
   {}
 
-  virtual ~MapIsTransientIterator();
+  virtual ~MapOptionsIterator();
 
   void accept(PlanIterVisitor& v) const;
 

=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
--- src/runtime/visitors/pregenerated/planiter_visitor.h	2013-08-16 13:00:06 +0000
+++ src/runtime/visitors/pregenerated/planiter_visitor.h	2013-08-25 03:24:25 +0000
@@ -663,15 +663,13 @@
 
     class MapCreateIterator;
 
-    class MapCreateTransientIterator;
-
-    class MapDestroyIterator;
+    class MapDropIterator;
 
     class MapGetIterator;
 
     class MapInsertIterator;
 
-    class MapRemoveIterator;
+    class MapDeleteIterator;
 
     class MapKeysIterator;
 
@@ -679,7 +677,7 @@
 
     class AvailableMapsIterator;
 
-    class MapIsTransientIterator;
+    class MapOptionsIterator;
 
     class CodepointsToStringIterator;
 
@@ -1700,11 +1698,8 @@
     virtual void beginVisit ( const MapCreateIterator& ) = 0;
     virtual void endVisit   ( const MapCreateIterator& ) = 0;
 
-    virtual void beginVisit ( const MapCreateTransientIterator& ) = 0;
-    virtual void endVisit   ( const MapCreateTransientIterator& ) = 0;
-
-    virtual void beginVisit ( const MapDestroyIterator& ) = 0;
-    virtual void endVisit   ( const MapDestroyIterator& ) = 0;
+    virtual void beginVisit ( const MapDropIterator& ) = 0;
+    virtual void endVisit   ( const MapDropIterator& ) = 0;
 
     virtual void beginVisit ( const MapGetIterator& ) = 0;
     virtual void endVisit   ( const MapGetIterator& ) = 0;
@@ -1712,8 +1707,8 @@
     virtual void beginVisit ( const MapInsertIterator& ) = 0;
     virtual void endVisit   ( const MapInsertIterator& ) = 0;
 
-    virtual void beginVisit ( const MapRemoveIterator& ) = 0;
-    virtual void endVisit   ( const MapRemoveIterator& ) = 0;
+    virtual void beginVisit ( const MapDeleteIterator& ) = 0;
+    virtual void endVisit   ( const MapDeleteIterator& ) = 0;
 
     virtual void beginVisit ( const MapKeysIterator& ) = 0;
     virtual void endVisit   ( const MapKeysIterator& ) = 0;
@@ -1724,8 +1719,8 @@
     virtual void beginVisit ( const AvailableMapsIterator& ) = 0;
     virtual void endVisit   ( const AvailableMapsIterator& ) = 0;
 
-    virtual void beginVisit ( const MapIsTransientIterator& ) = 0;
-    virtual void endVisit   ( const MapIsTransientIterator& ) = 0;
+    virtual void beginVisit ( const MapOptionsIterator& ) = 0;
+    virtual void endVisit   ( const MapOptionsIterator& ) = 0;
 
     virtual void beginVisit ( const CodepointsToStringIterator& ) = 0;
     virtual void endVisit   ( const CodepointsToStringIterator& ) = 0;

=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
--- src/runtime/visitors/pregenerated/printer_visitor.cpp	2013-08-16 13:00:06 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.cpp	2013-08-25 03:24:25 +0000
@@ -4307,32 +4307,18 @@
 // </MapCreateIterator>
 
 
-// <MapCreateTransientIterator>
-void PrinterVisitor::beginVisit ( const MapCreateTransientIterator& a) {
-  thePrinter.startBeginVisit("MapCreateTransientIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const MapCreateTransientIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </MapCreateTransientIterator>
-
-
-// <MapDestroyIterator>
-void PrinterVisitor::beginVisit ( const MapDestroyIterator& a) {
-  thePrinter.startBeginVisit("MapDestroyIterator", ++theId);
-  printCommons( &a, theId );
-  thePrinter.endBeginVisit( theId );
-}
-
-void PrinterVisitor::endVisit ( const MapDestroyIterator& ) {
-  thePrinter.startEndVisit();
-  thePrinter.endEndVisit();
-}
-// </MapDestroyIterator>
+// <MapDropIterator>
+void PrinterVisitor::beginVisit ( const MapDropIterator& a) {
+  thePrinter.startBeginVisit("MapDropIterator", ++theId);
+  printCommons( &a, theId );
+  thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const MapDropIterator& ) {
+  thePrinter.startEndVisit();
+  thePrinter.endEndVisit();
+}
+// </MapDropIterator>
 
 
 // <MapGetIterator>
@@ -4363,18 +4349,18 @@
 // </MapInsertIterator>
 
 
-// <MapRemoveIterator>
-void PrinterVisitor::beginVisit ( const MapRemoveIterator& a) {
-  thePrinter.startBeginVisit("MapRemoveIterator", ++theId);
+// <MapDeleteIterator>
+void PrinterVisitor::beginVisit ( const MapDeleteIterator& a) {
+  thePrinter.startBeginVisit("MapDeleteIterator", ++theId);
   printCommons( &a, theId );
   thePrinter.endBeginVisit( theId );
 }
 
-void PrinterVisitor::endVisit ( const MapRemoveIterator& ) {
+void PrinterVisitor::endVisit ( const MapDeleteIterator& ) {
   thePrinter.startEndVisit();
   thePrinter.endEndVisit();
 }
-// </MapRemoveIterator>
+// </MapDeleteIterator>
 
 
 // <MapKeysIterator>
@@ -4419,18 +4405,18 @@
 // </AvailableMapsIterator>
 
 
-// <MapIsTransientIterator>
-void PrinterVisitor::beginVisit ( const MapIsTransientIterator& a) {
-  thePrinter.startBeginVisit("MapIsTransientIterator", ++theId);
+// <MapOptionsIterator>
+void PrinterVisitor::beginVisit ( const MapOptionsIterator& a) {
+  thePrinter.startBeginVisit("MapOptionsIterator", ++theId);
   printCommons( &a, theId );
   thePrinter.endBeginVisit( theId );
 }
 
-void PrinterVisitor::endVisit ( const MapIsTransientIterator& ) {
+void PrinterVisitor::endVisit ( const MapOptionsIterator& ) {
   thePrinter.startEndVisit();
   thePrinter.endEndVisit();
 }
-// </MapIsTransientIterator>
+// </MapOptionsIterator>
 
 
 // <CodepointsToStringIterator>

=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
--- src/runtime/visitors/pregenerated/printer_visitor.h	2013-08-16 13:00:06 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.h	2013-08-25 03:24:25 +0000
@@ -1005,11 +1005,8 @@
     void beginVisit( const MapCreateIterator& );
     void endVisit  ( const MapCreateIterator& );
 
-    void beginVisit( const MapCreateTransientIterator& );
-    void endVisit  ( const MapCreateTransientIterator& );
-
-    void beginVisit( const MapDestroyIterator& );
-    void endVisit  ( const MapDestroyIterator& );
+    void beginVisit( const MapDropIterator& );
+    void endVisit  ( const MapDropIterator& );
 
     void beginVisit( const MapGetIterator& );
     void endVisit  ( const MapGetIterator& );
@@ -1017,8 +1014,8 @@
     void beginVisit( const MapInsertIterator& );
     void endVisit  ( const MapInsertIterator& );
 
-    void beginVisit( const MapRemoveIterator& );
-    void endVisit  ( const MapRemoveIterator& );
+    void beginVisit( const MapDeleteIterator& );
+    void endVisit  ( const MapDeleteIterator& );
 
     void beginVisit( const MapKeysIterator& );
     void endVisit  ( const MapKeysIterator& );
@@ -1029,8 +1026,8 @@
     void beginVisit( const AvailableMapsIterator& );
     void endVisit  ( const AvailableMapsIterator& );
 
-    void beginVisit( const MapIsTransientIterator& );
-    void endVisit  ( const MapIsTransientIterator& );
+    void beginVisit( const MapOptionsIterator& );
+    void endVisit  ( const MapOptionsIterator& );
 
     void beginVisit( const CodepointsToStringIterator& );
     void endVisit  ( const CodepointsToStringIterator& );

=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter	2013-03-04 21:00:58 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter	2013-08-25 03:24:25 +0000
@@ -25,16 +25,19 @@
 
 Iterator tree for main query:
 <SequentialIterator>
-  <CtxVarDeclareIterator varid="4" varname="co">
+  <CtxVarDeclareIterator varid="4" varname="map:PERSISTENT">
+    <SingletonIterator value="xs:string(persistent)"/>
+  </CtxVarDeclareIterator>
+  <CtxVarDeclareIterator varid="5" varname="co">
     <SingletonIterator value="xs:integer(0)"/>
   </CtxVarDeclareIterator>
-  <CtxVarDeclareIterator varid="5" varname="map1">
-    <SingletonIterator value="xs:QName(,,map-co)"/>
+  <CtxVarDeclareIterator varid="6" varname="map1">
+    <SingletonIterator value="xs:string(map-co)"/>
   </CtxVarDeclareIterator>
-  <CtxVarDeclareIterator varid="6" varname="str">
+  <CtxVarDeclareIterator varid="7" varname="str">
     <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/>
   </CtxVarDeclareIterator>
-  <CtxVarDeclareIterator varid="7" varname="input">
+  <CtxVarDeclareIterator varid="8" varname="input">
     <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">
       <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">
         <FnDocIterator>
@@ -46,25 +49,25 @@
   <SequentialIterator>
     <ApplyIterator>
       <MapCreateIterator>
-        <CtxVarIterator varid="5" varname="map1" varkind="global"/>
-        <CtxVarIterator varid="6" varname="str" varkind="global"/>
+        <CtxVarIterator varid="6" varname="map1" varkind="global"/>
+        <CtxVarIterator varid="7" varname="str" varkind="global"/>
       </MapCreateIterator>
     </ApplyIterator>
-    <CtxVarDeclareIterator varid="8" varname="DG">
+    <CtxVarDeclareIterator varid="9" varname="DG">
       <UDFunctionCallIterator function="local:collapseNodesSameName">
         <TreatIterator quant="+">
-          <CtxVarIterator varid="7" varname="input" varkind="global"/>
+          <CtxVarIterator varid="8" varname="input" varkind="global"/>
         </TreatIterator>
         <SingletonIterator value="xs:boolean(true)"/>
         <SingletonIterator value="xs:string()"/>
       </UDFunctionCallIterator>
     </CtxVarDeclareIterator>
     <ApplyIterator>
-      <MapDestroyIterator>
-        <CtxVarIterator varid="5" varname="map1" varkind="global"/>
-      </MapDestroyIterator>
+      <MapDropIterator>
+        <CtxVarIterator varid="6" varname="map1" varkind="global"/>
+      </MapDropIterator>
     </ApplyIterator>
-    <CtxVarIterator varid="8" varname="DG" varkind="local"/>
+    <CtxVarIterator varid="9" varname="DG" varkind="local"/>
   </SequentialIterator>
 </SequentialIterator>
 
@@ -183,12 +186,10 @@
       <CtxVarAssignIterator varid="1" varname="label" varkind="local">
         <TreatIterator type="xs:integer" quant="?">
           <MapGetIterator>
-            <CtxVarIterator varid="5" varname="map1" varkind="global"/>
-            <PromoteIterator type="xs:anyAtomicType">
-              <FnDataIterator>
-                <CtxVarIterator varid="4" varname="s2" varkind="local"/>
-              </FnDataIterator>
-            </PromoteIterator>
+            <CtxVarIterator varid="6" varname="map1" varkind="global"/>
+            <TreatIterator quant="">
+              <CtxVarIterator varid="4" varname="s2" varkind="local"/>
+            </TreatIterator>
           </MapGetIterator>
         </TreatIterator>
       </CtxVarAssignIterator>
@@ -197,24 +198,22 @@
           <CtxVarIterator varid="1" varname="label" varkind="local"/>
         </FnEmptyIterator>
         <SequentialIterator>
-          <CtxVarAssignIterator varid="4" varname="co" varkind="global">
+          <CtxVarAssignIterator varid="5" varname="co" varkind="global">
             <SpecificNumArithIterator_AddOperation_INTEGER>
-              <CtxVarIterator varid="4" varname="co" varkind="global"/>
+              <CtxVarIterator varid="5" varname="co" varkind="global"/>
               <SingletonIterator value="xs:integer(1)"/>
             </SpecificNumArithIterator_AddOperation_INTEGER>
           </CtxVarAssignIterator>
           <CtxVarAssignIterator varid="1" varname="label" varkind="local">
-            <CtxVarIterator varid="4" varname="co" varkind="global"/>
+            <CtxVarIterator varid="5" varname="co" varkind="global"/>
           </CtxVarAssignIterator>
           <ApplyIterator>
             <MapInsertIterator>
-              <CtxVarIterator varid="5" varname="map1" varkind="global"/>
-              <CtxVarIterator varid="4" varname="co" varkind="global"/>
-              <PromoteIterator type="xs:anyAtomicType">
-                <FnDataIterator>
-                  <CtxVarIterator varid="4" varname="s2" varkind="local"/>
-                </FnDataIterator>
-              </PromoteIterator>
+              <CtxVarIterator varid="6" varname="map1" varkind="global"/>
+              <TreatIterator quant="">
+                <CtxVarIterator varid="4" varname="s2" varkind="local"/>
+              </TreatIterator>
+              <CtxVarIterator varid="5" varname="co" varkind="global"/>
             </MapInsertIterator>
           </ApplyIterator>
         </SequentialIterator>

=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter	2013-03-04 21:00:58 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter	2013-08-25 03:24:25 +0000
@@ -25,16 +25,19 @@
 
 Iterator tree for main query:
 <SequentialIterator>
-  <CtxVarDeclareIterator varid="4" varname="co">
+  <CtxVarDeclareIterator varid="4" varname="map:PERSISTENT">
+    <SingletonIterator value="xs:string(persistent)"/>
+  </CtxVarDeclareIterator>
+  <CtxVarDeclareIterator varid="5" varname="co">
     <SingletonIterator value="xs:integer(0)"/>
   </CtxVarDeclareIterator>
-  <CtxVarDeclareIterator varid="5" varname="map1">
-    <SingletonIterator value="xs:QName(,,map-co)"/>
+  <CtxVarDeclareIterator varid="6" varname="map1">
+    <SingletonIterator value="xs:string(map-co)"/>
   </CtxVarDeclareIterator>
-  <CtxVarDeclareIterator varid="6" varname="str">
+  <CtxVarDeclareIterator varid="7" varname="str">
     <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/>
   </CtxVarDeclareIterator>
-  <CtxVarDeclareIterator varid="7" varname="input">
+  <CtxVarDeclareIterator varid="8" varname="input">
     <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">
       <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">
         <FnDocIterator>
@@ -46,25 +49,25 @@
   <SequentialIterator>
     <ApplyIterator>
       <MapCreateIterator>
-        <CtxVarIterator varid="5" varname="map1" varkind="global"/>
-        <CtxVarIterator varid="6" varname="str" varkind="global"/>
+        <CtxVarIterator varid="6" varname="map1" varkind="global"/>
+        <CtxVarIterator varid="7" varname="str" varkind="global"/>
       </MapCreateIterator>
     </ApplyIterator>
-    <CtxVarDeclareIterator varid="8" varname="DG">
+    <CtxVarDeclareIterator varid="9" varname="DG">
       <UDFunctionCallIterator function="local:collapseNodesSameName">
         <TreatIterator quant="+">
-          <CtxVarIterator varid="7" varname="input" varkind="global"/>
+          <CtxVarIterator varid="8" varname="input" varkind="global"/>
         </TreatIterator>
         <SingletonIterator value="xs:boolean(true)"/>
         <SingletonIterator value="xs:string()"/>
       </UDFunctionCallIterator>
     </CtxVarDeclareIterator>
     <ApplyIterator>
-      <MapDestroyIterator>
-        <CtxVarIterator varid="5" varname="map1" varkind="global"/>
-      </MapDestroyIterator>
+      <MapDropIterator>
+        <CtxVarIterator varid="6" varname="map1" varkind="global"/>
+      </MapDropIterator>
     </ApplyIterator>
-    <CtxVarIterator varid="8" varname="DG" varkind="local"/>
+    <CtxVarIterator varid="9" varname="DG" varkind="local"/>
   </SequentialIterator>
 </SequentialIterator>
 
@@ -183,12 +186,10 @@
       <CtxVarAssignIterator varid="1" varname="label" varkind="local">
         <TreatIterator type="xs:integer" quant="?">
           <MapGetIterator>
-            <CtxVarIterator varid="5" varname="map1" varkind="global"/>
-            <PromoteIterator type="xs:anyAtomicType">
-              <FnDataIterator>
-                <CtxVarIterator varid="4" varname="s2" varkind="local"/>
-              </FnDataIterator>
-            </PromoteIterator>
+            <CtxVarIterator varid="6" varname="map1" varkind="global"/>
+            <TreatIterator quant="">
+              <CtxVarIterator varid="4" varname="s2" varkind="local"/>
+            </TreatIterator>
           </MapGetIterator>
         </TreatIterator>
       </CtxVarAssignIterator>
@@ -197,24 +198,22 @@
           <CtxVarIterator varid="1" varname="label" varkind="local"/>
         </FnEmptyIterator>
         <SequentialIterator>
-          <CtxVarAssignIterator varid="4" varname="co" varkind="global">
+          <CtxVarAssignIterator varid="5" varname="co" varkind="global">
             <SpecificNumArithIterator_AddOperation_INTEGER>
-              <CtxVarIterator varid="4" varname="co" varkind="global"/>
+              <CtxVarIterator varid="5" varname="co" varkind="global"/>
               <SingletonIterator value="xs:integer(1)"/>
             </SpecificNumArithIterator_AddOperation_INTEGER>
           </CtxVarAssignIterator>
           <CtxVarAssignIterator varid="1" varname="label" varkind="local">
-            <CtxVarIterator varid="4" varname="co" varkind="global"/>
+            <CtxVarIterator varid="5" varname="co" varkind="global"/>
           </CtxVarAssignIterator>
           <ApplyIterator>
             <MapInsertIterator>
-              <CtxVarIterator varid="5" varname="map1" varkind="global"/>
-              <CtxVarIterator varid="4" varname="co" varkind="global"/>
-              <PromoteIterator type="xs:anyAtomicType">
-                <FnDataIterator>
-                  <CtxVarIterator varid="4" varname="s2" varkind="local"/>
-                </FnDataIterator>
-              </PromoteIterator>
+              <CtxVarIterator varid="6" varname="map1" varkind="global"/>
+              <TreatIterator quant="">
+                <CtxVarIterator varid="4" varname="s2" varkind="local"/>
+              </TreatIterator>
+              <CtxVarIterator varid="5" varname="co" varkind="global"/>
             </MapInsertIterator>
           </ApplyIterator>
         </SequentialIterator>

=== modified file 'test/rbkt/ExpQueryResults/zorba/store/unordered-map/map3.xml.res'
--- test/rbkt/ExpQueryResults/zorba/store/unordered-map/map3.xml.res	2013-02-07 17:24:36 +0000
+++ test/rbkt/ExpQueryResults/zorba/store/unordered-map/map3.xml.res	2013-08-25 03:24:25 +0000
@@ -1,1 +1,1 @@
-<key xmlns="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";><attribute value="key0"/><attribute value="1"/></key>
+[ "key0", 1 ]

=== modified file 'test/rbkt/ExpQueryResults/zorba/store/unordered-map/map7.xml.res'
--- test/rbkt/ExpQueryResults/zorba/store/unordered-map/map7.xml.res	2012-06-22 23:36:41 +0000
+++ test/rbkt/ExpQueryResults/zorba/store/unordered-map/map7.xml.res	2013-08-25 03:24:25 +0000
@@ -1,1 +1,1 @@
-true true 1 key1 value1 true false 3 true true 5 key5 value5 false true key2 false true key4 false false
+true true 1 key1 value1 true true 2 key2 value2 true true 3 key3 value3 true true 4 key4 value4 true true 5 key5 value5 true true 6 key6 value6

=== modified file 'test/rbkt/Queries/zorba/no-copy/dataguide-c.xq'
--- test/rbkt/Queries/zorba/no-copy/dataguide-c.xq	2013-08-09 08:27:30 +0000
+++ test/rbkt/Queries/zorba/no-copy/dataguide-c.xq	2013-08-25 03:24:25 +0000
@@ -1,11 +1,10 @@
-import module namespace map = 
-  "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
 
 declare namespace ann = "http://zorba.io/annotations";;
 
 declare %ann:assignable variable $co as xs:integer :=0;
 
-declare variable $map1 :=xs:QName("map-co");
+declare variable $map1 := "map-co";
 
 declare variable $str := QName ("http://www.w3.org/2001/XMLSchema";, "string");
 
@@ -58,7 +57,7 @@
   {
     $co := $co +1;
     $label := $co;
-    map:insert($map1, $co, $s2); 
+    map:insert($map1, $s2, $co); 
   }
   else 
   {
@@ -80,6 +79,6 @@
 
 variable $DG := local:collapseNodesSameName($input, true(), "");
 
-map:delete($map1);
+map:drop($map1);
 
 $DG

=== modified file 'test/rbkt/Queries/zorba/no-copy/dataguide-nc.xq'
--- test/rbkt/Queries/zorba/no-copy/dataguide-nc.xq	2013-08-09 08:27:30 +0000
+++ test/rbkt/Queries/zorba/no-copy/dataguide-nc.xq	2013-08-25 03:24:25 +0000
@@ -1,5 +1,4 @@
-import module namespace map = 
-  "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
 
 declare namespace ann = "http://zorba.io/annotations";;
 
@@ -9,7 +8,7 @@
 
 declare %ann:assignable variable $co as xs:integer :=0;
 
-declare variable $map1 :=xs:QName("map-co");
+declare variable $map1 := "map-co";
 
 declare variable $str := QName ("http://www.w3.org/2001/XMLSchema";, "string");
 
@@ -62,7 +61,7 @@
   {
     $co := $co +1;
     $label := $co;
-    map:insert($map1, $co, $s2); 
+    map:insert($map1, $s2, $co); 
   }
   else 
   {
@@ -82,10 +81,10 @@
 };
 
 
-map:create($map1,$str) ;
+map:create($map1, $str);
 
 variable $DG := local:collapseNodesSameName($input, true(), "");
 
-map:delete($map1);
+map:drop($map1);
 
 $DG

=== modified file 'test/rbkt/Queries/zorba/reference/reference_3.xq'
--- test/rbkt/Queries/zorba/reference/reference_3.xq	2013-07-24 08:12:12 +0000
+++ test/rbkt/Queries/zorba/reference/reference_3.xq	2013-08-25 03:24:25 +0000
@@ -1,14 +1,14 @@
 import module namespace idd = "http://zorba.io/reference"; at "reference.xqlib";
 import module namespace id = "http://zorba.io/modules/reference";;
 import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents";;
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
 
 variable $node:=<root>global</root>;
 variable $x := <a>1</a>;
 fn:put(<root>doc</root>,"doc");
 
-map:create(xs:QName("local:bar"), xs:QName("xs:integer"));
-map:insert(xs:QName("local:bar"), id:reference($x), 1);
+map:create("bar", xs:QName("xs:integer"));
+map:insert("bar", 1, id:reference($x));
 
 
 
@@ -28,6 +28,6 @@
 }</temporary-variable-in-scope>
 <temporary-variable-in-scope>{variable $temp:=<root>temp</root>; id:dereference(id:reference($temp))}</temporary-variable-in-scope>
 <in-map>
-{id:dereference(map:get(xs:QName("local:bar"), 1))}
+{id:dereference(map:get("bar", 1))}
 </in-map>
-</result>
\ No newline at end of file
+</result>

=== modified file 'test/rbkt/Queries/zorba/scripting/flwor15.xq'
--- test/rbkt/Queries/zorba/scripting/flwor15.xq	2013-08-09 08:27:30 +0000
+++ test/rbkt/Queries/zorba/scripting/flwor15.xq	2013-08-25 03:24:25 +0000
@@ -1,11 +1,8 @@
-
-
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
 
 declare namespace ann = "http://zorba.io/annotations";;
 
-declare variable $local:processed-internal-links as xs:QName := 
-xs:QName("processed-internal-links");
+declare variable $local:processed-internal-links as xs:string := "processed-internal-links";
 
 
 declare variable $result := ();

=== modified file 'test/rbkt/Queries/zorba/scripting/nonsequential3.xq'
--- test/rbkt/Queries/zorba/scripting/nonsequential3.xq	2013-08-09 08:27:30 +0000
+++ test/rbkt/Queries/zorba/scripting/nonsequential3.xq	2013-08-25 03:24:25 +0000
@@ -1,10 +1,10 @@
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
 
 declare namespace ann = "http://zorba.io/annotations";;
 
 declare %ann:nonsequential function local:foo() 
 {
-  map:create(xs:QName("local:mymap"), xs:QName("xs:integer"));
+  map:create("mymap", xs:QName("xs:integer"));
 };
 
 local:foo()

=== modified file 'test/rbkt/Queries/zorba/scripting/udf1.xq'
--- test/rbkt/Queries/zorba/scripting/udf1.xq	2013-08-09 08:27:30 +0000
+++ test/rbkt/Queries/zorba/scripting/udf1.xq	2013-08-25 03:24:25 +0000
@@ -1,5 +1,4 @@
-import module namespace x =
-"http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
+import module namespace x = "http://zorba.io/modules/unordered-maps";;
 
 declare namespace ann = "http://zorba.io/annotations";;
 
@@ -9,7 +8,7 @@
   then
   {
     variable $req := <a/>;
-    variable $result := x:create(fn:QName("http://www.zorba-xquery.com/map";, "first"),
+    variable $result := x:create("first",
                                  fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:integer"));
 
     $result

=== modified file 'test/rbkt/Queries/zorba/store/unordered-map/map0.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map0.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map0.xq	2013-08-25 03:24:25 +0000
@@ -1,16 +1,13 @@
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
-
-
-let $name := fn:QName("http://www.zorba-xquery.com/map";, "first")
-let $type := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:integer")
-return
-  {
-    map:create($name, $type);
-
-    (
-      for $i in 1 to 1000
-      return map:insert($name, concat("value", $i), $i)
-    );
-
-    count(map:keys($name)) = map:size($name)
-  }
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
+
+
+{
+  map:create("first", "integer");
+
+  (
+    for $i in 1 to 1000
+    return map:insert("first", $i, concat("value", $i))
+  );
+
+  count(map:keys("first")) = map:size("first")
+}

=== modified file 'test/rbkt/Queries/zorba/store/unordered-map/map1.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map1.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map1.xq	2013-08-25 03:24:25 +0000
@@ -1,15 +1,15 @@
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
-
-
-let $name := fn:QName("http://www.zorba-xquery.com/map";, "first")
-let $type := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:integer")
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
+
+
+let $name := "first"
+let $type := "integer"
 return
   {
     map:create($name, $type);
 
     (
       for $i in 1 to 1000
-      return map:insert($name, concat("value", $i), $i)
+      return map:insert($name, $i, concat("value", $i))
     );
 
     map:get($name, 423)

=== modified file 'test/rbkt/Queries/zorba/store/unordered-map/map2.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map2.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map2.xq	2013-08-25 03:24:25 +0000
@@ -1,21 +1,21 @@
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
-
-
-let $name := fn:QName("http://www.zorba-xquery.com/map";, "first")
-let $type := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:integer")
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
+
+
+let $name := "first"
+let $type := "integer"
 return
   {
     variable $foo;
 
     map:create($name, $type);
 
-    map:insert($name, "value1", 1);
-    map:insert($name, "value2", 1);
-    map:insert($name, "value3", 2);
+    map:insert($name, 1, "value1");
+    map:insert($name, 1, "value2");
+    map:insert($name, 2, "value3");
 
     $foo := map:get($name, 1);
 
-    map:remove($name, 1);
+    map:delete($name, 1);
 
     $foo := ($foo, map:get($name, 1), map:size($name), map:available-maps());
 

=== modified file 'test/rbkt/Queries/zorba/store/unordered-map/map3.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map3.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map3.xq	2013-08-25 03:24:25 +0000
@@ -1,16 +1,16 @@
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
-
-
-let $name := fn:QName("http://www.zorba-xquery.com/map";, "first")
-let $type1 := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:anyAtomicType")
-let $type2 := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:integer")
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
+
+
+let $name := "first"
+let $type1 := "string"
+let $type2 := "integer"
 return
   {
-    map:create($name, $type1, $type2);
-
-    map:insert($name, "value", "key0", 1);
-
-    map:get($name, "key0", 1);
+    map:create($name, [ $type1, $type2]);
+
+    map:insert($name, ["key0", 1], "value");
+
+    map:get($name, ["key0", 1]);
 
     map:keys($name)
   }

=== modified file 'test/rbkt/Queries/zorba/store/unordered-map/map4.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map4.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map4.xq	2013-08-25 03:24:25 +0000
@@ -1,11 +1,11 @@
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
-
-
-let $name := fn:QName("http://www.zorba-xquery.com/map";, "first")
-let $type := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:anyAtomicType")
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
+
+
+let $name := "first"
+let $type := "decimal"
 return
   {
     map:create($name, $type);
-    map:insert($name, <a>blub</a>, 3.2);
+    map:insert($name, 3.2, <a>blub</a>);
     map:get($name, 3.2)
   }

=== modified file 'test/rbkt/Queries/zorba/store/unordered-map/map5.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map5.xq	2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map5.xq	2013-08-25 03:24:25 +0000
@@ -1,10 +1,10 @@
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
-
-
-let $name := fn:QName("http://www.zorba-xquery.com/map";, "first")
-let $type := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:integer")
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
+
+
+let $name := "first"
+let $type := "integer"
 return
   {
     map:create($name, $type);
-    map:delete(fn:QName("http://www.zorba-xquery.com/map";, "second"));
+    map:drop("second");
   }

=== modified file 'test/rbkt/Queries/zorba/store/unordered-map/map6.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map6.xq	2013-08-07 05:28:39 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map6.xq	2013-08-25 03:24:25 +0000
@@ -1,20 +1,20 @@
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
 
 declare namespace zerr = "http://zorba.io/errors";;
 declare namespace err = "http://www.w3.org/2005/xqt-errors";;
 
 
-let $name1 := fn:QName("http://www.zorba-xquery.com/map";, "first")
+let $name1 := "first"
 let $type1 := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:string")
-let $name2 := fn:QName("http://www.zorba-xquery.com/map";, "second")
+let $name2 := "second"
 let $type2 := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:integer")
 return
   {
     map:create($name1, $type1);
     map:create($name2, $type2);
-    map:insert($name1, <a>blub</a>, xs:anyURI("http://www.zorba-xquery.com/";));
-    map:insert($name1, <a>blub42</a>, 42);
-    map:insert($name2, <a>blub23</a>, 2);
+    map:insert($name1, xs:anyURI("http://www.zorba-xquery.com/";), <a>blub</a>);
+    map:insert($name1, 42, <a>blub42</a>);
+    map:insert($name2, 2, <a>blub23</a>);
     (
       map:get($name1, "http://www.zorba-xquery.com/";),
       map:get($name1, 42),

=== modified file 'test/rbkt/Queries/zorba/store/unordered-map/map7.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map7.xq	2012-06-22 23:36:41 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map7.xq	2013-08-25 03:24:25 +0000
@@ -1,22 +1,22 @@
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
 
-variable $name := fn:QName("http://www.zorba-xquery.com/map";, "first");
+variable $name := "first";
 variable $xs-integer := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:integer");
 variable $xs-string := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:string");
 
-map:create($name, $xs-integer, $xs-string);
+map:create($name, [$xs-integer, $xs-string]);
 
 for $i in 1 to 6
-let $value := concat("value", $i),
-    $key1  := if ($i mod 2 ne 0) then $i else (),
-    $key2  := if ($i mod 3 ne 0) then concat("key", $i) else ()
+let $value := concat("value", $i)
+let $key1  := $i
+let $key2  := concat("key", $i)
 return
-  map:insert($name, $value, $key1, $key2);
+  map:insert($name, [$key1, $key2], $value);
 
-for $k in map:keys($name)
-let $key1 := data($k/map:attribute[1]/@value),
-    $key2 := data($k/map:attribute[2]/@value)
+for $k in trace(map:keys($name), "key")
+let $key1 := jn:members($k)[1]
+let $key2 := jn:members($k)[2]
 order by $key1, $key2
 return
   ($key1 instance of xs:integer, $key2 instance of xs:string,
-   $key1, $key2, map:get($name, $key1, $key2))
+   $key1, $key2, map:get($name, [$key1, $key2]))

=== modified file 'test/rbkt/Queries/zorba/store/unordered-map/transient-map0.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/transient-map0.xq	2012-05-19 17:12:33 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/transient-map0.xq	2013-08-25 03:24:25 +0000
@@ -1,26 +1,26 @@
-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;
-
-
-let $name := fn:QName("http://www.zorba-xquery.com/map";, "first")
+import module namespace map = "http://zorba.io/modules/unordered-maps";;
+
+
+let $name := "first"
 let $type := fn:QName("http://www.w3.org/2001/XMLSchema";, "xs:integer")
 return
   {
-    map:create-transient($name, $type);
+    map:create($name, $type, { $map:PERSISTENT : false });
 
     (
       for $i in 1 to 1000
-      return map:insert($name, concat("value", $i), $i)
+      return map:insert($name, $i, concat("value", $i))
     );
 
     variable $res := <avail>{ map:available-maps() }</avail>;
 
     $res := ($res, <contains>{ map:get($name, 5) }</contains>);
 
-    map:remove($name, 5);
+    map:delete($name, 5);
 
     $res := ($res, <contains>{ map:get($name, 5) }</contains>);
     
-    map:delete($name);
+    map:drop($name);
 
     ($res, <avail>{ map:available-maps() }</avail>)
   }


References