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

Proposed by Matthias Brantner
Status: Merged
Approved by: Matthias Brantner
Approved revision: 11613
Merged at revision: 11612
Proposed branch: lp:~zorba-coders/zorba/bug-1189804
Merge into: lp:zorba
Diff against target: 4065 lines (+1469/-1340)
54 files modified
include/zorba/pregenerated/diagnostic_list.h (+4/-0)
modules/CMakeLists.txt (+1/-0)
modules/com/zorba-xquery/www/modules/CMakeLists.txt (+0/-2)
modules/com/zorba-xquery/www/modules/store/data-structures/unordered-map.xq (+0/-256)
modules/pregenerated/zorba-errors.xq (+8/-0)
modules/store/CMakeLists.txt (+16/-0)
modules/store/unordered-maps.xq (+312/-0)
src/context/dynamic_context.cpp (+37/-19)
src/context/dynamic_context.h (+3/-1)
src/context/static_context.cpp (+4/-3)
src/context/static_context.h (+1/-1)
src/diagnostics/diagnostic_en.xml (+8/-0)
src/diagnostics/pregenerated/diagnostic_list.cpp (+6/-0)
src/diagnostics/pregenerated/dict_en.cpp (+2/-0)
src/functions/pregenerated/func_maps.cpp (+138/-147)
src/functions/pregenerated/func_maps.h (+119/-138)
src/functions/pregenerated/function_enum.h (+10/-10)
src/runtime/indexing/index_func_impl.cpp (+1/-1)
src/runtime/pregenerated/iterator_enum.h (+3/-4)
src/runtime/spec/mappings.xml (+2/-2)
src/runtime/spec/store/maps.xml (+58/-86)
src/runtime/store/maps_impl.cpp (+442/-308)
src/runtime/store/pregenerated/maps.cpp (+40/-70)
src/runtime/store/pregenerated/maps.h (+34/-68)
src/runtime/visitors/pregenerated/planiter_visitor.h (+9/-14)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+22/-36)
src/runtime/visitors/pregenerated/printer_visitor.h (+6/-9)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter (+28/-29)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter (+28/-29)
test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-1.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-4.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/store/unordered-map/map3.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/store/unordered-map/map7.xml.res (+1/-1)
test/rbkt/Queries/zorba/no-copy/dataguide-c.xq (+4/-5)
test/rbkt/Queries/zorba/no-copy/dataguide-nc.xq (+5/-6)
test/rbkt/Queries/zorba/reference/reference_3.xq (+5/-5)
test/rbkt/Queries/zorba/scripting/flwor15.xq (+2/-5)
test/rbkt/Queries/zorba/scripting/nonsequential3.xq (+2/-2)
test/rbkt/Queries/zorba/scripting/udf1.xq (+2/-3)
test/rbkt/Queries/zorba/store/unordered-map/map-eval-1.xq (+6/-0)
test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.spec (+2/-0)
test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.xq (+6/-0)
test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.spec (+1/-0)
test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.xq (+6/-0)
test/rbkt/Queries/zorba/store/unordered-map/map-eval-4.xq (+6/-0)
test/rbkt/Queries/zorba/store/unordered-map/map0.xq (+13/-16)
test/rbkt/Queries/zorba/store/unordered-map/map1.xq (+6/-6)
test/rbkt/Queries/zorba/store/unordered-map/map2.xq (+9/-9)
test/rbkt/Queries/zorba/store/unordered-map/map3.xq (+11/-11)
test/rbkt/Queries/zorba/store/unordered-map/map4.xq (+6/-6)
test/rbkt/Queries/zorba/store/unordered-map/map5.xq (+6/-6)
test/rbkt/Queries/zorba/store/unordered-map/map6.xq (+6/-6)
test/rbkt/Queries/zorba/store/unordered-map/map7.xq (+11/-11)
test/rbkt/Queries/zorba/store/unordered-map/transient-map0.xq (+8/-8)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1189804
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Ghislain Fourny Approve
Review via email: mp+181973@code.launchpad.net

This proposal supersedes a proposal from 2013-08-24.

Commit message

JSONify unordered-maps module, changed name, improved documentation. Also, maps are now inherited from a parent static context (e.g. if used in eval).

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181969

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181969

Stage "BuildZorbaUbuntu" failed.

Check compiler output at http://jenkins.lambda.nu/job/BuildZorbaUbuntu/280/parsed_console to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181969

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181969

Stage "TestZorbaUbuntu" failed.
12 tests failed (8407 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/241/testReport/ to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181969

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181969

Stage "TestZorbaUbuntu" failed.
4 tests failed (8407 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/242/testReport/ to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181969

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181969

Stage "TestZorbaUbuntu" failed.
4 tests failed (8407 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/243/testReport/ to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181969

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181969

Stage "TestZorbaUbuntu" failed.
4 tests failed (8407 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/244/testReport/ to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Stage "TestZorbaUbuntu" failed.
4 tests failed (8407 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/245/testReport/ to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Stage "TestZorbaUbuntu" failed.
4 tests failed (8409 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/247/testReport/ to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Stage "TestZorbaUbuntu" failed.
1 tests failed (8409 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/248/testReport/ to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Stage "ZorbaVQ" failed.

Check console output at http://jenkins.lambda.nu/job/ZorbaVQ/321/console to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973 :
Votes: {'Pending': 2, 'Needs commit message': 1}

https://code.launchpad.net/~zorba-coders/zorba/html-module-bug-1189804/+merge/182529 :
Votes: {'Pending': 2}

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/143/console to view the results.

Revision history for this message
Ghislain Fourny (gislenius) wrote :

Looks good! Here are some comments:

- Did you check that the invalid option type error does not exist already? Will it be consistent also in all other modules?
- Should JSONiq modules not be suffixed as .jq (but it's only cosmetics of course).
- empty-sequence() -> ()
- array() -> array
- Why remove variadic="true"? I forgot what the semantics for this attribute are.
- In the implementation of map:key: why not reserve the vector size at the beginning (unless you cannot get the size of an ItemVector in constant time?).

review: Needs Fixing
lp:~zorba-coders/zorba/bug-1189804 updated
11610. By Matthias Brantner

address review comments

Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

> Looks good! Here are some comments:
>
> - Did you check that the invalid option type error does not exist already?
> Will it be consistent also in all other modules?
Yes, I did. This will become consistent as soon as the JSound implementation is there.

> - Should JSONiq modules not be suffixed as .jq (but it's only cosmetics of
> course).
That's not possible at the moment (see bug #1192043)

> - empty-sequence() -> ()
done

> - array() -> array
done

> - Why remove variadic="true"? I forgot what the semantics for this attribute
> are.
Variadic was only required in the previous version to be able to deal with
an arbitrary number of keys. Now that we have arrays, we can make the function
non-variadic. Arrays make this much easier to use.

> - In the implementation of map:key: why not reserve the vector size at the
> beginning (unless you cannot get the size of an ItemVector in constant time?).
Fixed.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973 :
Votes: {'Pending': 1, 'Needs Fixing': 1, 'Needs commit message': 1}

https://code.launchpad.net/~zorba-coders/zorba/html-module-bug-1189804/+merge/182529 :
Votes: {'Pending': 2}

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/145/console to view the results.

lp:~zorba-coders/zorba/bug-1189804 updated
11611. By Matthias Brantner

inherit maps from a parent dynamic context (useful in eval)

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973 :
Votes: {'Pending': 1, 'Needs Fixing': 1}

https://code.launchpad.net/~zorba-coders/zorba/html-module-bug-1189804/+merge/182529 :
Votes: {'Pending': 2}

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/148/console to view the results.

Revision history for this message
Ghislain Fourny (gislenius) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Stage "ZorbaVQ" failed.

Check console output at http://jenkins.lambda.nu/job/ZorbaVQ/346/console to view the results.

lp:~zorba-coders/zorba/bug-1189804 updated
11612. By Matthias Brantner

merge

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Stage "TestZorbaUbuntu" failed.
2 tests failed (8425 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/268/testReport/ to view the results.

lp:~zorba-coders/zorba/bug-1189804 updated
11613. By Matthias Brantner

fixed invalid resolution of merge conflict

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/html-module-bug-1189804/+merge/182529 :
Votes: {'Pending': 2}

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189804/+merge/181973

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/156/console to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h 2013-08-12 13:05:15 +0000
+++ include/zorba/pregenerated/diagnostic_list.h 2013-09-02 20:59:05 +0000
@@ -694,6 +694,10 @@
694694
695extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION;695extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION;
696696
697extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0042_ITEM_NOT_IN_COLLECTION;
698
699extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0043_INVALID_OPTION_TYPE;
700
697extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED;701extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED;
698702
699extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0002_COLLECTION_ALREADY_IMPORTED;703extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0002_COLLECTION_ALREADY_IMPORTED;
700704
=== modified file 'modules/CMakeLists.txt'
--- modules/CMakeLists.txt 2013-08-30 17:32:32 +0000
+++ modules/CMakeLists.txt 2013-09-02 20:59:05 +0000
@@ -13,6 +13,7 @@
13# limitations under the License.13# limitations under the License.
1414
15ADD_SUBDIRECTORY(atomic)15ADD_SUBDIRECTORY(atomic)
16ADD_SUBDIRECTORY(store)
16ADD_SUBDIRECTORY(com)17ADD_SUBDIRECTORY(com)
17ADD_SUBDIRECTORY(org)18ADD_SUBDIRECTORY(org)
18ADD_SUBDIRECTORY(functx)19ADD_SUBDIRECTORY(functx)
1920
=== modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt'
--- modules/com/zorba-xquery/www/modules/CMakeLists.txt 2013-08-30 17:45:50 +0000
+++ modules/com/zorba-xquery/www/modules/CMakeLists.txt 2013-09-02 20:59:05 +0000
@@ -32,8 +32,6 @@
32DECLARE_ZORBA_MODULE(FILE introspection/sctx.xq VERSION 2.032DECLARE_ZORBA_MODULE(FILE introspection/sctx.xq VERSION 2.0
33 URI "http://www.zorba-xquery.com/modules/introspection/sctx")33 URI "http://www.zorba-xquery.com/modules/introspection/sctx")
3434
35DECLARE_ZORBA_MODULE(FILE store/data-structures/unordered-map.xq VERSION 2.0
36 URI "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map")
37DECLARE_ZORBA_MODULE(FILE store/documents/dynamic.xq VERSION 2.035DECLARE_ZORBA_MODULE(FILE store/documents/dynamic.xq VERSION 2.0
38 URI "http://www.zorba-xquery.com/modules/store/dynamic/documents")36 URI "http://www.zorba-xquery.com/modules/store/dynamic/documents")
39DECLARE_ZORBA_MODULE(FILE store/dynamic/collections/ddl.xq VERSION 2.037DECLARE_ZORBA_MODULE(FILE store/dynamic/collections/ddl.xq VERSION 2.0
4038
=== 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 @@
1xquery version "3.0";
2(:
3 : Copyright 2006-2012 The FLWOR Foundation.
4 :
5 : Licensed under the Apache License, Version 2.0 (the "License");
6 : you may not use this file except in compliance with the License.
7 : You may obtain a copy of the License at
8 :
9 : http://www.apache.org/licenses/LICENSE-2.0
10 :
11 : Unless required by applicable law or agreed to in writing, software
12 : distributed under the License is distributed on an "AS IS" BASIS,
13 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : See the License for the specific language governing permissions and
15 : limitations under the License.
16:)
17
18(:~
19 : <p>This module defines a set of functions for working with maps. A map
20 : is identified by a QName and can be created using the map:create or
21 : map:create-transient functions and deleted using the map:delete function,
22 : respectively.</p>
23 :
24 : <p>The lifetime of a transient map is limited by the execution of the
25 : current XQuery program. A non-transient (or persistent) map lives until
26 : it is explicitly deleted. Accordingly, it's also available
27 : to other XQuery programs.</p>
28 :
29 : <p>The key of a particular entry in the map can consist of a tuple of
30 : atomic values (called attributes). The actual type of each attribute
31 : is determined when the map is created. The value of each attribute can
32 : be an arbitrary sequence of items.</p>
33 :
34 : @see <a href="../../html/data_lifecycle.html">Data Lifecycle</a>
35 : @see <a href="modules_http:__zorba.io_modules_zorba-errors.html">http://zorba.io/errors</a>
36 :
37 : @author Matthias Brantner
38 :
39 : @project Zorba/Data Store/Data Structures/Unordered Map
40 :)
41module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";
42
43declare namespace zerr = "http://zorba.io/errors";
44declare namespace err = "http://www.w3.org/2005/xqt-errors";
45declare namespace an = "http://zorba.io/annotations";
46
47declare namespace ver = "http://zorba.io/options/versioning";
48declare option ver:module-version "2.0";
49
50(:~
51 : Create a map with a given name and a set of type identifiers for each key
52 : attribute. Note that the function is variadic and might take an arbitrary
53 : number of type identifiers for the key attributes. Also note that the
54 : function is sequential and immediately creates the map in the store.
55 :
56 : @param $name the name of the map
57 : @param $key-type an arbitrary number of types, one
58 : for each key attribute.
59 :
60 : @return the function is sequential and immediately creates
61 : the corresponding map but returns the empty-sequence.
62 :
63 : @error err:XPTY0004 if any of the attribute types is not a subtype of
64 : xs:anyAtomicType.
65 : @error zerr:ZSTR0001 if a map with the given name already exists.
66 :)
67declare %an:variadic %an:sequential function map:create(
68 $name as xs:QName,
69 $key-type as xs:QName) as empty-sequence() external;
70
71(:~
72 : Create a transient map with a given name and a set of type identifiers
73 : for each key attribute. Note that the function is variadic and might
74 : take an arbitrary number of type identifiers for the key attributes.
75 :
76 : @param $name the name of the map
77 : @param $key-type an arbitrary number of types, one
78 : for each key attribute.
79 :
80 : @return the function is sequential and immediately creates
81 : the corresponding map but returns the empty-sequence.
82 :
83 : @error err:XPTY0004 if any of the attribute types is not a subtype of
84 : xs:anyAtomicType.
85 : @error zerr:ZSTR0001 if a map with the given name already exists.
86 :)
87declare %an:variadic %an:sequential function map:create-transient(
88 $name as xs:QName,
89 $key-type as xs:QName) as empty-sequence() external;
90
91(:~
92 : Destroys the map with the given name.
93 :
94 : @param $name the name of the map to delete
95 :
96 : @return the function is sequential and immediately deletes
97 : the map but returns the empty-sequence.
98 :
99 : @error zerr:ZDDY0023 if a map with the given name does not exist.
100 :)
101declare %an:sequential function map:delete(
102 $name as xs:QName) as empty-sequence() external;
103
104(:~
105 : Inserts a new entry into the map with the given name. Note that the
106 : function is variadic and might take an arbitrary number of key attributes.
107 : If an entry with the given key already exists in the map, the value
108 : sequences of the existing entry and the sequence passed using $value
109 : argument are concatenated.
110 :
111 : Note that it is possible to insert entries with empty key attributes.
112 : However as the getting the entries is based on the "eq" comparison and
113 : as "eq" with an empty sequence always return false, it is not possible
114 : to retrieve these entries.
115 :
116 : @param $name the name of the map
117 : @param $value the value of the entry to insert
118 : @param $key an arbitrary number of key attributes.
119 :
120 : @return the function is sequential and immediately inserts
121 : the entry into the map but returns the
122 : empty-sequence.
123 :
124 : @error zerr:ZDDY0023 if a map with the given name does not exist.
125 : @error zerr:ZDDY0025 if the given number of key attributes does not match
126 : the number of key attributes specified when creating
127 : the map (see the map:create function).
128 : @error zerr:ZXQD0005 if any of the given key attributes can not
129 : be cast (or is not a subtype) of the corresponding key attribute
130 : specified when creating the map.
131 :
132 : @see map:create
133 :
134 :)
135declare %an:variadic %an:sequential function map:insert(
136 $name as xs:QName,
137 $value as item()*,
138 $key as xs:anyAtomicType?) as empty-sequence() external;
139
140(:~
141 : Returns the value of the entry with the given key from the map.
142 :
143 : Note that it is possible to insert entries with empty key attributes.
144 : However as the getting the entries is based on the "eq" comparison and
145 : as "eq" with an empty sequence always return false, it is not possible
146 : to retrieve these entries.
147 :
148 : @param $name the name of the map
149 : @param an arbitrary number of search key attributes.
150 :
151 : @return the value of the entry in the map identified
152 : by the given key. The empty-sequence will be returned
153 : if no entry with the given key is contained in the map.
154 :
155 : @error zerr:ZDDY0023 if a map with the given name does not exist.
156 : @error zerr:ZDDY0025 if the given number of key attributes does not match
157 : the number of key attributes specified when creating
158 : the map (see the map:create function).
159 : @error zerr:ZXQD0005 if any of the given key attributes can not
160 : be cast (or is not a subtype) of the corresponding key attribute
161 : specified when creating the map.
162 :
163 : @see map:create
164 :)
165declare %an:variadic function map:get(
166 $name as xs:QName,
167 $key as xs:anyAtomicType?) as item()* external;
168
169(:~
170 : Removes an entry identified by the given key from the map.
171 :
172 : Note that it is possible to insert entries with empty key attributes.
173 : However as the removing the entries is based on the "eq" comparison and
174 : as "eq" with an empty sequence always return false, it is not possible
175 : to remove these entries.
176 :
177 : @param $name the name of the map
178 : @param an arbitrary number of search key attributes.
179 :
180 : @return the function is sequential and immediately removes
181 : the entry into the map but returns the
182 : empty-sequence.
183 :
184 : @error zerr:ZDDY0023 if a map with the given name does not exist.
185 : @error zerr:ZDDY0025 if the given number of key attributes does not match
186 : the number of key attributes specified when creating
187 : the map (see the map:create function).
188 : @error zerr:ZXQD0005 if any of the given key attributes can not
189 : be cast (or is not a subtype) of the corresponding key attribute
190 : specified when creating the map.
191 :
192 : @see map:create
193 :)
194declare %an:variadic %an:sequential function map:remove(
195 $name as xs:QName,
196 $key as xs:anyAtomicType?) as empty-sequence() external;
197
198(:~
199 : Returns the keys of all entries of a map. The keys
200 : are returned as sequence of nodes of the form:
201 :
202 : <pre>
203 : &lt;key xmlns="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map">
204 : &lt;attribute value="key1_value"/>
205 : &lt;attribute value="key2_value"/>
206 : &lt;attribute value="key3_value"/>
207 : &lt;/key>
208 : </pre>
209 :
210 : The following condition always holds:
211 : <tt>map:size($name) eq fn:count(map:keys($name))</tt>
212 :
213 : @param $name the name of the map
214 :
215 : @return all keys in the map.
216 :
217 : @error zerr:ZDDY0023 if a map with the given name does not exist.
218 :
219 :)
220declare function map:keys(
221 $name as xs:QName) as node()* external;
222
223(:~
224 : The number of entries in a map.
225 :
226 : The following condition always holds:
227 : <tt>map:size($name) eq fn:count(map:keys($name))</tt>
228 :
229 : @param $name the name of the map
230 :
231 : @return the number of entries in the map.
232 :
233 : @error zerr:ZDDY0023 if a map with the given name does not exist.
234 :)
235declare function map:size($name as xs:QName) as xs:integer external;
236
237(:~
238 : The function returns a sequence of QNames of the maps that are
239 : available. The sequence will be empty if there are no maps.
240 :
241 : @return A sequence of QNames, one for each available map, or an emtpy sequence.
242 :
243 :)
244declare function map:available-maps() as xs:QName* external;
245
246(:~
247 : The function returns true if the map identified by the given QName
248 : is transient, false otherwise.
249 :
250 : @param $name the name of the map
251 :
252 : @return true if the map is transient, false otherwise.
253 :
254 : @error zerr:ZDDY0023 if a map with the given name does not exist.
255 :)
256declare function map:is-transient($name as xs:QName) as xs:boolean external;
2570
=== modified file 'modules/pregenerated/zorba-errors.xq'
--- modules/pregenerated/zorba-errors.xq 2013-08-12 13:05:15 +0000
+++ modules/pregenerated/zorba-errors.xq 2013-09-02 20:59:05 +0000
@@ -606,6 +606,14 @@
606606
607(:~607(:~
608:)608:)
609declare variable $zerr:ZDDY0042 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0042");
610
611(:~
612:)
613declare variable $zerr:ZDDY0043 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0043");
614
615(:~
616:)
609declare variable $zerr:ZDST0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0001");617declare variable $zerr:ZDST0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0001");
610618
611(:~619(:~
612620
=== 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-09-02 20:59:05 +0000
@@ -0,0 +1,16 @@
1# Copyright 2013 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15DECLARE_ZORBA_MODULE(FILE unordered-maps.xq VERSION 1.0
16 URI "http://zorba.io/modules/unordered-maps")
017
=== 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-09-02 20:59:05 +0000
@@ -0,0 +1,312 @@
1jsoniq version "1.0";
2
3(:
4 : Copyright 2013 The FLWOR Foundation.
5 :
6 : Licensed under the Apache License, Version 2.0 (the "License");
7 : you may not use this file except in compliance with the License.
8 : You may obtain a copy of the License at
9 :
10 : http://www.apache.org/licenses/LICENSE-2.0
11 :
12 : Unless required by applicable law or agreed to in writing, software
13 : distributed under the License is distributed on an "AS IS" BASIS,
14 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 : See the License for the specific language governing permissions and
16 : limitations under the License.
17:)
18
19(:~
20 : This module defines a set of functions for working with maps. A map
21 : is identified by a string and can be created using the map:create function
22 : and dropped using the map:drop function.
23 : <p/>
24 : It is possible to create persistent and transient maps. The lifetime of a
25 : transient map is limited by the execution of the current query.
26 : A persistent map lives until it is explicitly dropped.
27 : Accordingly, it is also available to other requests.
28 : <p/>
29 : For example,
30 : <pre>map:create("my-map", ["string", "integer"], { "persistent" : false })</pre>
31 : will create a transient map named my-map having two keys.
32 : The types of the keys are string and integer.
33 : <p/>
34 : The key of a particular entry in the map can consist of a tuple of
35 : atomic values (called key attributes). The actual type of each attribute
36 : is determined when the map is created. The value of each entry is a
37 : sequence of items. If an item in this sequence is a object or array,
38 : this item needs to belong to a collection, otherwise, an error is raised.
39 :
40 : @author Matthias Brantner
41 :)
42module namespace map = "http://zorba.io/modules/unordered-maps";
43
44declare namespace an = "http://zorba.io/annotations";
45declare namespace zerr = "http://zorba.io/errors";
46
47declare namespace ver = "http://zorba.io/options/versioning";
48declare option ver:module-version "1.0";
49
50(:~
51 : Constant containing the field name of the options object
52 : indiciating whether a map is persistent or transient.
53 :)
54declare variable $map:PERSISTENT as string := "persistent";
55
56(:~
57 : Create a persistent map with a given name and type identifiers for the key
58 : attributes.
59 : <p/>
60 : If the map has only one key attribute, a single type identifier is given,
61 : for more than one key attribute an array of type identifiers is given.
62 : Calling this function is equivalent to calling create with the options
63 : <code>{ "persistent" : true }</code>
64 : Note that the function is sequential and immediately creates the map.
65 : <p/>
66 : Each key-type should be specified as string (e.g. "integer",
67 : "string", "boolean", "double", or "datetime").
68 : <p/>
69 : For example,
70 : <pre>map:create("my-map", "string")</pre> or
71 : <pre>map:create("my-map", ["string", "integer"])</pre>.
72 :
73 : @param $name the name of the map (the restrictions on collection names apply)
74 : @param $key-type one type identifier or an array of type identifiers for the
75 : key attributes
76 :
77 : @return the function is sequential and immediately creates
78 : the corresponding map. It returns the empty-sequence.
79 :
80 : @error err:XPTY0004 if any of the key attribute types is not a subtype of
81 : anyAtomicType.
82 : @error zerr:ZSTR0001 if a map with the given name already exists.
83 : @error zerr:ZDDY1000 if the given name is not a legal collection name
84 : @error zerr:ZDDY0043 if any of the given options has an invalid type
85 :
86 : @see map:create#3
87 :)
88declare %an:sequential function map:create(
89 $name as string,
90 $key-types as item) as () external;
91
92(:~
93 : Create a map with a given name, type identifiers for the key attributes, and
94 : options.
95 : <p/>
96 : If the map has only one key attribute, a single type identifier is given,
97 : for more than one key attribute an array of type identifiers is given.
98 : Currently only one option is supported: To create a transient map the object
99 : <code>{ "persistent" : false }</code>
100 : has to be passed to the $options parameter.
101 : Note that the function is sequential and immediately creates the map in the
102 : store.
103 : <p/>
104 : Note that a map cannot be created if it already exists in a parent context.
105 : For example, a map that was created in an outer query cannot be
106 : created again in an inner query executed using the
107 : <code>reflection:eval-s</code> function.
108 :
109 : @param $name the name of the map (the restrictions on collection names apply)
110 : @param $key-type one type identifier or an array of type identifiers for the
111 : key attributes
112 : @param $options an object describing options for the map
113 :
114 : @return the function is sequential and immediately creates
115 : the corresponding map but returns the empty-sequence.
116 :
117 : @error err:XPTY0004 if any of the attribute types is not a subtype of
118 : anyAtomicType.
119 : @error zerr:ZSTR0001 if a map with the given name already exists.
120 : @error zerr:ZDDY1000 if the given name is not a legal collection name
121 : @error zerr:ZDDY0043 if any of the given options has an invalid type
122 :
123 : @see map:create#2
124 :)
125declare %an:sequential function map:create(
126 $name as string,
127 $key-types as item,
128 $options as object) as () external;
129
130(:~
131 : Deletes the map with the given name.
132 : <p/>
133 : Note that a map can only be dropped in the context it was created.
134 : For example, a map that was created in an outer query cannot be
135 : dropped in an inner query executed using the
136 : <code>reflection:eval-s</code> function.
137 :
138 : @param $name the name of the map to drop
139 :
140 : @return the function is sequential and immediately drops
141 : the map. It returns the empty-sequence.
142 :
143 : @error zerr:ZDDY0023 if a map with the given name does not exist.
144 :)
145declare %an:sequential function map:drop(
146 $name as string) as () external;
147
148(:~
149 : Inserts a new entry into the map with the given name.
150 : <p/>
151 : If the map has only one key attribute, a single key value is given, for
152 : more than one key attribute an array of key values is given.
153 : If an entry with the given key already exists in the map, the value
154 : sequences of the existing entry and the sequence passed using $value
155 : argument are concatenated.
156 : <p/>
157 : If an item in the value sequence is an object or array, this
158 : item needs to belong to a collection, otherwise, an an error
159 : is raised.
160 : <p/>
161 : Note that it is possible to insert entries with empty key attributes
162 : or key attributes having the value <code>null</code>. However, as
163 : the comparison with an empty sequence or null always returns false,
164 : it is not possible to retrieve these entries.
165 : <p/>
166 : For example,
167 : <pre>map:insert("my-map", "key", "value")</pre> or
168 : <pre>map:insert("my-map", [ "key1", "key2" ] , (42, "value"))</pre>.
169 :
170 :
171 : @param $name the name of the map
172 : @param $key either a single attribute key or an array of keys
173 : @param $value the value of the entry to insert
174 :
175 : @return the function is sequential and immediately inserts
176 : the entry into the map. It returns the empty-sequence.
177 :
178 : @error zerr:ZDDY0023 if a map with the given name does not exist.
179 : @error zerr:ZDDY0025 if the given number of key attributes does not match
180 : the number of key attributes specified when creating
181 : the map (see the map:create function).
182 : @error zerr:ZXQD0005 if any of the given key attributes can not
183 : be cast (or is not a subtype) of the corresponding key attribute
184 : specified when creating the map.
185 : @error zerr:ZDDY1003 if the value to insert is an object or array
186 : it must belong to a collection.
187 :)
188declare %an:sequential function map:insert(
189 $name as string,
190 $key as item,
191 $value as item*) as () external;
192
193(:~
194 : Returns the value of the entry with the given key from the map.
195 : <p/>
196 : If the map has only one key attribute, a single key value is given, for
197 : more than one key attribute an array of key values is given.
198 : <p/>
199 : Note that it is possible to insert entries with empty key attributes.
200 : However as the getting the entries is based on the "eq" comparison and
201 : as "eq" with an empty sequence always return false, it is not possible
202 : to retrieve these entries.
203 : <p/>
204 : For example,
205 : <pre>map:get("my-map", "key")</pre> or
206 : <pre>map:get("my-map", [ "key1", "key2" ])</pre>.
207 :
208 : @param $name the name of the map
209 : @param $key either a single attribute key or an array of keys
210 :
211 : @return the value of the entry in the map identified
212 : by the given key. The empty-sequence will be returned
213 : if no entry with the given key is contained in the map.
214 :
215 : @error zerr:ZDDY0023 if a map with the given name does not exist.
216 : @error zerr:ZDDY0025 if the given number of key attributes does not match
217 : the number of key attributes specified when creating
218 : the map (see the map:create function).
219 : @error zerr:ZXQD0005 if any of the given key attributes can not
220 : be cast (or is not a subtype) of the corresponding key attribute
221 : specified when creating the map.
222 :
223 : @see map:create
224 :)
225declare function map:get(
226 $name as string,
227 $key as item) as item* external;
228
229(:~
230 : Removes an entry identified by the given key from the map.
231 : <p/>
232 : If the map has only one key attribute, a single key value is given, for
233 : more than one key attribute an array of key values is given.
234 : <p/>
235 : Note that it is possible to insert entries with empty key attributes.
236 : However as the removing the entries is based on the "eq" comparison and
237 : as "eq" with an empty sequence always return false, it is not possible
238 : to delete these entries.
239 :
240 : @param $name the name of the map
241 : @param $key either a single attribute key or an array of keys
242 :
243 : @return the function is sequential and immediately deletes
244 : the entry into the map but returns the
245 : empty-sequence.
246 :
247 : @error zerr:ZDDY0023 if a map with the given name does not exist.
248 : @error zerr:ZDDY0025 if the given number of key attributes does not match
249 : the number of key attributes specified when creating
250 : the map (see the map:create function).
251 : @error zerr:ZXQD0005 if any of the given key attributes can not
252 : be cast (or is not a subtype) of the corresponding key attribute
253 : specified when creating the map.
254 :
255 : @see map:create
256 :)
257declare %an:sequential function map:delete(
258 $name as string,
259 $key as item) as () external;
260
261(:~
262 : Returns the keys of all entries of a map. The keys
263 : are returned as sequence of arrays.
264 : <p/>
265 : The following condition always holds:
266 : <tt>map:size($name) eq count(map:keys($name))</tt>
267 :
268 : @param $name the name of the map
269 :
270 : @return an sequence of arrays each array containing the values of all
271 : attributes of one key.
272 :
273 : @error zerr:ZDDY0023 if a map with the given name does not exist.
274 :)
275declare function map:keys($name as string) as array* external;
276
277(:~
278 : Returns the number of entries in a map.
279 : <p/>
280 : The following condition always holds:
281 : <tt>map:size($name) eq count(map:keys($name))</tt>
282 :
283 : @param $name the name of the map
284 :
285 : @return the number of entries in the map.
286 :
287 : @error zerr:ZDDY0023 if a map with the given name does not exist.
288 :)
289declare function map:size($name as string) as integer external;
290
291(:~
292 : The function returns a sequence of names of the maps that are
293 : available (persistent and non-persistent). The sequence will be
294 : empty if there are no maps.
295 : <p/>
296 :
297 : @return A sequence of string, one for each available map, or
298 : an empty sequence.
299 :)
300declare function map:available-maps() as string* external;
301
302(:~
303 : The function returns the options that were passed during creation or the
304 : default options if no options were passed.
305 :
306 : @param $name the name of the map
307 :
308 : @return an options object
309 :
310 : @error zerr:ZDDY0023 if a map with the given name does not exist.
311 :)
312declare function map:options($name as string) as object external;
0313
=== modified file 'src/context/dynamic_context.cpp'
--- src/context/dynamic_context.cpp 2013-08-02 18:36:02 +0000
+++ src/context/dynamic_context.cpp 2013-09-02 20:59:05 +0000
@@ -743,21 +743,29 @@
743/*******************************************************************************743/*******************************************************************************
744744
745********************************************************************************/745********************************************************************************/
746store::Index* dynamic_context::getMap(store::Item* qname) const746store::Index* dynamic_context::getMap(
747 store::Item* qname,
748 bool lookupParent) const
747{749{
748 if (theAvailableMaps == NULL)
749 return NULL;
750
751 store::Index_t map;750 store::Index_t map;
751 const dynamic_context* c = this;
752752
753 if (theAvailableMaps->get(qname, map))753 while (c)
754 {754 {
755 return map.getp();755 if (c->theAvailableMaps && c->theAvailableMaps->get(qname, map))
756 }756 {
757 else757 return map.getp();
758 {758 }
759 return NULL;759 else
760 }760 {
761 if (lookupParent)
762 c = c->getParent();
763 else
764 c = NULL;
765 continue;
766 }
767 }
768 return NULL;
761}769}
762770
763771
@@ -783,8 +791,12 @@
783********************************************************************************/791********************************************************************************/
784void dynamic_context::unbindMap(store::Item* qname)792void dynamic_context::unbindMap(store::Item* qname)
785{793{
786 if (theAvailableMaps != NULL)794 store::Index_t map;
795
796 if (theAvailableMaps && theAvailableMaps->get(qname, map))
797 {
787 theAvailableMaps->erase(qname);798 theAvailableMaps->erase(qname);
799 }
788}800}
789801
790802
@@ -793,14 +805,20 @@
793********************************************************************************/805********************************************************************************/
794void dynamic_context::getMapNames(std::vector<store::Item_t>& names) const806void dynamic_context::getMapNames(std::vector<store::Item_t>& names) const
795{807{
796 if (theAvailableMaps == NULL)808 const dynamic_context* c = this;
797 return;
798809
799 for (IndexMap::iterator lIter = theAvailableMaps->begin();810 while (c)
800 lIter != theAvailableMaps->end();
801 ++lIter)
802 {811 {
803 names.push_back(lIter.getKey());812 if (c->theAvailableMaps)
813 {
814 for (IndexMap::iterator lIter = c->theAvailableMaps->begin();
815 lIter != c->theAvailableMaps->end();
816 ++lIter)
817 {
818 names.push_back(lIter.getKey());
819 }
820 }
821 c = c->getParent();
804 }822 }
805}823}
806824
807825
=== modified file 'src/context/dynamic_context.h'
--- src/context/dynamic_context.h 2013-06-11 23:38:49 +0000
+++ src/context/dynamic_context.h 2013-09-02 20:59:05 +0000
@@ -156,6 +156,8 @@
156156
157 dynamic_context* getParent() { return theParent; }157 dynamic_context* getParent() { return theParent; }
158158
159 const dynamic_context* getParent() const { return theParent; }
160
159 store::Item_t get_default_collection() const;161 store::Item_t get_default_collection() const;
160162
161 void set_default_collection(const store::Item_t& default_collection_uri);163 void set_default_collection(const store::Item_t& default_collection_uri);
@@ -244,7 +246,7 @@
244246
245 void unbindIndex(store::Item* qname);247 void unbindIndex(store::Item* qname);
246248
247 store::Index* getMap(store::Item* qname) const;249 store::Index* getMap(store::Item* qname, bool lookupParent = true) const;
248250
249 void bindMap(store::Item* qname, store::Index_t& index);251 void bindMap(store::Item* qname, store::Index_t& index);
250252
251253
=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp 2013-08-30 17:45:50 +0000
+++ src/context/static_context.cpp 2013-09-02 20:59:05 +0000
@@ -407,8 +407,8 @@
407"http://www.zorba-xquery.com/modules/store/dynamic/documents";407"http://www.zorba-xquery.com/modules/store/dynamic/documents";
408408
409const char*409const char*
410static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS =410static_context::ZORBA_STORE_UNORDERED_MAPS_FN_NS =
411"http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";411"http://zorba.io/modules/unordered-maps";
412412
413const char*413const char*
414static_context::JSONIQ_DM_NS =414static_context::JSONIQ_DM_NS =
@@ -536,7 +536,7 @@
536 ns == ZORBA_NODEPOS_FN_NS ||536 ns == ZORBA_NODEPOS_FN_NS ||
537537
538 ns == ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS ||538 ns == ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS ||
539 ns == ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS ||539 ns == ZORBA_STORE_UNORDERED_MAPS_FN_NS ||
540 ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DDL_FN_NS ||540 ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DDL_FN_NS ||
541 ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS ||541 ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS ||
542 ns == ZORBA_STORE_STATIC_COLLECTIONS_DDL_FN_NS ||542 ns == ZORBA_STORE_STATIC_COLLECTIONS_DDL_FN_NS ||
@@ -620,6 +620,7 @@
620 ns == ZORBA_XQDOC_FN_NS ||620 ns == ZORBA_XQDOC_FN_NS ||
621 ns == ZORBA_URI_FN_NS ||621 ns == ZORBA_URI_FN_NS ||
622 ns == ZORBA_RANDOM_FN_NS ||622 ns == ZORBA_RANDOM_FN_NS ||
623 ns == ZORBA_STORE_UNORDERED_MAPS_FN_NS ||
623 ns == ZORBA_FETCH_FN_NS ||624 ns == ZORBA_FETCH_FN_NS ||
624#ifndef ZORBA_NO_FULL_TEXT625#ifndef ZORBA_NO_FULL_TEXT
625 ns == ZORBA_FULL_TEXT_FN_NS ||626 ns == ZORBA_FULL_TEXT_FN_NS ||
626627
=== 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-09-02 20:59:05 +0000
@@ -533,7 +533,7 @@
533 static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DDL_FN_NS;533 static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DDL_FN_NS;
534 static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DML_FN_NS;534 static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DML_FN_NS;
535 static const char* ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS;535 static const char* ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS;
536 static const char* ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS;536 static const char* ZORBA_STORE_UNORDERED_MAPS_FN_NS;
537537
538 static const char* JSONIQ_DM_NS;538 static const char* JSONIQ_DM_NS;
539 static const char* JSONIQ_FN_NS;539 static const char* JSONIQ_FN_NS;
540540
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml 2013-08-30 14:50:21 +0000
+++ src/diagnostics/diagnostic_en.xml 2013-09-02 20:59:05 +0000
@@ -2852,6 +2852,14 @@
2852 <value>"$1": collection was modified while reading</value>2852 <value>"$1": collection was modified while reading</value>
2853 </diagnostic>2853 </diagnostic>
28542854
2855 <diagnostic code="ZDDY0042" name="ITEM_NOT_IN_COLLECTION">
2856 <value>"$1": map insertion requires $2 to belong to a collection</value>
2857 </diagnostic>
2858
2859 <diagnostic code="ZDDY0043" name="INVALID_OPTION_TYPE">
2860 <value>"$1": invalid type for option "$2"</value>
2861 </diagnostic>
2862
2855 <diagnostic code="ZDST0001" name="COLLECTION_ALREADY_DECLARED">2863 <diagnostic code="ZDST0001" name="COLLECTION_ALREADY_DECLARED">
2856 <value>"$1": collection already declared</value>2864 <value>"$1": collection already declared</value>
2857 </diagnostic>2865 </diagnostic>
28582866
=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp 2013-08-12 13:05:15 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp 2013-09-02 20:59:05 +0000
@@ -1020,6 +1020,12 @@
1020ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION( "ZDDY0041" );1020ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION( "ZDDY0041" );
10211021
10221022
1023ZorbaErrorCode ZDDY0042_ITEM_NOT_IN_COLLECTION( "ZDDY0042" );
1024
1025
1026ZorbaErrorCode ZDDY0043_INVALID_OPTION_TYPE( "ZDDY0043" );
1027
1028
1023ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED( "ZDST0001" );1029ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED( "ZDST0001" );
10241030
10251031
10261032
=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp 2013-08-30 14:50:21 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp 2013-09-02 20:59:05 +0000
@@ -357,6 +357,8 @@
357 { "ZDDY0039", "attempt to edit non-root node in collection \"$1\"" },357 { "ZDDY0039", "attempt to edit non-root node in collection \"$1\"" },
358 { "ZDDY0040", "attempt to edit an item with a template of a different kind (for example an object with a node)." },358 { "ZDDY0040", "attempt to edit an item with a template of a different kind (for example an object with a node)." },
359 { "ZDDY0041", "\"$1\": collection was modified while reading" },359 { "ZDDY0041", "\"$1\": collection was modified while reading" },
360 { "ZDDY0042", "\"$1\": map insertion requires $2 to belong to a collection" },
361 { "ZDDY0043", "\"$1\": invalid type for option \"$2\"" },
360 { "ZDST0001", "\"$1\": collection already declared" },362 { "ZDST0001", "\"$1\": collection already declared" },
361 { "ZDST0002", "\"$1\": collection already imported into module \"$2\"" },363 { "ZDST0002", "\"$1\": collection already imported into module \"$2\"" },
362 { "ZDST0003", "\"$1\": collection declaration not allowed in main module" },364 { "ZDST0003", "\"$1\": collection declaration not allowed in main module" },
363365
=== 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-09-02 20:59:05 +0000
@@ -31,7 +31,7 @@
3131
3232
3333
34PlanIter_t zorba_store_data_structure_unordered_map_create::codegen(34PlanIter_t zorba_store_unordered_maps_create::codegen(
35 CompilerCB*,35 CompilerCB*,
36 static_context* sctx,36 static_context* sctx,
37 const QueryLoc& loc,37 const QueryLoc& loc,
@@ -41,27 +41,17 @@
41 return new MapCreateIterator(sctx, loc, argv);41 return new MapCreateIterator(sctx, loc, argv);
42}42}
4343
44PlanIter_t zorba_store_data_structure_unordered_map_create_transient::codegen(44PlanIter_t zorba_store_unordered_maps_drop::codegen(
45 CompilerCB*,45 CompilerCB*,
46 static_context* sctx,46 static_context* sctx,
47 const QueryLoc& loc,47 const QueryLoc& loc,
48 std::vector<PlanIter_t>& argv,48 std::vector<PlanIter_t>& argv,
49 expr& ann) const49 expr& ann) const
50{50{
51 return new MapCreateTransientIterator(sctx, loc, argv);51 return new MapDropIterator(sctx, loc, argv);
52}52}
5353
54PlanIter_t zorba_store_data_structure_unordered_map_delete::codegen(54PlanIter_t zorba_store_unordered_maps_get::codegen(
55 CompilerCB*,
56 static_context* sctx,
57 const QueryLoc& loc,
58 std::vector<PlanIter_t>& argv,
59 expr& ann) const
60{
61 return new MapDestroyIterator(sctx, loc, argv);
62}
63
64PlanIter_t zorba_store_data_structure_unordered_map_get::codegen(
65 CompilerCB*,55 CompilerCB*,
66 static_context* sctx,56 static_context* sctx,
67 const QueryLoc& loc,57 const QueryLoc& loc,
@@ -71,7 +61,7 @@
71 return new MapGetIterator(sctx, loc, argv);61 return new MapGetIterator(sctx, loc, argv);
72}62}
7363
74PlanIter_t zorba_store_data_structure_unordered_map_insert::codegen(64PlanIter_t zorba_store_unordered_maps_insert::codegen(
75 CompilerCB*,65 CompilerCB*,
76 static_context* sctx,66 static_context* sctx,
77 const QueryLoc& loc,67 const QueryLoc& loc,
@@ -81,17 +71,17 @@
81 return new MapInsertIterator(sctx, loc, argv);71 return new MapInsertIterator(sctx, loc, argv);
82}72}
8373
84PlanIter_t zorba_store_data_structure_unordered_map_remove::codegen(74PlanIter_t zorba_store_unordered_maps_delete::codegen(
85 CompilerCB*,75 CompilerCB*,
86 static_context* sctx,76 static_context* sctx,
87 const QueryLoc& loc,77 const QueryLoc& loc,
88 std::vector<PlanIter_t>& argv,78 std::vector<PlanIter_t>& argv,
89 expr& ann) const79 expr& ann) const
90{80{
91 return new MapRemoveIterator(sctx, loc, argv);81 return new MapDeleteIterator(sctx, loc, argv);
92}82}
9383
94PlanIter_t zorba_store_data_structure_unordered_map_keys::codegen(84PlanIter_t zorba_store_unordered_maps_keys::codegen(
95 CompilerCB*,85 CompilerCB*,
96 static_context* sctx,86 static_context* sctx,
97 const QueryLoc& loc,87 const QueryLoc& loc,
@@ -101,7 +91,7 @@
101 return new MapKeysIterator(sctx, loc, argv);91 return new MapKeysIterator(sctx, loc, argv);
102}92}
10393
104PlanIter_t zorba_store_data_structure_unordered_map_size::codegen(94PlanIter_t zorba_store_unordered_maps_size::codegen(
105 CompilerCB*,95 CompilerCB*,
106 static_context* sctx,96 static_context* sctx,
107 const QueryLoc& loc,97 const QueryLoc& loc,
@@ -111,7 +101,7 @@
111 return new MapSizeIterator(sctx, loc, argv);101 return new MapSizeIterator(sctx, loc, argv);
112}102}
113103
114PlanIter_t zorba_store_data_structure_unordered_map_available_maps::codegen(104PlanIter_t zorba_store_unordered_maps_available_maps::codegen(
115 CompilerCB*,105 CompilerCB*,
116 static_context* sctx,106 static_context* sctx,
117 const QueryLoc& loc,107 const QueryLoc& loc,
@@ -121,14 +111,14 @@
121 return new AvailableMapsIterator(sctx, loc, argv);111 return new AvailableMapsIterator(sctx, loc, argv);
122}112}
123113
124PlanIter_t zorba_store_data_structure_unordered_map_is_transient::codegen(114PlanIter_t zorba_store_unordered_maps_options::codegen(
125 CompilerCB*,115 CompilerCB*,
126 static_context* sctx,116 static_context* sctx,
127 const QueryLoc& loc,117 const QueryLoc& loc,
128 std::vector<PlanIter_t>& argv,118 std::vector<PlanIter_t>& argv,
129 expr& ann) const119 expr& ann) const
130{120{
131 return new MapIsTransientIterator(sctx, loc, argv);121 return new MapOptionsIterator(sctx, loc, argv);
132}122}
133123
134void populate_context_maps(static_context* sctx)124void populate_context_maps(static_context* sctx)
@@ -136,124 +126,125 @@
136126
137127
138 {128 {
139 std::vector<xqtref_t> lParamTypes;129 DECL_WITH_KIND(sctx, zorba_store_unordered_maps_create,
140 lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);130 (createQName("http://zorba.io/modules/unordered-maps","","create"),
141 lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_create,131 GENV_TYPESYSTEM.STRING_TYPE_ONE,
142 (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","create"), 132 GENV_TYPESYSTEM.ITEM_TYPE_ONE,
143 lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true),133 GENV_TYPESYSTEM.EMPTY_TYPE),
144 FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_N);134 FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_CREATE_2);
145135
146 }136 }
147137
148138
149139
150140
151 {141 {
152 std::vector<xqtref_t> lParamTypes;142 DECL_WITH_KIND(sctx, zorba_store_unordered_maps_create,
153 lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);143 (createQName("http://zorba.io/modules/unordered-maps","","create"),
154 lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_create_transient,144 GENV_TYPESYSTEM.STRING_TYPE_ONE,
155 (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","create-transient"), 145 GENV_TYPESYSTEM.ITEM_TYPE_ONE,
156 lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true),146 GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE,
157 FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_TRANSIENT_N);147 GENV_TYPESYSTEM.EMPTY_TYPE),
158148 FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_CREATE_3);
159 }149
160150 }
161151
162152
163153
164 {154
165 DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_delete,155 {
166 (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","delete"), 156 DECL_WITH_KIND(sctx, zorba_store_unordered_maps_drop,
167 GENV_TYPESYSTEM.QNAME_TYPE_ONE, 157 (createQName("http://zorba.io/modules/unordered-maps","","drop"),
168 GENV_TYPESYSTEM.EMPTY_TYPE),158 GENV_TYPESYSTEM.STRING_TYPE_ONE,
169 FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_DELETE_1);159 GENV_TYPESYSTEM.EMPTY_TYPE),
170160 FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_DROP_1);
171 }161
172162 }
173163
174164
175165
176 {166
177 std::vector<xqtref_t> lParamTypes;167 {
178 lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);168 DECL_WITH_KIND(sctx, zorba_store_unordered_maps_get,
179 lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_get,169 (createQName("http://zorba.io/modules/unordered-maps","","get"),
180 (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","get"), 170 GENV_TYPESYSTEM.STRING_TYPE_ONE,
181 lParamTypes, GENV_TYPESYSTEM.ITEM_TYPE_STAR, true),171 GENV_TYPESYSTEM.ITEM_TYPE_ONE,
182 FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_GET_N);172 GENV_TYPESYSTEM.ITEM_TYPE_STAR),
183173 FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_GET_2);
184 }174
185175 }
186176
187177
188178
189 {179
190 std::vector<xqtref_t> lParamTypes;180 {
191 lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);181 DECL_WITH_KIND(sctx, zorba_store_unordered_maps_insert,
192 lParamTypes.push_back(GENV_TYPESYSTEM.ITEM_TYPE_STAR);182 (createQName("http://zorba.io/modules/unordered-maps","","insert"),
193 lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_insert,183 GENV_TYPESYSTEM.STRING_TYPE_ONE,
194 (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","insert"), 184 GENV_TYPESYSTEM.ITEM_TYPE_ONE,
195 lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true),185 GENV_TYPESYSTEM.ITEM_TYPE_STAR,
196 FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_INSERT_N);186 GENV_TYPESYSTEM.EMPTY_TYPE),
197187 FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_INSERT_3);
198 }188
199189 }
200190
201191
202192
203 {193
204 std::vector<xqtref_t> lParamTypes;194 {
205 lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);195 DECL_WITH_KIND(sctx, zorba_store_unordered_maps_delete,
206 lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_remove,196 (createQName("http://zorba.io/modules/unordered-maps","","delete"),
207 (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","remove"), 197 GENV_TYPESYSTEM.STRING_TYPE_ONE,
208 lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true),198 GENV_TYPESYSTEM.ITEM_TYPE_ONE,
209 FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_REMOVE_N);199 GENV_TYPESYSTEM.EMPTY_TYPE),
210200 FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_DELETE_2);
211 }201
212202 }
213203
214204
215205
216 {206
217 DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_keys,207 {
218 (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","keys"), 208 DECL_WITH_KIND(sctx, zorba_store_unordered_maps_keys,
219 GENV_TYPESYSTEM.QNAME_TYPE_ONE, 209 (createQName("http://zorba.io/modules/unordered-maps","","keys"),
220 GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR),210 GENV_TYPESYSTEM.STRING_TYPE_ONE,
221 FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_KEYS_1);211 GENV_TYPESYSTEM.JSON_ARRAY_TYPE_STAR),
222212 FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_KEYS_1);
223 }213
224214 }
225215
226216
227217
228 {218
229 DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_size,219 {
230 (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","size"), 220 DECL_WITH_KIND(sctx, zorba_store_unordered_maps_size,
231 GENV_TYPESYSTEM.QNAME_TYPE_ONE, 221 (createQName("http://zorba.io/modules/unordered-maps","","size"),
222 GENV_TYPESYSTEM.STRING_TYPE_ONE,
232 GENV_TYPESYSTEM.INTEGER_TYPE_ONE),223 GENV_TYPESYSTEM.INTEGER_TYPE_ONE),
233 FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_SIZE_1);224 FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_SIZE_1);
234225
235 }226 }
236227
237228
238229
239230
240 {231 {
241 DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_available_maps,232 DECL_WITH_KIND(sctx, zorba_store_unordered_maps_available_maps,
242 (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","available-maps"), 233 (createQName("http://zorba.io/modules/unordered-maps","","available-maps"),
243 GENV_TYPESYSTEM.QNAME_TYPE_STAR),234 GENV_TYPESYSTEM.STRING_TYPE_STAR),
244 FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_AVAILABLE_MAPS_0);235 FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_AVAILABLE_MAPS_0);
245236
246 }237 }
247238
248239
249240
250241
251 {242 {
252 DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_is_transient,243 DECL_WITH_KIND(sctx, zorba_store_unordered_maps_options,
253 (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","is-transient"), 244 (createQName("http://zorba.io/modules/unordered-maps","","options"),
254 GENV_TYPESYSTEM.QNAME_TYPE_ONE, 245 GENV_TYPESYSTEM.STRING_TYPE_ONE,
255 GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),246 GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE),
256 FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_IS_TRANSIENT_1);247 FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_OPTIONS_1);
257248
258 }249 }
259250
260251
=== 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-09-02 20:59:05 +0000
@@ -38,85 +38,66 @@
3838
3939
4040
41//zorba-store-data-structure-unordered-map:create41//zorba-store-unordered-maps:create
42class zorba_store_data_structure_unordered_map_create : public function42class zorba_store_unordered_maps_create : public function
43{43{
44public:44public:
45 zorba_store_data_structure_unordered_map_create(const signature& sig, FunctionConsts::FunctionKind kind)45 zorba_store_unordered_maps_create(const signature& sig, FunctionConsts::FunctionKind kind)
46 : 46 :
47 function(sig, kind)47 function(sig, kind)
48 {48 {
4949
50 }50 }
5151
52 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }52 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
5353
54 bool accessesDynCtx() const { return true; }54 bool accessesDynCtx() const { return true; }
5555
56 CODEGEN_DECL();56 CODEGEN_DECL();
57};57};
5858
5959
60//zorba-store-data-structure-unordered-map:create-transient60//zorba-store-unordered-maps:drop
61class zorba_store_data_structure_unordered_map_create_transient : public function61class zorba_store_unordered_maps_drop : public function
62{62{
63public:63public:
64 zorba_store_data_structure_unordered_map_create_transient(const signature& sig, FunctionConsts::FunctionKind kind)64 zorba_store_unordered_maps_drop(const signature& sig, FunctionConsts::FunctionKind kind)
65 : 65 :
66 function(sig, kind)66 function(sig, kind)
67 {67 {
6868
69 }69 }
7070
71 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }71 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
7272
73 bool accessesDynCtx() const { return true; }73 bool accessesDynCtx() const { return true; }
7474
75 CODEGEN_DECL();75 CODEGEN_DECL();
76};76};
7777
7878
79//zorba-store-data-structure-unordered-map:delete79//zorba-store-unordered-maps:get
80class zorba_store_data_structure_unordered_map_delete : public function80class zorba_store_unordered_maps_get : public function
81{81{
82public:82public:
83 zorba_store_data_structure_unordered_map_delete(const signature& sig, FunctionConsts::FunctionKind kind)83 zorba_store_unordered_maps_get(const signature& sig, FunctionConsts::FunctionKind kind)
84 : 84 :
85 function(sig, kind)85 function(sig, kind)
86 {86 {
8787
88 }88 }
8989
90 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }90 bool accessesDynCtx() const { return true; }
9191
92 bool accessesDynCtx() const { return true; }92 CODEGEN_DECL();
9393};
94 CODEGEN_DECL();94
95};95
9696//zorba-store-unordered-maps:insert
9797class zorba_store_unordered_maps_insert : public function
98//zorba-store-data-structure-unordered-map:get98{
99class zorba_store_data_structure_unordered_map_get : public function99public:
100{100 zorba_store_unordered_maps_insert(const signature& sig, FunctionConsts::FunctionKind kind)
101public:
102 zorba_store_data_structure_unordered_map_get(const signature& sig, FunctionConsts::FunctionKind kind)
103 :
104 function(sig, kind)
105 {
106
107 }
108
109 bool accessesDynCtx() const { return true; }
110
111 CODEGEN_DECL();
112};
113
114
115//zorba-store-data-structure-unordered-map:insert
116class zorba_store_data_structure_unordered_map_insert : public function
117{
118public:
119 zorba_store_data_structure_unordered_map_insert(const signature& sig, FunctionConsts::FunctionKind kind)
120 : 101 :
121 function(sig, kind)102 function(sig, kind)
122 {103 {
@@ -133,11 +114,11 @@
133};114};
134115
135116
136//zorba-store-data-structure-unordered-map:remove117//zorba-store-unordered-maps:delete
137class zorba_store_data_structure_unordered_map_remove : public function118class zorba_store_unordered_maps_delete : public function
138{119{
139public:120public:
140 zorba_store_data_structure_unordered_map_remove(const signature& sig, FunctionConsts::FunctionKind kind)121 zorba_store_unordered_maps_delete(const signature& sig, FunctionConsts::FunctionKind kind)
141 : 122 :
142 function(sig, kind)123 function(sig, kind)
143 {124 {
@@ -152,62 +133,62 @@
152};133};
153134
154135
155//zorba-store-data-structure-unordered-map:keys136//zorba-store-unordered-maps:keys
156class zorba_store_data_structure_unordered_map_keys : public function137class zorba_store_unordered_maps_keys : public function
157{138{
158public:139public:
159 zorba_store_data_structure_unordered_map_keys(const signature& sig, FunctionConsts::FunctionKind kind)140 zorba_store_unordered_maps_keys(const signature& sig, FunctionConsts::FunctionKind kind)
160 : 141 :
161 function(sig, kind)142 function(sig, kind)
162 {143 {
163144
164 }145 }
165146
166 bool accessesDynCtx() const { return true; }147 bool accessesDynCtx() const { return true; }
167148
168 CODEGEN_DECL();149 CODEGEN_DECL();
169};150};
170151
171152
172//zorba-store-data-structure-unordered-map:size153//zorba-store-unordered-maps:size
173class zorba_store_data_structure_unordered_map_size : public function154class zorba_store_unordered_maps_size : public function
174{155{
175public:156public:
176 zorba_store_data_structure_unordered_map_size(const signature& sig, FunctionConsts::FunctionKind kind)157 zorba_store_unordered_maps_size(const signature& sig, FunctionConsts::FunctionKind kind)
177 : 158 :
178 function(sig, kind)159 function(sig, kind)
179 {160 {
180161
181 }162 }
182163
183 bool accessesDynCtx() const { return true; }164 bool accessesDynCtx() const { return true; }
184165
185 CODEGEN_DECL();166 CODEGEN_DECL();
186};167};
187168
188169
189//zorba-store-data-structure-unordered-map:available-maps170//zorba-store-unordered-maps:available-maps
190class zorba_store_data_structure_unordered_map_available_maps : public function171class zorba_store_unordered_maps_available_maps : public function
191{172{
192public:173public:
193 zorba_store_data_structure_unordered_map_available_maps(const signature& sig, FunctionConsts::FunctionKind kind)174 zorba_store_unordered_maps_available_maps(const signature& sig, FunctionConsts::FunctionKind kind)
194 : 175 :
195 function(sig, kind)176 function(sig, kind)
196 {177 {
197178
198 }179 }
199180
200 bool accessesDynCtx() const { return true; }181 bool accessesDynCtx() const { return true; }
201182
202 CODEGEN_DECL();183 CODEGEN_DECL();
203};184};
204185
205186
206//zorba-store-data-structure-unordered-map:is-transient187//zorba-store-unordered-maps:options
207class zorba_store_data_structure_unordered_map_is_transient : public function188class zorba_store_unordered_maps_options : public function
208{189{
209public:190public:
210 zorba_store_data_structure_unordered_map_is_transient(const signature& sig, FunctionConsts::FunctionKind kind)191 zorba_store_unordered_maps_options(const signature& sig, FunctionConsts::FunctionKind kind)
211 : 192 :
212 function(sig, kind)193 function(sig, kind)
213 {194 {
214195
=== 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-09-02 20:59:05 +0000
@@ -444,16 +444,16 @@
444 ZORBA_STORE_DOCUMENTS_DOCUMENT_1,444 ZORBA_STORE_DOCUMENTS_DOCUMENT_1,
445 ZORBA_STORE_DOCUMENTS_AVAILABLE_DOCUMENTS_0,445 ZORBA_STORE_DOCUMENTS_AVAILABLE_DOCUMENTS_0,
446 ZORBA_STORE_DOCUMENTS_IS_AVAILABLE_DOCUMENT_1,446 ZORBA_STORE_DOCUMENTS_IS_AVAILABLE_DOCUMENT_1,
447 ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_N,447 ZORBA_STORE_UNORDERED_MAPS_CREATE_2,
448 ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_TRANSIENT_N,448 ZORBA_STORE_UNORDERED_MAPS_CREATE_3,
449 ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_DELETE_1,449 ZORBA_STORE_UNORDERED_MAPS_DROP_1,
450 ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_GET_N,450 ZORBA_STORE_UNORDERED_MAPS_GET_2,
451 ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_INSERT_N,451 ZORBA_STORE_UNORDERED_MAPS_INSERT_3,
452 ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_REMOVE_N,452 ZORBA_STORE_UNORDERED_MAPS_DELETE_2,
453 ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_KEYS_1,453 ZORBA_STORE_UNORDERED_MAPS_KEYS_1,
454 ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_SIZE_1,454 ZORBA_STORE_UNORDERED_MAPS_SIZE_1,
455 ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_AVAILABLE_MAPS_0,455 ZORBA_STORE_UNORDERED_MAPS_AVAILABLE_MAPS_0,
456 ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_IS_TRANSIENT_1,456 ZORBA_STORE_UNORDERED_MAPS_OPTIONS_1,
457 FN_CODEPOINTS_TO_STRING_1,457 FN_CODEPOINTS_TO_STRING_1,
458 FN_STRING_TO_CODEPOINTS_1,458 FN_STRING_TO_CODEPOINTS_1,
459 FN_COMPARE_2,459 FN_COMPARE_2,
460460
=== 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-09-02 20:59:05 +0000
@@ -48,7 +48,7 @@
4848
49 store::Item_t lKeyNodeName;49 store::Item_t lKeyNodeName;
50 GENV_ITEMFACTORY->createQName(lKeyNodeName,50 GENV_ITEMFACTORY->createQName(lKeyNodeName,
51 static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS,51 static_context::ZORBA_STORE_UNORDERED_MAPS_FN_NS,
52 "", "key");52 "", "key");
5353
54 IndexKeysIteratorState* state;54 IndexKeysIteratorState* state;
5555
=== 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-09-02 20:59:05 +0000
@@ -328,15 +328,14 @@
328 TYPE_AvailableDocumentsIterator,328 TYPE_AvailableDocumentsIterator,
329 TYPE_IsAvailableDocumentIterator,329 TYPE_IsAvailableDocumentIterator,
330 TYPE_MapCreateIterator,330 TYPE_MapCreateIterator,
331 TYPE_MapCreateTransientIterator,331 TYPE_MapDropIterator,
332 TYPE_MapDestroyIterator,
333 TYPE_MapGetIterator,332 TYPE_MapGetIterator,
334 TYPE_MapInsertIterator,333 TYPE_MapInsertIterator,
335 TYPE_MapRemoveIterator,334 TYPE_MapDeleteIterator,
336 TYPE_MapKeysIterator,335 TYPE_MapKeysIterator,
337 TYPE_MapSizeIterator,336 TYPE_MapSizeIterator,
338 TYPE_AvailableMapsIterator,337 TYPE_AvailableMapsIterator,
339 TYPE_MapIsTransientIterator,338 TYPE_MapOptionsIterator,
340 TYPE_CodepointsToStringIterator,339 TYPE_CodepointsToStringIterator,
341 TYPE_StringToCodepointsIterator,340 TYPE_StringToCodepointsIterator,
342 TYPE_CompareStrIterator,341 TYPE_CompareStrIterator,
343342
=== modified file 'src/runtime/spec/mappings.xml'
--- src/runtime/spec/mappings.xml 2013-08-30 17:45:50 +0000
+++ src/runtime/spec/mappings.xml 2013-09-02 20:59:05 +0000
@@ -73,8 +73,8 @@
73 prefix="zorba-store-documents"/>73 prefix="zorba-store-documents"/>
7474
75 <zorba:namespace75 <zorba:namespace
76 uri="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"76 uri="http://zorba.io/modules/unordered-maps"
77 prefix="zorba-store-data-structure-unordered-map"/>77 prefix="zorba-store-unordered-maps"/>
7878
79 <zorba:namespace79 <zorba:namespace
80 uri="http://zorba.io/modules/full-text"80 uri="http://zorba.io/modules/full-text"
8181
=== 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-09-02 20:59:05 +0000
@@ -33,66 +33,41 @@
3333
34 <zorba:function>34 <zorba:function>
3535
36 <zorba:signature36 <zorba:signature localname="create" prefix="zorba-store-unordered-maps">
37 variadic="true"37 <zorba:param>xs:string</zorba:param> <!-- name of the hashmap -->
38 localname="create"38 <zorba:param>item()</zorba:param> <!-- list of key types -->
39 prefix="zorba-store-data-structure-unordered-map">39 <zorba:output>empty-sequence()</zorba:output>
40 <zorba:param>xs:QName</zorba:param> <!-- name of the hashmap -->40 </zorba:signature>
41 <zorba:param>xs:QName</zorba:param> <!-- list of key types -->41
42 <zorba:output>empty-sequence()</zorba:output>42 <zorba:signature localname="create" prefix="zorba-store-unordered-maps">
43 </zorba:signature>43 <zorba:param>xs:string</zorba:param> <!-- name of the hashmap -->
4444 <zorba:param>item()</zorba:param> <!-- list of key types -->
45 <zorba:methods>45 <zorba:param>object()</zorba:param> <!-- options object -->
46 <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/>46 <zorba:output>empty-sequence()</zorba:output>
47 <zorba:accessesDynCtx returnValue="true"/>47 </zorba:signature>
48 </zorba:methods>48
4949 <zorba:methods>
50 </zorba:function>50 <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/>
5151 <zorba:accessesDynCtx returnValue="true"/>
52</zorba:iterator>52 </zorba:methods>
5353
54<!--54 </zorba:function>
55/*******************************************************************************55
56********************************************************************************/56</zorba:iterator>
57-->57
58<zorba:iterator name="MapCreateTransientIterator" >58<!--
5959/*******************************************************************************
60 <zorba:description author="Matthias Brantner">60********************************************************************************/
61 </zorba:description>61-->
6262<zorba:iterator name="MapDropIterator" >
63 <zorba:function> 63
6464 <zorba:description author="Matthias Brantner">
65 <zorba:signature65 </zorba:description>
66 variadic="true"66
67 localname="create-transient"67 <zorba:function>
68 prefix="zorba-store-data-structure-unordered-map">68
69 <zorba:param>xs:QName</zorba:param> <!-- name of the hashmap -->69 <zorba:signature localname="drop" prefix="zorba-store-unordered-maps">
70 <zorba:param>xs:QName</zorba:param> <!-- list of key types -->70 <zorba:param>xs:string</zorba:param>
71 <zorba:output>empty-sequence()</zorba:output>
72 </zorba:signature>
73
74 <zorba:methods>
75 <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/>
76 <zorba:accessesDynCtx returnValue="true"/>
77 </zorba:methods>
78
79 </zorba:function>
80
81</zorba:iterator>
82
83<!--
84/*******************************************************************************
85********************************************************************************/
86-->
87<zorba:iterator name="MapDestroyIterator" >
88
89 <zorba:description author="Matthias Brantner">
90 </zorba:description>
91
92 <zorba:function>
93
94 <zorba:signature localname="delete" prefix="zorba-store-data-structure-unordered-map">
95 <zorba:param>xs:QName</zorba:param>
96 <zorba:output>empty-sequence()</zorba:output>71 <zorba:output>empty-sequence()</zorba:output>
97 </zorba:signature>72 </zorba:signature>
9873
@@ -116,9 +91,9 @@
11691
117 <zorba:function> 92 <zorba:function>
11893
119 <zorba:signature variadic="true" localname="get" prefix="zorba-store-data-structure-unordered-map">94 <zorba:signature localname="get" prefix="zorba-store-unordered-maps">
120 <zorba:param>xs:QName</zorba:param>95 <zorba:param>xs:string</zorba:param>
121 <zorba:param>xs:anyAtomicType?</zorba:param>96 <zorba:param>item()</zorba:param>
122 <zorba:output>item()*</zorba:output>97 <zorba:output>item()*</zorba:output>
123 </zorba:signature>98 </zorba:signature>
12499
@@ -146,10 +121,10 @@
146121
147 <zorba:function> 122 <zorba:function>
148123
149 <zorba:signature variadic="true" localname="insert" prefix="zorba-store-data-structure-unordered-map">124 <zorba:signature localname="insert" prefix="zorba-store-unordered-maps">
150 <zorba:param>xs:QName</zorba:param>125 <zorba:param>xs:string</zorba:param>
151 <zorba:param>item()*</zorba:param> <!-- value -->126 <zorba:param>item()</zorba:param>
152 <zorba:param>xs:anyAtomicType?</zorba:param> <!-- list of keys -->127 <zorba:param>item()*</zorba:param>
153 <zorba:output>empty-sequence()</zorba:output>128 <zorba:output>empty-sequence()</zorba:output>
154 </zorba:signature>129 </zorba:signature>
155130
@@ -167,7 +142,7 @@
167/*******************************************************************************142/*******************************************************************************
168********************************************************************************/143********************************************************************************/
169-->144-->
170<zorba:iterator name="MapRemoveIterator" >145<zorba:iterator name="MapDeleteIterator" >
171146
172 <zorba:description author="Matthias Brantner">147 <zorba:description author="Matthias Brantner">
173 </zorba:description>148 </zorba:description>
@@ -175,12 +150,11 @@
175 <zorba:function> 150 <zorba:function>
176151
177 <zorba:signature152 <zorba:signature
178 variadic="true"153 localname="delete"
179 localname="remove"154 prefix="zorba-store-unordered-maps">
180 prefix="zorba-store-data-structure-unordered-map">
181155
182 <zorba:param>xs:QName</zorba:param>156 <zorba:param>xs:string</zorba:param>
183 <zorba:param>xs:anyAtomicType?</zorba:param>157 <zorba:param>item()</zorba:param>
184 <zorba:output>empty-sequence()</zorba:output>158 <zorba:output>empty-sequence()</zorba:output>
185 </zorba:signature>159 </zorba:signature>
186160
@@ -204,9 +178,9 @@
204178
205 <zorba:function> 179 <zorba:function>
206180
207 <zorba:signature localname="keys" prefix="zorba-store-data-structure-unordered-map">181 <zorba:signature localname="keys" prefix="zorba-store-unordered-maps">
208 <zorba:param>xs:QName</zorba:param>182 <zorba:param>xs:string</zorba:param>
209 <zorba:output>node()*</zorba:output>183 <zorba:output>array()*</zorba:output>
210 </zorba:signature>184 </zorba:signature>
211185
212 <zorba:methods>186 <zorba:methods>
@@ -219,8 +193,6 @@
219 <zorba:member type="store::Index::KeyIterator_t" name="theIter"/>193 <zorba:member type="store::Index::KeyIterator_t" name="theIter"/>
220 </zorba:state>194 </zorba:state>
221195
222 <zorba:member type="store::NsBindings" name="theNSBindings" brief=""/>
223
224</zorba:iterator>196</zorba:iterator>
225197
226<!--198<!--
@@ -234,8 +206,8 @@
234206
235 <zorba:function> 207 <zorba:function>
236208
237 <zorba:signature localname="size" prefix="zorba-store-data-structure-unordered-map">209 <zorba:signature localname="size" prefix="zorba-store-unordered-maps">
238 <zorba:param>xs:QName</zorba:param>210 <zorba:param>xs:string</zorba:param>
239 <zorba:output>xs:integer</zorba:output>211 <zorba:output>xs:integer</zorba:output>
240 </zorba:signature>212 </zorba:signature>
241213
@@ -258,8 +230,8 @@
258230
259 <zorba:function> 231 <zorba:function>
260232
261 <zorba:signature localname="available-maps" prefix="zorba-store-data-structure-unordered-map">233 <zorba:signature localname="available-maps" prefix="zorba-store-unordered-maps">
262 <zorba:output>xs:QName*</zorba:output>234 <zorba:output>xs:string*</zorba:output>
263 </zorba:signature>235 </zorba:signature>
264236
265 <zorba:methods>237 <zorba:methods>
@@ -285,16 +257,16 @@
285/*******************************************************************************257/*******************************************************************************
286********************************************************************************/258********************************************************************************/
287-->259-->
288<zorba:iterator name="MapIsTransientIterator" >260<zorba:iterator name="MapOptionsIterator" >
289261
290 <zorba:description author="Matthias Brantner">262 <zorba:description author="Matthias Brantner">
291 </zorba:description>263 </zorba:description>
292264
293 <zorba:function> 265 <zorba:function>
294266
295 <zorba:signature localname="is-transient" prefix="zorba-store-data-structure-unordered-map">267 <zorba:signature localname="options" prefix="zorba-store-unordered-maps">
296 <zorba:param>xs:QName</zorba:param>268 <zorba:param>xs:string</zorba:param>
297 <zorba:output>xs:boolean</zorba:output>269 <zorba:output>object()</zorba:output>
298 </zorba:signature>270 </zorba:signature>
299271
300 <zorba:methods>272 <zorba:methods>
301273
=== 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-09-02 20:59:05 +0000
@@ -49,6 +49,29 @@
4949
50/*******************************************************************************50/*******************************************************************************
51********************************************************************************/51********************************************************************************/
52zstring
53getMapURI(
54 const static_context* sctx,
55 const QueryLoc& aLoc)
56{
57 return "http://zorba.io/maps";
58}
59
60/*******************************************************************************
61********************************************************************************/
62void
63createMapQName(
64 store::Item_t& name,
65 const static_context* sctx,
66 const QueryLoc& loc)
67{
68 GENV_ITEMFACTORY->createQName(name, getMapURI(sctx, loc),
69 "", name->getStringValue());
70}
71
72
73/*******************************************************************************
74********************************************************************************/
52void75void
53castOrCheckIndexType(76castOrCheckIndexType(
54 store::Item_t& aKeyItem,77 store::Item_t& aKeyItem,
@@ -100,6 +123,214 @@
100/*******************************************************************************123/*******************************************************************************
101********************************************************************************/124********************************************************************************/
102void125void
126createKeysArray(
127 store::IndexKey& aKey,
128 store::Item_t& aArray)
129{
130 std::vector<store::Item_t> lValues;
131 lValues.reserve(aKey.size());
132
133 size_t i = 1;
134
135 // build [ key1, null, key3 ]
136 for (store::ItemVector::iterator lIter = aKey.begin();
137 lIter != aKey.end();
138 ++lIter, ++i)
139 {
140 lValues.resize(i);
141
142 store::Item_t lValue = *lIter;
143 if (lValue)
144 {
145 lValues[i - 1] = (*lIter);
146 }
147 else
148 {
149 GENV_ITEMFACTORY->createJSONNull(lValues[i - 1]);
150 }
151 }
152
153 GENV_ITEMFACTORY->createJSONArray(aArray, lValues);
154}
155
156
157/*******************************************************************************
158********************************************************************************/
159void
160processTypes(
161 const store::Item_t& aMapName,
162 const QueryLoc& loc,
163 std::vector<store::Item_t>& aTypes)
164{
165 for (size_t i = 0; i < aTypes.size(); ++i)
166 {
167 store::Item_t& lType = aTypes[i];
168
169 if (!lType->isAtomic())
170 {
171 RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc,
172 ERROR_PARAMS(*(GENV_TYPESYSTEM.create_value_type(lType)),
173 "anyAtomicType",
174 aMapName->getStringValue()));
175 }
176
177 if (TypeOps::is_subtype(lType->getTypeCode(), store::XS_STRING))
178 {
179 zstring t = lType->getStringValue();
180 std::transform(t.begin(), t.end(), t.begin(), zorba::unicode::to_lower);
181 if (t == "string")
182 lType = GENV_TYPESYSTEM.XS_STRING_QNAME;
183 else if (t == "integer")
184 lType = GENV_TYPESYSTEM.XS_INTEGER_QNAME;
185 else if (t == "boolean")
186 lType = GENV_TYPESYSTEM.XS_BOOLEAN_QNAME;
187 else if (t == "datetime")
188 lType = GENV_TYPESYSTEM.XS_DATETIME_QNAME;
189 else if (t == "date")
190 lType = GENV_TYPESYSTEM.XS_DATE_QNAME;
191 else if (t == "time")
192 lType = GENV_TYPESYSTEM.XS_TIME_QNAME;
193 else if (t == "duration")
194 lType = GENV_TYPESYSTEM.XS_DURATION_QNAME;
195 else if (t == "daytimeduration")
196 lType = GENV_TYPESYSTEM.XS_DT_DURATION_QNAME;
197 else if (t == "yearmonthduration")
198 lType = GENV_TYPESYSTEM.XS_YM_DURATION_QNAME;
199 else if (t == "float")
200 lType = GENV_TYPESYSTEM.XS_FLOAT_QNAME;
201 else if (t == "double")
202 lType = GENV_TYPESYSTEM.XS_DOUBLE_QNAME;
203 else if (t == "decimal")
204 lType = GENV_TYPESYSTEM.XS_DECIMAL_QNAME;
205 else if (t == "long")
206 lType = GENV_TYPESYSTEM.XS_LONG_QNAME;
207 else if (t == "int")
208 lType = GENV_TYPESYSTEM.XS_INT_QNAME;
209 else if (t == "short")
210 lType = GENV_TYPESYSTEM.XS_SHORT_QNAME;
211 else if (t == "byte")
212 lType = GENV_TYPESYSTEM.XS_BYTE_QNAME;
213 else if (t == "base64binary")
214 lType = GENV_TYPESYSTEM.XS_BASE64BINARY_QNAME;
215 else if (t == "hexbinary")
216 lType = GENV_TYPESYSTEM.XS_HEXBINARY_QNAME;
217 else if (t == "null")
218 lType = GENV_TYPESYSTEM.JS_NULL_QNAME;
219 else
220 RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc,
221 ERROR_PARAMS(t,
222 "anyAtomicType",
223 aMapName->getStringValue()));
224 }
225 else if (!TypeOps::is_subtype(lType->getTypeCode(), store::XS_QNAME))
226 {
227 RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc,
228 ERROR_PARAMS(*(GENV_TYPESYSTEM.create_value_type(lType)),
229 "QName",
230 aMapName->getStringValue()));
231 }
232 }
233}
234
235/*******************************************************************************
236********************************************************************************/
237bool
238prepareKeyAttributes(
239 const QueryLoc& loc,
240 const static_context* sctx,
241 const store::Item_t& aKey,
242 store::Index* aMap,
243 std::vector<store::Item_t>& aKeyAttrs)
244{
245 if (aKey->isArray())
246 {
247 ulong lNumKeys = to_xs_long(aKey->getArraySize());
248 aKeyAttrs.resize(lNumKeys);
249 for (size_t i = 0; i < lNumKeys; ++i)
250 {
251 aKeyAttrs[i] = aKey->getArrayValue(xs_integer(i+1));
252 }
253 }
254 else
255 {
256 aKeyAttrs.push_back(aKey);
257 }
258
259 const store::IndexSpecification& lSpec = aMap->getSpecification();
260
261 store::Item_t lName = aMap->getName();
262
263 if (lSpec.getNumColumns() != aKeyAttrs.size())
264 {
265 RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
266 ERROR_PARAMS(lName->getLocalName(),
267 "map",
268 aKeyAttrs.size(),
269 lSpec.getNumColumns()));
270 }
271
272 bool lValidProbe = true;
273
274 for (size_t i = 0; i < aKeyAttrs.size(); ++i)
275 {
276 store::Item_t& lTmp = aKeyAttrs[i];
277
278 if (! lTmp->isAtomic())
279 {
280 store::Item_t lVal;
281 store::Iterator_t lValIter;
282 lTmp->getTypedValue(lVal, lValIter);
283 if (! lValIter.isNull())
284 {
285 RAISE_ERROR(err::XPTY0004, loc,
286 ERROR_PARAMS(ZED(XPTY0004_NoMultiSeqTypePromotion_2),
287 lSpec.theKeyTypes.at(i)));
288 }
289 lTmp = lVal;
290 }
291
292 namespace_context tmp_ctx(sctx);
293 castOrCheckIndexType(lTmp, lSpec.theKeyTypes[i], lName, &tmp_ctx, loc);
294
295 if (lTmp == NULL ||
296 (lTmp->isAtomic() && lTmp->getTypeCode() == store::JS_NULL))
297 {
298 lValidProbe = false;
299 }
300 }
301 return lValidProbe;
302}
303
304
305/*******************************************************************************
306********************************************************************************/
307void
308processOption(
309 const QueryLoc& loc,
310 const store::Item_t& aOption,
311 bool& aIsPersistent)
312{
313 assert(aOption->isObject());
314 zstring lTmp("persistent");
315
316 store::Item_t lPersistentItem;
317 GENV_ITEMFACTORY->createString(lPersistentItem, lTmp);
318
319 lPersistentItem = aOption->getObjectValue(lPersistentItem);
320 if (!lPersistentItem->isAtomic()
321 || lPersistentItem->getTypeCode() != store::XS_BOOLEAN)
322 {
323 RAISE_ERROR(zerr::ZDDY0043_INVALID_OPTION_TYPE,
324 loc, ERROR_PARAMS(
325 lPersistentItem->getType()->getLocalName(), "persistent", "boolean"));
326 }
327 aIsPersistent = lPersistentItem->getBooleanValue();
328}
329
330
331/*******************************************************************************
332********************************************************************************/
333void
103checkMapTypes(334checkMapTypes(
104 std::vector<store::Item_t>& aTypes,335 std::vector<store::Item_t>& aTypes,
105 const store::Item_t& aMapName,336 const store::Item_t& aMapName,
@@ -135,13 +366,14 @@
135 const store::Item_t& aName,366 const store::Item_t& aName,
136 const QueryLoc& aLoc,367 const QueryLoc& aLoc,
137 dynamic_context* aContext,368 dynamic_context* aContext,
138 store::Index*& aIndex)369 store::Index*& aIndex,
370 bool aLookupParent = true)
139{371{
140 aIndex = GENV_STORE.getMap(aName);372 aIndex = GENV_STORE.getMap(aName);
141373
142 if (aIndex) return true;374 if (aIndex) return true;
143375
144 aIndex = aContext->getMap(aName.getp());376 aIndex = aContext->getMap(aName.getp(), aLookupParent);
145377
146 if (!aIndex)378 if (!aIndex)
147 {379 {
@@ -164,124 +396,105 @@
164 store::Item_t& result,396 store::Item_t& result,
165 PlanState& aPlanState) const397 PlanState& aPlanState) const
166{398{
167 store::Item_t lQName;399 store::Item_t lName;
400 store::Item_t lTypeParam;
168 std::vector<store::Item_t> lTypes;401 std::vector<store::Item_t> lTypes;
169 std::vector<zstring> lCollations;402 bool lPersistent = true;
170 std::auto_ptr<store::PUL> lPul;403
171 long lTimezone = 0;404 PlanIteratorState* state;
172405 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
173 PlanIteratorState* state;406
174 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);407 consumeNext(lName, theChildren[0].getp(), aPlanState);
175408 createMapQName(lName, theSctx, loc);
176 consumeNext(lQName, theChildren[0].getp(), aPlanState);409
177410 if (GENV_STORE.getMap(lName)
178 if (GENV_STORE.getMap(lQName)411 || aPlanState.theLocalDynCtx->getMap(lName.getp()))
179 || aPlanState.theLocalDynCtx->getMap(lQName.getp()))412 {
180 {413 RAISE_ERROR(
181 RAISE_ERROR(414 zerr::ZSTR0001_INDEX_ALREADY_EXISTS,
182 zerr::ZSTR0001_INDEX_ALREADY_EXISTS,415 loc,
183 loc,416 ERROR_PARAMS( lName->getStringValue() )
184 ERROR_PARAMS( lQName->getStringValue() )417 );
185 );418 }
186 }419
187420 consumeNext(lTypeParam, theChildren[1].getp(), aPlanState);
188 lCollations.resize(theChildren.size() - 1);421
189 lTypes.resize(theChildren.size() - 1);422 if (lTypeParam->isArray())
190423 {
191 for (size_t i = 1; i < theChildren.size(); ++i)424 long lSize = to_xs_long(lTypeParam->getArraySize());
192 {425 lTypes.resize(lSize);
193 consumeNext(lTypes[i-1], theChildren[i].getp(), aPlanState);426 for (long i = 1; i <= lSize; ++i)
194 }427 {
195428 lTypes[i-1] = lTypeParam->getArrayValue(xs_integer(i));
196 checkMapTypes(lTypes, lQName, loc);429 }
197430 }
198 lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList());431 else
199 lPul->addCreateHashMap(&loc, lQName, lTypes, lCollations, lTimezone);432 {
200433 lTypes.push_back(lTypeParam);
201 apply_updates(434 }
202 aPlanState.theCompilerCB,435
203 aPlanState.theGlobalDynCtx,436 if (theChildren.size() == 3)
204 theSctx,437 {
205 lPul.get(),438 store::Item_t lOptions;
206 loc);439 consumeNext(lOptions, theChildren[2].getp(), aPlanState);
207440 processOption(loc, lOptions, lPersistent);
208 result = NULL;441 }
209442
210 STACK_END(state);443 processTypes(lName, loc, lTypes);
211}444 checkMapTypes(lTypes, lName, loc);
212445
213446 if (lPersistent)
214/*******************************************************************************447 {
215********************************************************************************/448 std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());
216bool449 std::vector<zstring> lCollations(lTypes.size());
217MapCreateTransientIterator::nextImpl(450 lPul->addCreateHashMap(&loc, lName, lTypes, lCollations, 0);
218 store::Item_t& result,451
219 PlanState& aPlanState) const452 apply_updates(
220{453 aPlanState.theCompilerCB,
221 store::Item_t lQName;454 aPlanState.theGlobalDynCtx,
222 store::IndexSpecification lSpec;455 theSctx,
223 store::Index_t lIndex;456 lPul.get(),
224 std::vector<std::string> lCollations;457 loc);
225458 }
226 PlanIteratorState* state;459 else
227 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);460 {
228461 store::IndexSpecification lSpec;
229 consumeNext(lQName, theChildren[0].getp(), aPlanState);462 lSpec.theKeyTypes.swap(lTypes);
230463 lSpec.theNumKeyColumns = lSpec.theKeyTypes.size();
231 if (GENV_STORE.getMap(lQName)464 lSpec.theIsTemp = true;
232 || aPlanState.theLocalDynCtx->getMap(lQName.getp()))465 lSpec.theCollations.resize(lSpec.theKeyTypes.size());
233 {466 lSpec.theTimezone = 0;
234 RAISE_ERROR(467 store::Index_t lMap = GENV_STORE.createMap(lName, lSpec);
235 zerr::ZSTR0001_INDEX_ALREADY_EXISTS,468
236 loc,469 aPlanState.theLocalDynCtx->bindMap(lMap->getName(), lMap);
237 ERROR_PARAMS( lQName->getStringValue() )470 }
238 );471
239 }472 result = NULL;
240473
241 lCollations.resize(theChildren.size() - 1);474 STACK_END(state);
242 lSpec.theKeyTypes.resize(theChildren.size() - 1);475}
243476
244 for (size_t i = 1; i < theChildren.size(); ++i)477
245 {478/*******************************************************************************
246 consumeNext(lSpec.theKeyTypes[i-1], theChildren[i].getp(), aPlanState);479********************************************************************************/
247 }480bool
248481MapDropIterator::nextImpl(
249 checkMapTypes(lSpec.theKeyTypes, lQName, loc);482 store::Item_t& result,
250483 PlanState& aPlanState) const
251 lSpec.theNumKeyColumns = lSpec.theKeyTypes.size();484{
252 lSpec.theIsTemp = true;485 store::Item_t lName;
253 lSpec.theCollations = lCollations;
254 lSpec.theTimezone = 0;
255
256 lIndex = GENV_STORE.createMap(lQName, lSpec);
257
258 aPlanState.theLocalDynCtx->bindMap(lIndex->getName(), lIndex);
259
260 result = NULL;
261
262 STACK_END(state);
263}
264
265
266/*******************************************************************************
267********************************************************************************/
268bool
269MapDestroyIterator::nextImpl(
270 store::Item_t& result,
271 PlanState& aPlanState) const
272{
273 store::Item_t lQName;
274 store::Index* lIndex;486 store::Index* lIndex;
275487
276 PlanIteratorState* state;488 PlanIteratorState* state;
277 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);489 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
278490
279 consumeNext(lQName, theChildren[0].getp(), aPlanState);491 consumeNext(lName, theChildren[0].getp(), aPlanState);
492 createMapQName(lName, theSctx, loc);
280493
281 if (getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex))494 if (getMap(lName, loc, aPlanState.theLocalDynCtx, lIndex, false))
282 {495 {
283 std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());496 std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());
284 lPul->addDestroyHashMap(&loc, lQName);497 lPul->addDestroyHashMap(&loc, lName);
285498
286 apply_updates(499 apply_updates(
287 aPlanState.theCompilerCB,500 aPlanState.theCompilerCB,
@@ -292,7 +505,7 @@
292 }505 }
293 else506 else
294 {507 {
295 aPlanState.theLocalDynCtx->unbindMap(lQName.getp());508 aPlanState.theLocalDynCtx->unbindMap(lName.getp());
296 }509 }
297510
298 result = NULL;511 result = NULL;
@@ -300,6 +513,7 @@
300 STACK_END(state);513 STACK_END(state);
301}514}
302515
516
303/*******************************************************************************517/*******************************************************************************
304********************************************************************************/518********************************************************************************/
305bool519bool
@@ -307,55 +521,35 @@
307 store::Item_t& result,521 store::Item_t& result,
308 PlanState& aPlanState) const522 PlanState& aPlanState) const
309{523{
310 store::Item_t lQName;524 store::Item_t lName;
311 std::vector<store::Item_t> lKey;525 store::Item_t lKey;
312 store::Index* lIndex;526 std::vector<store::Item_t> lKeyAttrs;
313 ulong i;527 store::Index* lMap;
314 store::Item_t lKeyItem;
315 store::IndexSpecification lSpec;528 store::IndexSpecification lSpec;
529 bool lValidProbe;
316530
317 MapGetIteratorState* state;531 MapGetIteratorState* state;
318 DEFAULT_STACK_INIT(MapGetIteratorState, state, aPlanState);532 DEFAULT_STACK_INIT(MapGetIteratorState, state, aPlanState);
319533
320 consumeNext(lQName, theChildren[0].getp(), aPlanState);534 consumeNext(lName, theChildren[0].getp(), aPlanState);
321535 createMapQName(lName, theSctx, loc);
322 getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);536
323537 getMap(lName, loc, aPlanState.theLocalDynCtx, lMap);
324 lSpec = lIndex->getSpecification();538
325539 consumeNext(lKey, theChildren[1].getp(), aPlanState);
326 if (lSpec.getNumColumns() != theChildren.size() - 1)540
327 {541 state->theCond = lMap->createCondition(store::IndexCondition::POINT_VALUE);
328 RAISE_ERROR(542 lValidProbe = prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs);
329 zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS,543
330 loc,544 if (lValidProbe)
331 ERROR_PARAMS(545 {
332 lQName->getStringValue(),546 for (size_t i = 0; i < lKeyAttrs.size(); ++i)
333 "map",
334 theChildren.size() - 1,
335 lSpec.getNumColumns() )
336 );
337 }
338
339 state->theCond = lIndex->createCondition(store::IndexCondition::POINT_VALUE);
340
341 for (i = 1; i < theChildren.size(); ++i)
342 {
343 if (!consumeNext(lKeyItem, theChildren[i], aPlanState))
344 {547 {
345 // Return the empty seq if any of the search key items is the empty seq.548 state->theCond->pushItem(lKeyAttrs[i]);
346 break;
347 }549 }
348550
349 namespace_context tmp_ctx(theSctx);
350 castOrCheckIndexType(lKeyItem, lSpec.theKeyTypes[i-1], lQName, &tmp_ctx, loc);
351
352 state->theCond->pushItem(lKeyItem);
353 }
354
355 if (i == theChildren.size())
356 {
357 state->theIter = GENV_STORE.getIteratorFactory()->551 state->theIter = GENV_STORE.getIteratorFactory()->
358 createIndexProbeIterator(lIndex);552 createIndexProbeIterator(lMap);
359553
360 state->theIter->init(state->theCond);554 state->theIter->init(state->theCond);
361 state->theIter->open();555 state->theIter->open();
@@ -377,53 +571,31 @@
377 store::Item_t& result,571 store::Item_t& result,
378 PlanState& aPlanState) const572 PlanState& aPlanState) const
379{573{
380 store::Item_t lQName;574 store::Item_t lName;
381 std::vector<store::Item_t> lKey;575 store::Item_t lKey;
382 store::IndexSpecification lSpec;576 std::vector<store::Item_t> lKeyAttrs;
383 store::Index* lIndex;577 store::Index* lMap;
384 bool lPersistent;578 bool lPersistent;
385579
386 PlanIteratorState* state;580 PlanIteratorState* state;
387 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);581 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
388582
389 consumeNext(lQName, theChildren[0].getp(), aPlanState);583 consumeNext(lName, theChildren[0].getp(), aPlanState);
390584 createMapQName(lName, theSctx, loc);
391 lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);585
392586 lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap);
393 lSpec = lIndex->getSpecification();587
394588 consumeNext(lKey, theChildren[1].getp(), aPlanState);
395 if (lSpec.getNumColumns() != theChildren.size() - 2)589
396 {590 prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs);
397 RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
398 ERROR_PARAMS(lQName->getStringValue(),
399 "map",
400 theChildren.size() - 2,
401 lSpec.getNumColumns()));
402 }
403
404 lKey.resize(theChildren.size() - 2);
405 for (size_t i = 2; i < theChildren.size(); ++i)
406 {
407 if (consumeNext(lKey[i-2], theChildren[i].getp(), aPlanState))
408 {
409 namespace_context tmp_ctx(theSctx);
410 castOrCheckIndexType(
411 lKey[i-2],
412 lSpec.theKeyTypes[i-2],
413 lQName,
414 &tmp_ctx,
415 loc);
416 }
417 }
418591
419 if (lPersistent)592 if (lPersistent)
420 {593 {
421 std::auto_ptr<store::PUL> lPul;
422 store::Iterator_t lValue594 store::Iterator_t lValue
423 = new PlanIteratorWrapper(theChildren[1], aPlanState);595 = new PlanIteratorWrapper(theChildren[2], aPlanState);
424596
425 lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList());597 std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());
426 lPul->addInsertIntoHashMap(&loc, lQName, lKey, lValue);598 lPul->addInsertIntoHashMap(&loc, lName, lKeyAttrs, lValue);
427599
428 apply_updates(600 apply_updates(
429 aPlanState.theCompilerCB,601 aPlanState.theCompilerCB,
@@ -435,18 +607,27 @@
435 else607 else
436 {608 {
437 store::Item_t lValue;609 store::Item_t lValue;
438 while (consumeNext(lValue, theChildren[1], aPlanState))610 while (consumeNext(lValue, theChildren[2], aPlanState))
439 {611 {
612 if ((lValue->isNode() || lValue->isArray() || lValue->isObject())
613 && lValue->getCollection() == 0)
614 {
615 zstring lType = "node";
616 if (lValue->isArray()) lType = "array";
617 else if (lValue->isObject()) lType = "object";
618
619 RAISE_ERROR(zerr::ZDDY0042_ITEM_NOT_IN_COLLECTION, loc,
620 ERROR_PARAMS(lName->getLocalName(), lType));
621 }
622
440 std::auto_ptr<store::IndexKey> k(new store::IndexKey());623 std::auto_ptr<store::IndexKey> k(new store::IndexKey());
441 for (std::vector<store::Item_t>::const_iterator lIter = lKey.begin();624 for (size_t i = 0; i < lKeyAttrs.size(); ++i)
442 lIter != lKey.end();
443 ++lIter)
444 {625 {
445 k->push_back(*lIter);626 k->push_back(lKeyAttrs[i]);
446 }627 }
447628
448 store::IndexKey* lKeyPtr = k.get();629 store::IndexKey* lKeyPtr = k.get();
449 if (!lIndex->insert(lKeyPtr, lValue))630 if (!lMap->insert(lKeyPtr, lValue))
450 {631 {
451 // the index took the ownership over the key if the index632 // the index took the ownership over the key if the index
452 // did _not_ already contain an entry with the same key633 // did _not_ already contain an entry with the same key
@@ -464,51 +645,32 @@
464/*******************************************************************************645/*******************************************************************************
465********************************************************************************/646********************************************************************************/
466bool647bool
467MapRemoveIterator::nextImpl(648MapDeleteIterator::nextImpl(
468 store::Item_t& result,649 store::Item_t& result,
469 PlanState& aPlanState) const650 PlanState& aPlanState) const
470{651{
471 store::Item_t lQName;652 store::Item_t lName;
472 std::vector<store::Item_t> lKey;653 store::Item_t lKey;
473 store::Index* lIndex;654 std::vector<store::Item_t> lKeyAttrs;
474 ulong i;655 store::Index* lMap;
475 store::Item_t lKeyItem;
476 std::auto_ptr<store::PUL> lPul;
477 store::IndexSpecification lSpec;
478 bool lPersistent;656 bool lPersistent;
479657
480 PlanIteratorState* state;658 PlanIteratorState* state;
481 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);659 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
482660
483 consumeNext(lQName, theChildren[0].getp(), aPlanState);661 consumeNext(lName, theChildren[0].getp(), aPlanState);
484662 createMapQName(lName, theSctx, loc);
485 lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);663
486664 lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap);
487 lSpec = lIndex->getSpecification();665
488666 consumeNext(lKey, theChildren[1].getp(), aPlanState);
489 if (lSpec.getNumColumns() != theChildren.size() - 1)667
490 {668 prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs);
491 RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
492 ERROR_PARAMS(lQName->getStringValue(),
493 "map",
494 theChildren.size() - 1,
495 lSpec.getNumColumns()));
496 }
497
498 lKey.resize(theChildren.size()-1);
499 for (i = 1; i < theChildren.size(); ++i)
500 {
501 if (consumeNext(lKey[i-1], theChildren[i], aPlanState))
502 {
503 namespace_context tmp_ctx(theSctx);
504 castOrCheckIndexType(lKey[i-1], lSpec.theKeyTypes[i-1], lQName, &tmp_ctx, loc);
505 }
506 }
507669
508 if (lPersistent)670 if (lPersistent)
509 {671 {
510 lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList());672 std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());
511 lPul->addRemoveFromHashMap(&loc, lQName, lKey);673 lPul->addRemoveFromHashMap(&loc, lName, lKeyAttrs);
512674
513 apply_updates(675 apply_updates(
514 aPlanState.theCompilerCB,676 aPlanState.theCompilerCB,
@@ -520,14 +682,12 @@
520 else682 else
521 {683 {
522 store::IndexKey k;684 store::IndexKey k;
523 for (std::vector<store::Item_t>::const_iterator lIter = lKey.begin();685 for (size_t i = 0; i < lKeyAttrs.size(); ++i)
524 lIter != lKey.end();
525 ++lIter)
526 {686 {
527 k.push_back(*lIter);687 k.push_back(lKeyAttrs[i]);
528 }688 }
529 store::Item_t lValue;689 store::Item_t lValue;
530 lIndex->remove(&k, lValue, true);690 lMap->remove(&k, lValue, true);
531 }691 }
532692
533 result = NULL;693 result = NULL;
@@ -537,78 +697,33 @@
537697
538698
539/*******************************************************************************699/*******************************************************************************
540
541********************************************************************************/700********************************************************************************/
542bool701bool
543MapKeysIterator::nextImpl(702MapKeysIterator::nextImpl(
544 store::Item_t& result,703 store::Item_t& result,
545 PlanState& aPlanState) const704 PlanState& aPlanState) const
546{705{
547 store::Item_t lQName;706 store::Item_t lName;
548 store::Index* lIndex;707 store::Index* lIndex;
549 store::IndexKey lKey;708 store::IndexKey lKey;
550 store::Item_t lTypeName;709 store::Item_t lTypeName;
551 zstring lBaseURI =
552 static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS;
553
554 store::Item_t lKeyNodeName;
555 GENV_ITEMFACTORY->createQName(lKeyNodeName,
556 static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS,
557 "", "key");
558710
559 MapKeysIteratorState* state;711 MapKeysIteratorState* state;
560 DEFAULT_STACK_INIT(MapKeysIteratorState, state, aPlanState);712 DEFAULT_STACK_INIT(MapKeysIteratorState, state, aPlanState);
561713
562 consumeNext(lQName, theChildren[0].getp(), aPlanState);714 consumeNext(lName, theChildren[0].getp(), aPlanState);
715 createMapQName(lName, theSctx, loc);
563716
564 getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);717 getMap(lName, loc, aPlanState.theLocalDynCtx, lIndex);
565718
566 state->theIter = lIndex->keys();719 state->theIter = lIndex->keys();
567720
568 state->theIter->open();721 state->theIter->open();
569722
570 // generate result elements of the form
571 // <key>
572 // <attribute value="key1_value"/>
573 // <attribute value="key2_value"/>
574 // <attribute value="key3_value"/>
575 // </key>
576 while (state->theIter->next(lKey))723 while (state->theIter->next(lKey))
577 {724 {
578 lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;725 createKeysArray(lKey, result);
579726
580 GENV_ITEMFACTORY->createElementNode(
581 result, NULL, lKeyNodeName, lTypeName,
582 true, false, theNSBindings, lBaseURI);
583
584 for (store::ItemVector::iterator lIter = lKey.begin();
585 lIter != lKey.end();
586 ++lIter)
587 {
588 store::Item_t lAttrElem, lAttrNodeName;
589 store::Item_t lNameAttr, lValueAttr, lValueAttrName;
590
591 GENV_ITEMFACTORY->createQName(lAttrNodeName,
592 static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS,
593 "", "attribute");
594
595 lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME;
596
597 GENV_ITEMFACTORY->createElementNode(
598 lAttrElem, result, lAttrNodeName, lTypeName,
599 true, false, theNSBindings, lBaseURI);
600
601 store::Item_t& lValue = (*lIter);
602 if (! lValue.isNull())
603 {
604 GENV_ITEMFACTORY->createQName(lValueAttrName, "", "", "value");
605
606 lTypeName = lValue->getType();
607
608 GENV_ITEMFACTORY->createAttributeNode(
609 lValueAttr, lAttrElem.getp(), lValueAttrName, lTypeName, lValue);
610 }
611 }
612 STACK_PUSH(true, state);727 STACK_PUSH(true, state);
613 }728 }
614729
@@ -623,17 +738,18 @@
623 store::Item_t& result,738 store::Item_t& result,
624 PlanState& aPlanState) const739 PlanState& aPlanState) const
625{740{
626 store::Item_t lQName;741 store::Item_t lName;
627 store::Index* lIndex;742 store::Index* lMap;
628743
629 PlanIteratorState* state;744 PlanIteratorState* state;
630 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);745 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
631746
632 consumeNext(lQName, theChildren[0].getp(), aPlanState);747 consumeNext(lName, theChildren[0].getp(), aPlanState);
633748 createMapQName(lName, theSctx, loc);
634 getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);749
635750 getMap(lName, loc, aPlanState.theLocalDynCtx, lMap);
636 GENV_ITEMFACTORY->createInteger(result, xs_integer(lIndex->size()));751
752 GENV_ITEMFACTORY->createInteger(result, xs_integer(lMap->size()));
637753
638 STACK_PUSH(true, state);754 STACK_PUSH(true, state);
639755
@@ -642,7 +758,6 @@
642758
643759
644/*******************************************************************************760/*******************************************************************************
645
646********************************************************************************/761********************************************************************************/
647AvailableMapsIteratorState::~AvailableMapsIteratorState()762AvailableMapsIteratorState::~AvailableMapsIteratorState()
648{763{
@@ -676,16 +791,22 @@
676bool791bool
677AvailableMapsIterator::nextImpl(store::Item_t& result, PlanState& planState) const792AvailableMapsIterator::nextImpl(store::Item_t& result, PlanState& planState) const
678{793{
794 store::Item_t lNameItem;;
795 zstring lLocalName;
796
679 AvailableMapsIteratorState * state;797 AvailableMapsIteratorState * state;
680 store::Item_t nameItem;
681
682 DEFAULT_STACK_INIT(AvailableMapsIteratorState, state, planState);798 DEFAULT_STACK_INIT(AvailableMapsIteratorState, state, planState);
683799
684 for ((state->persistentMapNamesIter = GENV_STORE.listMapNames())->open ();800 for ((state->persistentMapNamesIter = GENV_STORE.listMapNames())->open ();
685 state->persistentMapNamesIter->next(nameItem); ) 801 state->persistentMapNamesIter->next(lNameItem); )
686 {802 {
687 result = nameItem;803 if (lNameItem->getNamespace() != getMapURI(theSctx, loc))
688 STACK_PUSH( true, state);804 {
805 continue;
806 }
807 lLocalName = lNameItem->getLocalName();
808 GENV_ITEMFACTORY->createString(result, lLocalName);
809 STACK_PUSH(true, state);
689 }810 }
690811
691 state->persistentMapNamesIter->close();812 state->persistentMapNamesIter->close();
@@ -696,7 +817,13 @@
696 state->transientMapNamesIter != state->transientMapNames.end();817 state->transientMapNamesIter != state->transientMapNames.end();
697 ++state->transientMapNamesIter)818 ++state->transientMapNamesIter)
698 {819 {
699 result = *state->transientMapNamesIter;820 lNameItem = *state->transientMapNamesIter;
821 if (lNameItem->getNamespace() != getMapURI(theSctx, loc))
822 {
823 continue;
824 }
825 lLocalName = lNameItem->getLocalName();
826 GENV_ITEMFACTORY->createString(result, lLocalName);
700 STACK_PUSH( true, state);827 STACK_PUSH( true, state);
701 }828 }
702829
@@ -707,22 +834,29 @@
707/*******************************************************************************834/*******************************************************************************
708********************************************************************************/835********************************************************************************/
709bool836bool
710MapIsTransientIterator::nextImpl(837MapOptionsIterator::nextImpl(
711 store::Item_t& result,838 store::Item_t& result,
712 PlanState& aPlanState) const839 PlanState& aPlanState) const
713{840{
714 store::Item_t lQName;841 store::Item_t lName;
715 store::Index* lIndex;842 store::Index* lMap;
716 bool lPersistent;843 bool lPersistent;
844 std::vector<store::Item_t> lNames(1);
845 std::vector<store::Item_t> lValues(1);
846 zstring lTmp("persistent");
717847
718 PlanIteratorState* state;848 PlanIteratorState* state;
719 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);849 DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
720850
721 consumeNext(lQName, theChildren[0].getp(), aPlanState);851 consumeNext(lName, theChildren[0].getp(), aPlanState);
722852 createMapQName(lName, theSctx, loc);
723 lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex);853
724854 lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap);
725 GENV_ITEMFACTORY->createBoolean(result, !lPersistent);855
856 GENV_ITEMFACTORY->createString(lNames[0], lTmp);
857 GENV_ITEMFACTORY->createBoolean(lValues[0], lPersistent);
858
859 GENV_ITEMFACTORY->createJSONObject(result, lNames, lValues);
726860
727 STACK_PUSH(true, state);861 STACK_PUSH(true, state);
728862
729863
=== 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-09-02 20:59:05 +0000
@@ -62,60 +62,32 @@
62// </MapCreateIterator>62// </MapCreateIterator>
6363
6464
65// <MapCreateTransientIterator>65// <MapDropIterator>
66SERIALIZABLE_CLASS_VERSIONS(MapCreateTransientIterator)66SERIALIZABLE_CLASS_VERSIONS(MapDropIterator)
6767
68void MapCreateTransientIterator::serialize(::zorba::serialization::Archiver& ar)68void MapDropIterator::serialize(::zorba::serialization::Archiver& ar)
69{69{
70 serialize_baseclass(ar,70 serialize_baseclass(ar,
71 (NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>*)this);71 (NaryBaseIterator<MapDropIterator, PlanIteratorState>*)this);
72}72}
7373
7474
75void MapCreateTransientIterator::accept(PlanIterVisitor& v) const75void MapDropIterator::accept(PlanIterVisitor& v) const
76{76{
77 v.beginVisit(*this);77 v.beginVisit(*this);
7878
79 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();79 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
80 std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();80 std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
81 for ( ; lIter != lEnd; ++lIter ){81 for ( ; lIter != lEnd; ++lIter ){
82 (*lIter)->accept(v);82 (*lIter)->accept(v);
83 }83 }
8484
85 v.endVisit(*this);85 v.endVisit(*this);
86}86}
8787
88MapCreateTransientIterator::~MapCreateTransientIterator() {}88MapDropIterator::~MapDropIterator() {}
8989
90// </MapCreateTransientIterator>90// </MapDropIterator>
91
92
93// <MapDestroyIterator>
94SERIALIZABLE_CLASS_VERSIONS(MapDestroyIterator)
95
96void MapDestroyIterator::serialize(::zorba::serialization::Archiver& ar)
97{
98 serialize_baseclass(ar,
99 (NaryBaseIterator<MapDestroyIterator, PlanIteratorState>*)this);
100}
101
102
103void MapDestroyIterator::accept(PlanIterVisitor& v) const
104{
105 v.beginVisit(*this);
106
107 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
108 std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
109 for ( ; lIter != lEnd; ++lIter ){
110 (*lIter)->accept(v);
111 }
112
113 v.endVisit(*this);
114}
115
116MapDestroyIterator::~MapDestroyIterator() {}
117
118// </MapDestroyIterator>
11991
12092
121// <MapGetIterator>93// <MapGetIterator>
@@ -186,17 +158,17 @@
186// </MapInsertIterator>158// </MapInsertIterator>
187159
188160
189// <MapRemoveIterator>161// <MapDeleteIterator>
190SERIALIZABLE_CLASS_VERSIONS(MapRemoveIterator)162SERIALIZABLE_CLASS_VERSIONS(MapDeleteIterator)
191163
192void MapRemoveIterator::serialize(::zorba::serialization::Archiver& ar)164void MapDeleteIterator::serialize(::zorba::serialization::Archiver& ar)
193{165{
194 serialize_baseclass(ar,166 serialize_baseclass(ar,
195 (NaryBaseIterator<MapRemoveIterator, PlanIteratorState>*)this);167 (NaryBaseIterator<MapDeleteIterator, PlanIteratorState>*)this);
196}168}
197169
198170
199void MapRemoveIterator::accept(PlanIterVisitor& v) const171void MapDeleteIterator::accept(PlanIterVisitor& v) const
200{172{
201 v.beginVisit(*this);173 v.beginVisit(*this);
202174
@@ -209,9 +181,9 @@
209 v.endVisit(*this);181 v.endVisit(*this);
210}182}
211183
212MapRemoveIterator::~MapRemoveIterator() {}184MapDeleteIterator::~MapDeleteIterator() {}
213185
214// </MapRemoveIterator>186// </MapDeleteIterator>
215187
216188
217// <MapKeysIterator>189// <MapKeysIterator>
@@ -221,8 +193,6 @@
221{193{
222 serialize_baseclass(ar,194 serialize_baseclass(ar,
223 (NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>*)this);195 (NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>*)this);
224
225 ar & theNSBindings;
226}196}
227197
228198
@@ -314,17 +284,17 @@
314// </AvailableMapsIterator>284// </AvailableMapsIterator>
315285
316286
317// <MapIsTransientIterator>287// <MapOptionsIterator>
318SERIALIZABLE_CLASS_VERSIONS(MapIsTransientIterator)288SERIALIZABLE_CLASS_VERSIONS(MapOptionsIterator)
319289
320void MapIsTransientIterator::serialize(::zorba::serialization::Archiver& ar)290void MapOptionsIterator::serialize(::zorba::serialization::Archiver& ar)
321{291{
322 serialize_baseclass(ar,292 serialize_baseclass(ar,
323 (NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>*)this);293 (NaryBaseIterator<MapOptionsIterator, PlanIteratorState>*)this);
324}294}
325295
326296
327void MapIsTransientIterator::accept(PlanIterVisitor& v) const297void MapOptionsIterator::accept(PlanIterVisitor& v) const
328{298{
329 v.beginVisit(*this);299 v.beginVisit(*this);
330300
@@ -337,9 +307,9 @@
337 v.endVisit(*this);307 v.endVisit(*this);
338}308}
339309
340MapIsTransientIterator::~MapIsTransientIterator() {}310MapOptionsIterator::~MapOptionsIterator() {}
341311
342// </MapIsTransientIterator>312// </MapOptionsIterator>
343313
344314
345315
346316
=== 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-09-02 20:59:05 +0000
@@ -71,56 +71,25 @@
71 * 71 *
72 * Author: Matthias Brantner72 * Author: Matthias Brantner
73 */73 */
74class MapCreateTransientIterator : public NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>74class MapDropIterator : public NaryBaseIterator<MapDropIterator, PlanIteratorState>
75{ 75{
76public:76public:
77 SERIALIZABLE_CLASS(MapCreateTransientIterator);77 SERIALIZABLE_CLASS(MapDropIterator);
7878
79 SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapCreateTransientIterator,79 SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDropIterator,
80 NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>);80 NaryBaseIterator<MapDropIterator, PlanIteratorState>);
8181
82 void serialize( ::zorba::serialization::Archiver& ar);82 void serialize( ::zorba::serialization::Archiver& ar);
8383
84 MapCreateTransientIterator(84 MapDropIterator(
85 static_context* sctx,85 static_context* sctx,
86 const QueryLoc& loc,86 const QueryLoc& loc,
87 std::vector<PlanIter_t>& children)87 std::vector<PlanIter_t>& children)
88 : 88 :
89 NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>(sctx, loc, children)89 NaryBaseIterator<MapDropIterator, PlanIteratorState>(sctx, loc, children)
90 {}90 {}
9191
92 virtual ~MapCreateTransientIterator();92 virtual ~MapDropIterator();
93
94 void accept(PlanIterVisitor& v) const;
95
96 bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
97};
98
99
100/**
101 *
102 *
103 * Author: Matthias Brantner
104 */
105class MapDestroyIterator : public NaryBaseIterator<MapDestroyIterator, PlanIteratorState>
106{
107public:
108 SERIALIZABLE_CLASS(MapDestroyIterator);
109
110 SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDestroyIterator,
111 NaryBaseIterator<MapDestroyIterator, PlanIteratorState>);
112
113 void serialize( ::zorba::serialization::Archiver& ar);
114
115 MapDestroyIterator(
116 static_context* sctx,
117 const QueryLoc& loc,
118 std::vector<PlanIter_t>& children)
119 :
120 NaryBaseIterator<MapDestroyIterator, PlanIteratorState>(sctx, loc, children)
121 {}
122
123 virtual ~MapDestroyIterator();
12493
125 void accept(PlanIterVisitor& v) const;94 void accept(PlanIterVisitor& v) const;
12695
@@ -209,25 +178,25 @@
209 * 178 *
210 * Author: Matthias Brantner179 * Author: Matthias Brantner
211 */180 */
212class MapRemoveIterator : public NaryBaseIterator<MapRemoveIterator, PlanIteratorState>181class MapDeleteIterator : public NaryBaseIterator<MapDeleteIterator, PlanIteratorState>
213{ 182{
214public:183public:
215 SERIALIZABLE_CLASS(MapRemoveIterator);184 SERIALIZABLE_CLASS(MapDeleteIterator);
216185
217 SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapRemoveIterator,186 SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDeleteIterator,
218 NaryBaseIterator<MapRemoveIterator, PlanIteratorState>);187 NaryBaseIterator<MapDeleteIterator, PlanIteratorState>);
219188
220 void serialize( ::zorba::serialization::Archiver& ar);189 void serialize( ::zorba::serialization::Archiver& ar);
221190
222 MapRemoveIterator(191 MapDeleteIterator(
223 static_context* sctx,192 static_context* sctx,
224 const QueryLoc& loc,193 const QueryLoc& loc,
225 std::vector<PlanIter_t>& children)194 std::vector<PlanIter_t>& children)
226 : 195 :
227 NaryBaseIterator<MapRemoveIterator, PlanIteratorState>(sctx, loc, children)196 NaryBaseIterator<MapDeleteIterator, PlanIteratorState>(sctx, loc, children)
228 {}197 {}
229198
230 virtual ~MapRemoveIterator();199 virtual ~MapDeleteIterator();
231200
232 void accept(PlanIterVisitor& v) const;201 void accept(PlanIterVisitor& v) const;
233202
@@ -255,8 +224,6 @@
255224
256class MapKeysIterator : public NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>225class MapKeysIterator : public NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>
257{ 226{
258protected:
259 store::NsBindings theNSBindings; //
260public:227public:
261 SERIALIZABLE_CLASS(MapKeysIterator);228 SERIALIZABLE_CLASS(MapKeysIterator);
262229
@@ -270,8 +237,7 @@
270 const QueryLoc& loc,237 const QueryLoc& loc,
271 std::vector<PlanIter_t>& children)238 std::vector<PlanIter_t>& children)
272 : 239 :
273 NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>(sctx, loc, children),240 NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>(sctx, loc, children)
274 theNSBindings()
275 {}241 {}
276242
277 virtual ~MapKeysIterator();243 virtual ~MapKeysIterator();
@@ -364,25 +330,25 @@
364 * 330 *
365 * Author: Matthias Brantner331 * Author: Matthias Brantner
366 */332 */
367class MapIsTransientIterator : public NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>333class MapOptionsIterator : public NaryBaseIterator<MapOptionsIterator, PlanIteratorState>
368{ 334{
369public:335public:
370 SERIALIZABLE_CLASS(MapIsTransientIterator);336 SERIALIZABLE_CLASS(MapOptionsIterator);
371337
372 SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapIsTransientIterator,338 SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapOptionsIterator,
373 NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>);339 NaryBaseIterator<MapOptionsIterator, PlanIteratorState>);
374340
375 void serialize( ::zorba::serialization::Archiver& ar);341 void serialize( ::zorba::serialization::Archiver& ar);
376342
377 MapIsTransientIterator(343 MapOptionsIterator(
378 static_context* sctx,344 static_context* sctx,
379 const QueryLoc& loc,345 const QueryLoc& loc,
380 std::vector<PlanIter_t>& children)346 std::vector<PlanIter_t>& children)
381 : 347 :
382 NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>(sctx, loc, children)348 NaryBaseIterator<MapOptionsIterator, PlanIteratorState>(sctx, loc, children)
383 {}349 {}
384350
385 virtual ~MapIsTransientIterator();351 virtual ~MapOptionsIterator();
386352
387 void accept(PlanIterVisitor& v) const;353 void accept(PlanIterVisitor& v) const;
388354
389355
=== 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-09-02 20:59:05 +0000
@@ -663,15 +663,13 @@
663663
664 class MapCreateIterator;664 class MapCreateIterator;
665665
666 class MapCreateTransientIterator;666 class MapDropIterator;
667
668 class MapDestroyIterator;
669667
670 class MapGetIterator;668 class MapGetIterator;
671669
672 class MapInsertIterator;670 class MapInsertIterator;
673671
674 class MapRemoveIterator;672 class MapDeleteIterator;
675673
676 class MapKeysIterator;674 class MapKeysIterator;
677675
@@ -679,7 +677,7 @@
679677
680 class AvailableMapsIterator;678 class AvailableMapsIterator;
681679
682 class MapIsTransientIterator;680 class MapOptionsIterator;
683681
684 class CodepointsToStringIterator;682 class CodepointsToStringIterator;
685683
@@ -1700,11 +1698,8 @@
1700 virtual void beginVisit ( const MapCreateIterator& ) = 0;1698 virtual void beginVisit ( const MapCreateIterator& ) = 0;
1701 virtual void endVisit ( const MapCreateIterator& ) = 0;1699 virtual void endVisit ( const MapCreateIterator& ) = 0;
17021700
1703 virtual void beginVisit ( const MapCreateTransientIterator& ) = 0;1701 virtual void beginVisit ( const MapDropIterator& ) = 0;
1704 virtual void endVisit ( const MapCreateTransientIterator& ) = 0;1702 virtual void endVisit ( const MapDropIterator& ) = 0;
1705
1706 virtual void beginVisit ( const MapDestroyIterator& ) = 0;
1707 virtual void endVisit ( const MapDestroyIterator& ) = 0;
17081703
1709 virtual void beginVisit ( const MapGetIterator& ) = 0;1704 virtual void beginVisit ( const MapGetIterator& ) = 0;
1710 virtual void endVisit ( const MapGetIterator& ) = 0;1705 virtual void endVisit ( const MapGetIterator& ) = 0;
@@ -1712,8 +1707,8 @@
1712 virtual void beginVisit ( const MapInsertIterator& ) = 0;1707 virtual void beginVisit ( const MapInsertIterator& ) = 0;
1713 virtual void endVisit ( const MapInsertIterator& ) = 0;1708 virtual void endVisit ( const MapInsertIterator& ) = 0;
17141709
1715 virtual void beginVisit ( const MapRemoveIterator& ) = 0;1710 virtual void beginVisit ( const MapDeleteIterator& ) = 0;
1716 virtual void endVisit ( const MapRemoveIterator& ) = 0;1711 virtual void endVisit ( const MapDeleteIterator& ) = 0;
17171712
1718 virtual void beginVisit ( const MapKeysIterator& ) = 0;1713 virtual void beginVisit ( const MapKeysIterator& ) = 0;
1719 virtual void endVisit ( const MapKeysIterator& ) = 0;1714 virtual void endVisit ( const MapKeysIterator& ) = 0;
@@ -1724,8 +1719,8 @@
1724 virtual void beginVisit ( const AvailableMapsIterator& ) = 0;1719 virtual void beginVisit ( const AvailableMapsIterator& ) = 0;
1725 virtual void endVisit ( const AvailableMapsIterator& ) = 0;1720 virtual void endVisit ( const AvailableMapsIterator& ) = 0;
17261721
1727 virtual void beginVisit ( const MapIsTransientIterator& ) = 0;1722 virtual void beginVisit ( const MapOptionsIterator& ) = 0;
1728 virtual void endVisit ( const MapIsTransientIterator& ) = 0;1723 virtual void endVisit ( const MapOptionsIterator& ) = 0;
17291724
1730 virtual void beginVisit ( const CodepointsToStringIterator& ) = 0;1725 virtual void beginVisit ( const CodepointsToStringIterator& ) = 0;
1731 virtual void endVisit ( const CodepointsToStringIterator& ) = 0;1726 virtual void endVisit ( const CodepointsToStringIterator& ) = 0;
17321727
=== 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-09-02 20:59:05 +0000
@@ -4307,32 +4307,18 @@
4307// </MapCreateIterator>4307// </MapCreateIterator>
43084308
43094309
4310// <MapCreateTransientIterator>4310// <MapDropIterator>
4311void PrinterVisitor::beginVisit ( const MapCreateTransientIterator& a) {4311void PrinterVisitor::beginVisit ( const MapDropIterator& a) {
4312 thePrinter.startBeginVisit("MapCreateTransientIterator", ++theId);4312 thePrinter.startBeginVisit("MapDropIterator", ++theId);
4313 printCommons( &a, theId );4313 printCommons( &a, theId );
4314 thePrinter.endBeginVisit( theId );4314 thePrinter.endBeginVisit( theId );
4315}4315}
43164316
4317void PrinterVisitor::endVisit ( const MapCreateTransientIterator& ) {4317void PrinterVisitor::endVisit ( const MapDropIterator& ) {
4318 thePrinter.startEndVisit();4318 thePrinter.startEndVisit();
4319 thePrinter.endEndVisit();4319 thePrinter.endEndVisit();
4320}4320}
4321// </MapCreateTransientIterator>4321// </MapDropIterator>
4322
4323
4324// <MapDestroyIterator>
4325void PrinterVisitor::beginVisit ( const MapDestroyIterator& a) {
4326 thePrinter.startBeginVisit("MapDestroyIterator", ++theId);
4327 printCommons( &a, theId );
4328 thePrinter.endBeginVisit( theId );
4329}
4330
4331void PrinterVisitor::endVisit ( const MapDestroyIterator& ) {
4332 thePrinter.startEndVisit();
4333 thePrinter.endEndVisit();
4334}
4335// </MapDestroyIterator>
43364322
43374323
4338// <MapGetIterator>4324// <MapGetIterator>
@@ -4363,18 +4349,18 @@
4363// </MapInsertIterator>4349// </MapInsertIterator>
43644350
43654351
4366// <MapRemoveIterator>4352// <MapDeleteIterator>
4367void PrinterVisitor::beginVisit ( const MapRemoveIterator& a) {4353void PrinterVisitor::beginVisit ( const MapDeleteIterator& a) {
4368 thePrinter.startBeginVisit("MapRemoveIterator", ++theId);4354 thePrinter.startBeginVisit("MapDeleteIterator", ++theId);
4369 printCommons( &a, theId );4355 printCommons( &a, theId );
4370 thePrinter.endBeginVisit( theId );4356 thePrinter.endBeginVisit( theId );
4371}4357}
43724358
4373void PrinterVisitor::endVisit ( const MapRemoveIterator& ) {4359void PrinterVisitor::endVisit ( const MapDeleteIterator& ) {
4374 thePrinter.startEndVisit();4360 thePrinter.startEndVisit();
4375 thePrinter.endEndVisit();4361 thePrinter.endEndVisit();
4376}4362}
4377// </MapRemoveIterator>4363// </MapDeleteIterator>
43784364
43794365
4380// <MapKeysIterator>4366// <MapKeysIterator>
@@ -4419,18 +4405,18 @@
4419// </AvailableMapsIterator>4405// </AvailableMapsIterator>
44204406
44214407
4422// <MapIsTransientIterator>4408// <MapOptionsIterator>
4423void PrinterVisitor::beginVisit ( const MapIsTransientIterator& a) {4409void PrinterVisitor::beginVisit ( const MapOptionsIterator& a) {
4424 thePrinter.startBeginVisit("MapIsTransientIterator", ++theId);4410 thePrinter.startBeginVisit("MapOptionsIterator", ++theId);
4425 printCommons( &a, theId );4411 printCommons( &a, theId );
4426 thePrinter.endBeginVisit( theId );4412 thePrinter.endBeginVisit( theId );
4427}4413}
44284414
4429void PrinterVisitor::endVisit ( const MapIsTransientIterator& ) {4415void PrinterVisitor::endVisit ( const MapOptionsIterator& ) {
4430 thePrinter.startEndVisit();4416 thePrinter.startEndVisit();
4431 thePrinter.endEndVisit();4417 thePrinter.endEndVisit();
4432}4418}
4433// </MapIsTransientIterator>4419// </MapOptionsIterator>
44344420
44354421
4436// <CodepointsToStringIterator>4422// <CodepointsToStringIterator>
44374423
=== 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-09-02 20:59:05 +0000
@@ -1005,11 +1005,8 @@
1005 void beginVisit( const MapCreateIterator& );1005 void beginVisit( const MapCreateIterator& );
1006 void endVisit ( const MapCreateIterator& );1006 void endVisit ( const MapCreateIterator& );
10071007
1008 void beginVisit( const MapCreateTransientIterator& );1008 void beginVisit( const MapDropIterator& );
1009 void endVisit ( const MapCreateTransientIterator& );1009 void endVisit ( const MapDropIterator& );
1010
1011 void beginVisit( const MapDestroyIterator& );
1012 void endVisit ( const MapDestroyIterator& );
10131010
1014 void beginVisit( const MapGetIterator& );1011 void beginVisit( const MapGetIterator& );
1015 void endVisit ( const MapGetIterator& );1012 void endVisit ( const MapGetIterator& );
@@ -1017,8 +1014,8 @@
1017 void beginVisit( const MapInsertIterator& );1014 void beginVisit( const MapInsertIterator& );
1018 void endVisit ( const MapInsertIterator& );1015 void endVisit ( const MapInsertIterator& );
10191016
1020 void beginVisit( const MapRemoveIterator& );1017 void beginVisit( const MapDeleteIterator& );
1021 void endVisit ( const MapRemoveIterator& );1018 void endVisit ( const MapDeleteIterator& );
10221019
1023 void beginVisit( const MapKeysIterator& );1020 void beginVisit( const MapKeysIterator& );
1024 void endVisit ( const MapKeysIterator& );1021 void endVisit ( const MapKeysIterator& );
@@ -1029,8 +1026,8 @@
1029 void beginVisit( const AvailableMapsIterator& );1026 void beginVisit( const AvailableMapsIterator& );
1030 void endVisit ( const AvailableMapsIterator& );1027 void endVisit ( const AvailableMapsIterator& );
10311028
1032 void beginVisit( const MapIsTransientIterator& );1029 void beginVisit( const MapOptionsIterator& );
1033 void endVisit ( const MapIsTransientIterator& );1030 void endVisit ( const MapOptionsIterator& );
10341031
1035 void beginVisit( const CodepointsToStringIterator& );1032 void beginVisit( const CodepointsToStringIterator& );
1036 void endVisit ( const CodepointsToStringIterator& );1033 void endVisit ( const CodepointsToStringIterator& );
10371034
=== 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-09-02 20:59:05 +0000
@@ -25,16 +25,19 @@
2525
26Iterator tree for main query:26Iterator tree for main query:
27<SequentialIterator>27<SequentialIterator>
28 <CtxVarDeclareIterator varid="4" varname="co">28 <CtxVarDeclareIterator varid="4" varname="map:PERSISTENT">
29 <SingletonIterator value="xs:string(persistent)"/>
30 </CtxVarDeclareIterator>
31 <CtxVarDeclareIterator varid="5" varname="co">
29 <SingletonIterator value="xs:integer(0)"/>32 <SingletonIterator value="xs:integer(0)"/>
30 </CtxVarDeclareIterator>33 </CtxVarDeclareIterator>
31 <CtxVarDeclareIterator varid="5" varname="map1">34 <CtxVarDeclareIterator varid="6" varname="map1">
32 <SingletonIterator value="xs:QName(,,map-co)"/>35 <SingletonIterator value="xs:string(map-co)"/>
33 </CtxVarDeclareIterator>36 </CtxVarDeclareIterator>
34 <CtxVarDeclareIterator varid="6" varname="str">37 <CtxVarDeclareIterator varid="7" varname="str">
35 <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/>38 <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/>
36 </CtxVarDeclareIterator>39 </CtxVarDeclareIterator>
37 <CtxVarDeclareIterator varid="7" varname="input">40 <CtxVarDeclareIterator varid="8" varname="input">
38 <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">41 <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">
39 <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">42 <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">
40 <FnDocIterator>43 <FnDocIterator>
@@ -46,25 +49,25 @@
46 <SequentialIterator>49 <SequentialIterator>
47 <ApplyIterator>50 <ApplyIterator>
48 <MapCreateIterator>51 <MapCreateIterator>
49 <CtxVarIterator varid="5" varname="map1" varkind="global"/>52 <CtxVarIterator varid="6" varname="map1" varkind="global"/>
50 <CtxVarIterator varid="6" varname="str" varkind="global"/>53 <CtxVarIterator varid="7" varname="str" varkind="global"/>
51 </MapCreateIterator>54 </MapCreateIterator>
52 </ApplyIterator>55 </ApplyIterator>
53 <CtxVarDeclareIterator varid="8" varname="DG">56 <CtxVarDeclareIterator varid="9" varname="DG">
54 <UDFunctionCallIterator function="local:collapseNodesSameName">57 <UDFunctionCallIterator function="local:collapseNodesSameName">
55 <TreatIterator quant="+">58 <TreatIterator quant="+">
56 <CtxVarIterator varid="7" varname="input" varkind="global"/>59 <CtxVarIterator varid="8" varname="input" varkind="global"/>
57 </TreatIterator>60 </TreatIterator>
58 <SingletonIterator value="xs:boolean(true)"/>61 <SingletonIterator value="xs:boolean(true)"/>
59 <SingletonIterator value="xs:string()"/>62 <SingletonIterator value="xs:string()"/>
60 </UDFunctionCallIterator>63 </UDFunctionCallIterator>
61 </CtxVarDeclareIterator>64 </CtxVarDeclareIterator>
62 <ApplyIterator>65 <ApplyIterator>
63 <MapDestroyIterator>66 <MapDropIterator>
64 <CtxVarIterator varid="5" varname="map1" varkind="global"/>67 <CtxVarIterator varid="6" varname="map1" varkind="global"/>
65 </MapDestroyIterator>68 </MapDropIterator>
66 </ApplyIterator>69 </ApplyIterator>
67 <CtxVarIterator varid="8" varname="DG" varkind="local"/>70 <CtxVarIterator varid="9" varname="DG" varkind="local"/>
68 </SequentialIterator>71 </SequentialIterator>
69</SequentialIterator>72</SequentialIterator>
7073
@@ -183,12 +186,10 @@
183 <CtxVarAssignIterator varid="1" varname="label" varkind="local">186 <CtxVarAssignIterator varid="1" varname="label" varkind="local">
184 <TreatIterator type="xs:integer" quant="?">187 <TreatIterator type="xs:integer" quant="?">
185 <MapGetIterator>188 <MapGetIterator>
186 <CtxVarIterator varid="5" varname="map1" varkind="global"/>189 <CtxVarIterator varid="6" varname="map1" varkind="global"/>
187 <PromoteIterator type="xs:anyAtomicType">190 <TreatIterator quant="">
188 <FnDataIterator>191 <CtxVarIterator varid="4" varname="s2" varkind="local"/>
189 <CtxVarIterator varid="4" varname="s2" varkind="local"/>192 </TreatIterator>
190 </FnDataIterator>
191 </PromoteIterator>
192 </MapGetIterator>193 </MapGetIterator>
193 </TreatIterator>194 </TreatIterator>
194 </CtxVarAssignIterator>195 </CtxVarAssignIterator>
@@ -197,24 +198,22 @@
197 <CtxVarIterator varid="1" varname="label" varkind="local"/>198 <CtxVarIterator varid="1" varname="label" varkind="local"/>
198 </FnEmptyIterator>199 </FnEmptyIterator>
199 <SequentialIterator>200 <SequentialIterator>
200 <CtxVarAssignIterator varid="4" varname="co" varkind="global">201 <CtxVarAssignIterator varid="5" varname="co" varkind="global">
201 <SpecificNumArithIterator_AddOperation_INTEGER>202 <SpecificNumArithIterator_AddOperation_INTEGER>
202 <CtxVarIterator varid="4" varname="co" varkind="global"/>203 <CtxVarIterator varid="5" varname="co" varkind="global"/>
203 <SingletonIterator value="xs:integer(1)"/>204 <SingletonIterator value="xs:integer(1)"/>
204 </SpecificNumArithIterator_AddOperation_INTEGER>205 </SpecificNumArithIterator_AddOperation_INTEGER>
205 </CtxVarAssignIterator>206 </CtxVarAssignIterator>
206 <CtxVarAssignIterator varid="1" varname="label" varkind="local">207 <CtxVarAssignIterator varid="1" varname="label" varkind="local">
207 <CtxVarIterator varid="4" varname="co" varkind="global"/>208 <CtxVarIterator varid="5" varname="co" varkind="global"/>
208 </CtxVarAssignIterator>209 </CtxVarAssignIterator>
209 <ApplyIterator>210 <ApplyIterator>
210 <MapInsertIterator>211 <MapInsertIterator>
211 <CtxVarIterator varid="5" varname="map1" varkind="global"/>212 <CtxVarIterator varid="6" varname="map1" varkind="global"/>
212 <CtxVarIterator varid="4" varname="co" varkind="global"/>213 <TreatIterator quant="">
213 <PromoteIterator type="xs:anyAtomicType">214 <CtxVarIterator varid="4" varname="s2" varkind="local"/>
214 <FnDataIterator>215 </TreatIterator>
215 <CtxVarIterator varid="4" varname="s2" varkind="local"/>216 <CtxVarIterator varid="5" varname="co" varkind="global"/>
216 </FnDataIterator>
217 </PromoteIterator>
218 </MapInsertIterator>217 </MapInsertIterator>
219 </ApplyIterator>218 </ApplyIterator>
220 </SequentialIterator>219 </SequentialIterator>
221220
=== 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-09-02 20:59:05 +0000
@@ -25,16 +25,19 @@
2525
26Iterator tree for main query:26Iterator tree for main query:
27<SequentialIterator>27<SequentialIterator>
28 <CtxVarDeclareIterator varid="4" varname="co">28 <CtxVarDeclareIterator varid="4" varname="map:PERSISTENT">
29 <SingletonIterator value="xs:string(persistent)"/>
30 </CtxVarDeclareIterator>
31 <CtxVarDeclareIterator varid="5" varname="co">
29 <SingletonIterator value="xs:integer(0)"/>32 <SingletonIterator value="xs:integer(0)"/>
30 </CtxVarDeclareIterator>33 </CtxVarDeclareIterator>
31 <CtxVarDeclareIterator varid="5" varname="map1">34 <CtxVarDeclareIterator varid="6" varname="map1">
32 <SingletonIterator value="xs:QName(,,map-co)"/>35 <SingletonIterator value="xs:string(map-co)"/>
33 </CtxVarDeclareIterator>36 </CtxVarDeclareIterator>
34 <CtxVarDeclareIterator varid="6" varname="str">37 <CtxVarDeclareIterator varid="7" varname="str">
35 <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/>38 <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/>
36 </CtxVarDeclareIterator>39 </CtxVarDeclareIterator>
37 <CtxVarDeclareIterator varid="7" varname="input">40 <CtxVarDeclareIterator varid="8" varname="input">
38 <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">41 <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">
39 <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">42 <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0">
40 <FnDocIterator>43 <FnDocIterator>
@@ -46,25 +49,25 @@
46 <SequentialIterator>49 <SequentialIterator>
47 <ApplyIterator>50 <ApplyIterator>
48 <MapCreateIterator>51 <MapCreateIterator>
49 <CtxVarIterator varid="5" varname="map1" varkind="global"/>52 <CtxVarIterator varid="6" varname="map1" varkind="global"/>
50 <CtxVarIterator varid="6" varname="str" varkind="global"/>53 <CtxVarIterator varid="7" varname="str" varkind="global"/>
51 </MapCreateIterator>54 </MapCreateIterator>
52 </ApplyIterator>55 </ApplyIterator>
53 <CtxVarDeclareIterator varid="8" varname="DG">56 <CtxVarDeclareIterator varid="9" varname="DG">
54 <UDFunctionCallIterator function="local:collapseNodesSameName">57 <UDFunctionCallIterator function="local:collapseNodesSameName">
55 <TreatIterator quant="+">58 <TreatIterator quant="+">
56 <CtxVarIterator varid="7" varname="input" varkind="global"/>59 <CtxVarIterator varid="8" varname="input" varkind="global"/>
57 </TreatIterator>60 </TreatIterator>
58 <SingletonIterator value="xs:boolean(true)"/>61 <SingletonIterator value="xs:boolean(true)"/>
59 <SingletonIterator value="xs:string()"/>62 <SingletonIterator value="xs:string()"/>
60 </UDFunctionCallIterator>63 </UDFunctionCallIterator>
61 </CtxVarDeclareIterator>64 </CtxVarDeclareIterator>
62 <ApplyIterator>65 <ApplyIterator>
63 <MapDestroyIterator>66 <MapDropIterator>
64 <CtxVarIterator varid="5" varname="map1" varkind="global"/>67 <CtxVarIterator varid="6" varname="map1" varkind="global"/>
65 </MapDestroyIterator>68 </MapDropIterator>
66 </ApplyIterator>69 </ApplyIterator>
67 <CtxVarIterator varid="8" varname="DG" varkind="local"/>70 <CtxVarIterator varid="9" varname="DG" varkind="local"/>
68 </SequentialIterator>71 </SequentialIterator>
69</SequentialIterator>72</SequentialIterator>
7073
@@ -183,12 +186,10 @@
183 <CtxVarAssignIterator varid="1" varname="label" varkind="local">186 <CtxVarAssignIterator varid="1" varname="label" varkind="local">
184 <TreatIterator type="xs:integer" quant="?">187 <TreatIterator type="xs:integer" quant="?">
185 <MapGetIterator>188 <MapGetIterator>
186 <CtxVarIterator varid="5" varname="map1" varkind="global"/>189 <CtxVarIterator varid="6" varname="map1" varkind="global"/>
187 <PromoteIterator type="xs:anyAtomicType">190 <TreatIterator quant="">
188 <FnDataIterator>191 <CtxVarIterator varid="4" varname="s2" varkind="local"/>
189 <CtxVarIterator varid="4" varname="s2" varkind="local"/>192 </TreatIterator>
190 </FnDataIterator>
191 </PromoteIterator>
192 </MapGetIterator>193 </MapGetIterator>
193 </TreatIterator>194 </TreatIterator>
194 </CtxVarAssignIterator>195 </CtxVarAssignIterator>
@@ -197,24 +198,22 @@
197 <CtxVarIterator varid="1" varname="label" varkind="local"/>198 <CtxVarIterator varid="1" varname="label" varkind="local"/>
198 </FnEmptyIterator>199 </FnEmptyIterator>
199 <SequentialIterator>200 <SequentialIterator>
200 <CtxVarAssignIterator varid="4" varname="co" varkind="global">201 <CtxVarAssignIterator varid="5" varname="co" varkind="global">
201 <SpecificNumArithIterator_AddOperation_INTEGER>202 <SpecificNumArithIterator_AddOperation_INTEGER>
202 <CtxVarIterator varid="4" varname="co" varkind="global"/>203 <CtxVarIterator varid="5" varname="co" varkind="global"/>
203 <SingletonIterator value="xs:integer(1)"/>204 <SingletonIterator value="xs:integer(1)"/>
204 </SpecificNumArithIterator_AddOperation_INTEGER>205 </SpecificNumArithIterator_AddOperation_INTEGER>
205 </CtxVarAssignIterator>206 </CtxVarAssignIterator>
206 <CtxVarAssignIterator varid="1" varname="label" varkind="local">207 <CtxVarAssignIterator varid="1" varname="label" varkind="local">
207 <CtxVarIterator varid="4" varname="co" varkind="global"/>208 <CtxVarIterator varid="5" varname="co" varkind="global"/>
208 </CtxVarAssignIterator>209 </CtxVarAssignIterator>
209 <ApplyIterator>210 <ApplyIterator>
210 <MapInsertIterator>211 <MapInsertIterator>
211 <CtxVarIterator varid="5" varname="map1" varkind="global"/>212 <CtxVarIterator varid="6" varname="map1" varkind="global"/>
212 <CtxVarIterator varid="4" varname="co" varkind="global"/>213 <TreatIterator quant="">
213 <PromoteIterator type="xs:anyAtomicType">214 <CtxVarIterator varid="4" varname="s2" varkind="local"/>
214 <FnDataIterator>215 </TreatIterator>
215 <CtxVarIterator varid="4" varname="s2" varkind="local"/>216 <CtxVarIterator varid="5" varname="co" varkind="global"/>
216 </FnDataIterator>
217 </PromoteIterator>
218 </MapInsertIterator>217 </MapInsertIterator>
219 </ApplyIterator>218 </ApplyIterator>
220 </SequentialIterator>219 </SequentialIterator>
221220
=== added file 'test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-1.xml.res'
--- test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-1.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-1.xml.res 2013-09-02 20:59:05 +0000
@@ -0,0 +1,1 @@
11
02
=== added file 'test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-4.xml.res'
--- test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-4.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-4.xml.res 2013-09-02 20:59:05 +0000
@@ -0,0 +1,1 @@
1map
02
=== 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-09-02 20:59:05 +0000
@@ -1,1 +1,1 @@
1<key xmlns="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"><attribute value="key0"/><attribute value="1"/></key>1[ "key0", 1 ]
22
=== 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-09-02 20:59:05 +0000
@@ -1,1 +1,1 @@
1true true 1 key1 value1 true false 3 true true 5 key5 value5 false true key2 false true key4 false false1true 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
22
=== modified file 'test/rbkt/Queries/zorba/no-copy/dataguide-c.xq'
--- test/rbkt/Queries/zorba/no-copy/dataguide-c.xq 2013-08-16 07:00:06 +0000
+++ test/rbkt/Queries/zorba/no-copy/dataguide-c.xq 2013-09-02 20:59:05 +0000
@@ -1,11 +1,10 @@
1import module namespace map = 1import module namespace map = "http://zorba.io/modules/unordered-maps";
2 "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";
32
4declare namespace ann = "http://zorba.io/annotations";3declare namespace ann = "http://zorba.io/annotations";
54
6declare %ann:assignable variable $co as xs:integer :=0;5declare %ann:assignable variable $co as xs:integer :=0;
76
8declare variable $map1 :=xs:QName("map-co");7declare variable $map1 := "map-co";
98
10declare variable $str := QName ("http://www.w3.org/2001/XMLSchema", "string");9declare variable $str := QName ("http://www.w3.org/2001/XMLSchema", "string");
1110
@@ -58,7 +57,7 @@
58 {57 {
59 $co := $co +1;58 $co := $co +1;
60 $label := $co;59 $label := $co;
61 map:insert($map1, $co, $s2); 60 map:insert($map1, $s2, $co);
62 }61 }
63 else 62 else
64 {63 {
@@ -80,6 +79,6 @@
8079
81variable $DG := local:collapseNodesSameName($input, true(), "");80variable $DG := local:collapseNodesSameName($input, true(), "");
8281
83map:delete($map1);82map:drop($map1);
8483
85$DG84$DG
8685
=== 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-09-02 20:59:05 +0000
@@ -1,5 +1,4 @@
1import module namespace map = 1import module namespace map = "http://zorba.io/modules/unordered-maps";
2 "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";
32
4declare namespace ann = "http://zorba.io/annotations";3declare namespace ann = "http://zorba.io/annotations";
54
@@ -9,7 +8,7 @@
98
10declare %ann:assignable variable $co as xs:integer :=0;9declare %ann:assignable variable $co as xs:integer :=0;
1110
12declare variable $map1 :=xs:QName("map-co");11declare variable $map1 := "map-co";
1312
14declare variable $str := QName ("http://www.w3.org/2001/XMLSchema", "string");13declare variable $str := QName ("http://www.w3.org/2001/XMLSchema", "string");
1514
@@ -62,7 +61,7 @@
62 {61 {
63 $co := $co +1;62 $co := $co +1;
64 $label := $co;63 $label := $co;
65 map:insert($map1, $co, $s2); 64 map:insert($map1, $s2, $co);
66 }65 }
67 else 66 else
68 {67 {
@@ -82,10 +81,10 @@
82};81};
8382
8483
85map:create($map1,$str) ;84map:create($map1, $str);
8685
87variable $DG := local:collapseNodesSameName($input, true(), "");86variable $DG := local:collapseNodesSameName($input, true(), "");
8887
89map:delete($map1);88map:drop($map1);
9089
91$DG90$DG
9291
=== 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-09-02 20:59:05 +0000
@@ -1,14 +1,14 @@
1import module namespace idd = "http://zorba.io/reference" at "reference.xqlib";1import module namespace idd = "http://zorba.io/reference" at "reference.xqlib";
2import module namespace id = "http://zorba.io/modules/reference";2import module namespace id = "http://zorba.io/modules/reference";
3import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents";3import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents";
4import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";4import module namespace map = "http://zorba.io/modules/unordered-maps";
55
6variable $node:=<root>global</root>;6variable $node:=<root>global</root>;
7variable $x := <a>1</a>;7variable $x := <a>1</a>;
8fn:put(<root>doc</root>,"doc");8fn:put(<root>doc</root>,"doc");
99
10map:create(xs:QName("local:bar"), xs:QName("xs:integer"));10map:create("bar", xs:QName("xs:integer"));
11map:insert(xs:QName("local:bar"), id:reference($x), 1);11map:insert("bar", 1, id:reference($x));
1212
1313
1414
@@ -28,6 +28,6 @@
28}</temporary-variable-in-scope>28}</temporary-variable-in-scope>
29<temporary-variable-in-scope>{variable $temp:=<root>temp</root>; id:dereference(id:reference($temp))}</temporary-variable-in-scope>29<temporary-variable-in-scope>{variable $temp:=<root>temp</root>; id:dereference(id:reference($temp))}</temporary-variable-in-scope>
30<in-map>30<in-map>
31{id:dereference(map:get(xs:QName("local:bar"), 1))}31{id:dereference(map:get("bar", 1))}
32</in-map>32</in-map>
33</result>
34\ No newline at end of file33\ No newline at end of file
34</result>
3535
=== 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-09-02 20:59:05 +0000
@@ -1,11 +1,8 @@
11import module namespace map = "http://zorba.io/modules/unordered-maps";
2
3import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";
42
5declare namespace ann = "http://zorba.io/annotations";3declare namespace ann = "http://zorba.io/annotations";
64
7declare variable $local:processed-internal-links as xs:QName := 5declare variable $local:processed-internal-links as xs:string := "processed-internal-links";
8xs:QName("processed-internal-links");
96
107
11declare variable $result := ();8declare variable $result := ();
129
=== 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-09-02 20:59:05 +0000
@@ -1,10 +1,10 @@
1import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";1import module namespace map = "http://zorba.io/modules/unordered-maps";
22
3declare namespace ann = "http://zorba.io/annotations";3declare namespace ann = "http://zorba.io/annotations";
44
5declare %ann:nonsequential function local:foo() 5declare %ann:nonsequential function local:foo()
6{6{
7 map:create(xs:QName("local:mymap"), xs:QName("xs:integer"));7 map:create("mymap", xs:QName("xs:integer"));
8};8};
99
10local:foo()10local:foo()
1111
=== 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-09-02 20:59:05 +0000
@@ -1,5 +1,4 @@
1import module namespace x =1import module namespace x = "http://zorba.io/modules/unordered-maps";
2"http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";
32
4declare namespace ann = "http://zorba.io/annotations";3declare namespace ann = "http://zorba.io/annotations";
54
@@ -9,7 +8,7 @@
9 then8 then
10 {9 {
11 variable $req := <a/>;10 variable $req := <a/>;
12 variable $result := x:create(fn:QName("http://www.zorba-xquery.com/map", "first"),11 variable $result := x:create("first",
13 fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer"));12 fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer"));
1413
15 $result14 $result
1615
=== added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-1.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map-eval-1.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-1.xq 2013-09-02 20:59:05 +0000
@@ -0,0 +1,6 @@
1import module namespace map = "http://zorba.io/modules/unordered-maps";
2import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection";
3
4map:create("map", xs:QName("xs:string"),{ "persistent": false() });
5map:insert("map", "test", 1);
6reflection:eval('map:get("map", "test")')
07
=== added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.spec'
--- test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.spec 2013-09-02 20:59:05 +0000
@@ -0,0 +1,2 @@
1Error: http://zorba.io/errors:ZDDY0023
2
03
=== added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.xq 2013-09-02 20:59:05 +0000
@@ -0,0 +1,6 @@
1import module namespace map = "http://zorba.io/modules/unordered-maps";
2import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection";
3
4map:create("map", xs:QName("xs:string"),{ "persistent": false() });
5map:insert("map", "test", 1);
6reflection:eval-s('map:drop("map")')
07
=== added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.spec'
--- test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.spec 2013-09-02 20:59:05 +0000
@@ -0,0 +1,1 @@
1Error: http://zorba.io/errors:ZSTR0001
02
=== added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.xq 2013-09-02 20:59:05 +0000
@@ -0,0 +1,6 @@
1import module namespace map = "http://zorba.io/modules/unordered-maps";
2import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection";
3
4map:create("map", xs:QName("xs:string"),{ "persistent": false() });
5map:insert("map", "test", 1);
6reflection:eval-s('map:create("map", xs:QName("xs:string"))')
07
=== added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-4.xq'
--- test/rbkt/Queries/zorba/store/unordered-map/map-eval-4.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-4.xq 2013-09-02 20:59:05 +0000
@@ -0,0 +1,6 @@
1import module namespace map = "http://zorba.io/modules/unordered-maps";
2import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection";
3
4map:create("map", xs:QName("xs:string"),{ "persistent": false() });
5reflection:eval('map:available-maps()')
6
07
=== 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-09-02 20:59:05 +0000
@@ -1,16 +1,13 @@
1import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";1import module namespace map = "http://zorba.io/modules/unordered-maps";
22
33
4let $name := fn:QName("http://www.zorba-xquery.com/map", "first")4{
5let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")5 map:create("first", "integer");
6return6
7 {7 (
8 map:create($name, $type);8 for $i in 1 to 1000
99 return map:insert("first", $i, concat("value", $i))
10 (10 );
11 for $i in 1 to 100011
12 return map:insert($name, concat("value", $i), $i)12 count(map:keys("first")) = map:size("first")
13 );13}
14
15 count(map:keys($name)) = map:size($name)
16 }
1714
=== 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-09-02 20:59:05 +0000
@@ -1,15 +1,15 @@
1import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";1import module namespace map = "http://zorba.io/modules/unordered-maps";
22
33
4let $name := fn:QName("http://www.zorba-xquery.com/map", "first")4let $name := "first"
5let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")5let $type := "integer"
6return6return
7 {7 {
8 map:create($name, $type);8 map:create($name, $type);
99
10 (10 (
11 for $i in 1 to 100011 for $i in 1 to 1000
12 return map:insert($name, concat("value", $i), $i)12 return map:insert($name, $i, concat("value", $i))
13 );13 );
1414
15 map:get($name, 423)15 map:get($name, 423)
1616
=== 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-09-02 20:59:05 +0000
@@ -1,21 +1,21 @@
1import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";1import module namespace map = "http://zorba.io/modules/unordered-maps";
22
33
4let $name := fn:QName("http://www.zorba-xquery.com/map", "first")4let $name := "first"
5let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")5let $type := "integer"
6return6return
7 {7 {
8 variable $foo;8 variable $foo;
99
10 map:create($name, $type);10 map:create($name, $type);
1111
12 map:insert($name, "value1", 1);12 map:insert($name, 1, "value1");
13 map:insert($name, "value2", 1);13 map:insert($name, 1, "value2");
14 map:insert($name, "value3", 2);14 map:insert($name, 2, "value3");
1515
16 $foo := map:get($name, 1);16 $foo := map:get($name, 1);
1717
18 map:remove($name, 1);18 map:delete($name, 1);
1919
20 $foo := ($foo, map:get($name, 1), map:size($name), map:available-maps());20 $foo := ($foo, map:get($name, 1), map:size($name), map:available-maps());
2121
2222
=== 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-09-02 20:59:05 +0000
@@ -1,16 +1,16 @@
1import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";1import module namespace map = "http://zorba.io/modules/unordered-maps";
22
33
4let $name := fn:QName("http://www.zorba-xquery.com/map", "first")4let $name := "first"
5let $type1 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:anyAtomicType")5let $type1 := "string"
6let $type2 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")6let $type2 := "integer"
7return7return
8 {8 {
9 map:create($name, $type1, $type2);9 map:create($name, [ $type1, $type2]);
1010
11 map:insert($name, "value", "key0", 1);11 map:insert($name, ["key0", 1], "value");
1212
13 map:get($name, "key0", 1);13 map:get($name, ["key0", 1]);
1414
15 map:keys($name)15 map:keys($name)
16 }16 }
1717
=== 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-09-02 20:59:05 +0000
@@ -1,11 +1,11 @@
1import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";1import module namespace map = "http://zorba.io/modules/unordered-maps";
22
33
4let $name := fn:QName("http://www.zorba-xquery.com/map", "first")4let $name := "first"
5let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:anyAtomicType")5let $type := "decimal"
6return6return
7 {7 {
8 map:create($name, $type);8 map:create($name, $type);
9 map:insert($name, <a>blub</a>, 3.2);9 map:insert($name, 3.2, <a>blub</a>);
10 map:get($name, 3.2)10 map:get($name, 3.2)
11 }11 }
1212
=== 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-09-02 20:59:05 +0000
@@ -1,10 +1,10 @@
1import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";1import module namespace map = "http://zorba.io/modules/unordered-maps";
22
33
4let $name := fn:QName("http://www.zorba-xquery.com/map", "first")4let $name := "first"
5let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")5let $type := "integer"
6return6return
7 {7 {
8 map:create($name, $type);8 map:create($name, $type);
9 map:delete(fn:QName("http://www.zorba-xquery.com/map", "second"));9 map:drop("second");
10 }10 }
1111
=== 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-09-02 20:59:05 +0000
@@ -1,20 +1,20 @@
1import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";1import module namespace map = "http://zorba.io/modules/unordered-maps";
22
3declare namespace zerr = "http://zorba.io/errors";3declare namespace zerr = "http://zorba.io/errors";
4declare namespace err = "http://www.w3.org/2005/xqt-errors";4declare namespace err = "http://www.w3.org/2005/xqt-errors";
55
66
7let $name1 := fn:QName("http://www.zorba-xquery.com/map", "first")7let $name1 := "first"
8let $type1 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:string")8let $type1 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:string")
9let $name2 := fn:QName("http://www.zorba-xquery.com/map", "second")9let $name2 := "second"
10let $type2 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")10let $type2 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")
11return11return
12 {12 {
13 map:create($name1, $type1);13 map:create($name1, $type1);
14 map:create($name2, $type2);14 map:create($name2, $type2);
15 map:insert($name1, <a>blub</a>, xs:anyURI("http://www.zorba-xquery.com/"));15 map:insert($name1, xs:anyURI("http://www.zorba-xquery.com/"), <a>blub</a>);
16 map:insert($name1, <a>blub42</a>, 42);16 map:insert($name1, 42, <a>blub42</a>);
17 map:insert($name2, <a>blub23</a>, 2);17 map:insert($name2, 2, <a>blub23</a>);
18 (18 (
19 map:get($name1, "http://www.zorba-xquery.com/"),19 map:get($name1, "http://www.zorba-xquery.com/"),
20 map:get($name1, 42),20 map:get($name1, 42),
2121
=== 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-09-02 20:59:05 +0000
@@ -1,22 +1,22 @@
1import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";1import module namespace map = "http://zorba.io/modules/unordered-maps";
22
3variable $name := fn:QName("http://www.zorba-xquery.com/map", "first");3variable $name := "first";
4variable $xs-integer := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer");4variable $xs-integer := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer");
5variable $xs-string := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:string");5variable $xs-string := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:string");
66
7map:create($name, $xs-integer, $xs-string);7map:create($name, [$xs-integer, $xs-string]);
88
9for $i in 1 to 69for $i in 1 to 6
10let $value := concat("value", $i),10let $value := concat("value", $i)
11 $key1 := if ($i mod 2 ne 0) then $i else (),11let $key1 := $i
12 $key2 := if ($i mod 3 ne 0) then concat("key", $i) else ()12let $key2 := concat("key", $i)
13return13return
14 map:insert($name, $value, $key1, $key2);14 map:insert($name, [$key1, $key2], $value);
1515
16for $k in map:keys($name)16for $k in trace(map:keys($name), "key")
17let $key1 := data($k/map:attribute[1]/@value),17let $key1 := jn:members($k)[1]
18 $key2 := data($k/map:attribute[2]/@value)18let $key2 := jn:members($k)[2]
19order by $key1, $key219order by $key1, $key2
20return20return
21 ($key1 instance of xs:integer, $key2 instance of xs:string,21 ($key1 instance of xs:integer, $key2 instance of xs:string,
22 $key1, $key2, map:get($name, $key1, $key2))22 $key1, $key2, map:get($name, [$key1, $key2]))
2323
=== 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-09-02 20:59:05 +0000
@@ -1,26 +1,26 @@
1import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";1import module namespace map = "http://zorba.io/modules/unordered-maps";
22
33
4let $name := fn:QName("http://www.zorba-xquery.com/map", "first")4let $name := "first"
5let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")5let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")
6return6return
7 {7 {
8 map:create-transient($name, $type);8 map:create($name, $type, { $map:PERSISTENT : false });
99
10 (10 (
11 for $i in 1 to 100011 for $i in 1 to 1000
12 return map:insert($name, concat("value", $i), $i)12 return map:insert($name, $i, concat("value", $i))
13 );13 );
1414
15 variable $res := <avail>{ map:available-maps() }</avail>;15 variable $res := <avail>{ map:available-maps() }</avail>;
1616
17 $res := ($res, <contains>{ map:get($name, 5) }</contains>);17 $res := ($res, <contains>{ map:get($name, 5) }</contains>);
1818
19 map:remove($name, 5);19 map:delete($name, 5);
2020
21 $res := ($res, <contains>{ map:get($name, 5) }</contains>);21 $res := ($res, <contains>{ map:get($name, 5) }</contains>);
22 22
23 map:delete($name);23 map:drop($name);
2424
25 ($res, <avail>{ map:available-maps() }</avail>)25 ($res, <avail>{ map:available-maps() }</avail>)
26 }26 }

Subscribers

People subscribed via source and target branches