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

Proposed by Matthias Brantner on 2013-09-27
Status: Merged
Approved by: Paul J. Lucas on 2013-10-02
Approved revision: 11644
Merged at revision: 11648
Proposed branch: lp:~zorba-coders/zorba/bug-1058398
Merge into: lp:zorba
Diff against target: 1436 lines (+1101/-20)
30 files modified
ChangeLog (+1/-0)
modules/CMakeLists.txt (+1/-0)
modules/sequence/CMakeLists.txt (+18/-0)
modules/sequence/sequence.xq (+75/-0)
src/context/static_context.cpp (+5/-0)
src/context/static_context.h (+1/-0)
src/functions/library.cpp (+2/-0)
src/functions/pregenerated/func_seq.cpp (+110/-0)
src/functions/pregenerated/func_seq.h (+94/-0)
src/functions/pregenerated/function_enum.h (+3/-0)
src/runtime/CMakeLists.txt (+1/-0)
src/runtime/pregenerated/iterator_enum.h (+3/-0)
src/runtime/seq/CMakeLists.txt (+19/-0)
src/runtime/seq/pregenerated/seq.cpp (+159/-0)
src/runtime/seq/pregenerated/seq.h (+173/-0)
src/runtime/seq/seq_impl.cpp (+145/-0)
src/runtime/seq/seq_util.h (+64/-0)
src/runtime/spec/mappings.xml (+24/-19)
src/runtime/spec/seq/seq.xml (+65/-0)
src/runtime/visitors/pregenerated/planiter_visitor.h (+15/-0)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+43/-0)
src/runtime/visitors/pregenerated/printer_visitor.h (+9/-0)
src/util/stl_util.h (+1/-1)
src/zorbautils/specializations.h (+46/-0)
test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res (+1/-0)
test/rbkt/Queries/zorba/seq/seq-value-except-01.xq (+7/-0)
test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq (+7/-0)
test/rbkt/Queries/zorba/seq/seq-value-union-01.xq (+7/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1058398
Reviewer Review Type Date Requested Status
Matthias Brantner Approve on 2013-10-02
Paul J. Lucas 2013-09-27 Approve on 2013-10-02
Review via email: mp+187965@code.launchpad.net

Commit message

Added core C++ implementation of functx functions having the same name.

Description of the change

Added core C++ implementation of functx functions having the same name.

To post a comment you must log in.

documentation in "Performs TODO"

review: Needs Fixing
Paul J. Lucas (paul-lucas) wrote :

Why did you create a MP for this? As you saw from my e-mail, the performance isn't significantly better as-is.

That said, it might be possible to improve it by, for instance, caching the casting results; but that would take more investigation.

lp:~zorba-coders/zorba/bug-1058398 updated on 2013-10-01
11642. By Paul J. Lucas on 2013-10-01

Merge from trunk.

11643. By Paul J. Lucas on 2013-10-01

Merge from trunk.

11644. By Paul J. Lucas on 2013-10-01

Clean-up; renaming.

Paul J. Lucas (paul-lucas) :
review: Approve
review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

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

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

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
1=== modified file 'ChangeLog'
2--- ChangeLog 2013-10-01 00:52:37 +0000
3+++ ChangeLog 2013-10-01 23:33:38 +0000
4@@ -54,6 +54,7 @@
5 * Fixed bug #1190261 (relative paths bug in file module)
6 * Fixed bug #1189798 (Update core module "errors")
7 * Fixed bug #1187537 (Eliminate (or at least reduce) use of MAX_PATH)
8+ * Fixed bug #1058398 (set-based sequence operations)
9 * Fixed bug #1180220 (Consolidate redundant path/file public APIs)
10 * Fixed bug #1158052 (createBase64Binary() API too subtle)
11 * Fixed bug #1103115 (Timezone units as hours are wrong)
12
13=== modified file 'modules/CMakeLists.txt'
14--- modules/CMakeLists.txt 2013-10-01 03:34:33 +0000
15+++ modules/CMakeLists.txt 2013-10-01 23:33:38 +0000
16@@ -22,6 +22,7 @@
17 ADD_SUBDIRECTORY(org)
18 ADD_SUBDIRECTORY(schema)
19 ADD_SUBDIRECTORY(sctx)
20+ADD_SUBDIRECTORY(sequence)
21 ADD_SUBDIRECTORY(store)
22 ADD_SUBDIRECTORY(structured-items)
23 ADD_SUBDIRECTORY(w3c)
24
25=== added directory 'modules/sequence'
26=== added file 'modules/sequence/CMakeLists.txt'
27--- modules/sequence/CMakeLists.txt 1970-01-01 00:00:00 +0000
28+++ modules/sequence/CMakeLists.txt 2013-10-01 23:33:38 +0000
29@@ -0,0 +1,18 @@
30+# Copyright 2013 The FLWOR Foundation.
31+#
32+# Licensed under the Apache License, Version 2.0 (the "License");
33+# you may not use this file except in compliance with the License.
34+# You may obtain a copy of the License at
35+#
36+# http://www.apache.org/licenses/LICENSE-2.0
37+#
38+# Unless required by applicable law or agreed to in writing, software
39+# distributed under the License is distributed on an "AS IS" BASIS,
40+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41+# See the License for the specific language governing permissions and
42+# limitations under the License.
43+
44+DECLARE_ZORBA_MODULE(FILE sequence.xq VERSION 1.0
45+ URI "http://zorba.io/modules/sequence")
46+
47+# vim:set et sw=2 ts=2:
48
49=== added file 'modules/sequence/sequence.xq'
50--- modules/sequence/sequence.xq 1970-01-01 00:00:00 +0000
51+++ modules/sequence/sequence.xq 2013-10-01 23:33:38 +0000
52@@ -0,0 +1,75 @@
53+xquery version "3.0";
54+
55+(:
56+ : Copyright 2006-2013 The FLWOR Foundation.
57+ :
58+ : Licensed under the Apache License, Version 2.0 (the "License");
59+ : you may not use this file except in compliance with the License.
60+ : You may obtain a copy of the License at
61+ :
62+ : http://www.apache.org/licenses/LICENSE-2.0
63+ :
64+ : Unless required by applicable law or agreed to in writing, software
65+ : distributed under the License is distributed on an "AS IS" BASIS,
66+ : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
67+ : See the License for the specific language governing permissions and
68+ : limitations under the License.
69+ :)
70+
71+(:===========================================================================:)
72+
73+(:~
74+ : This module provides an XQuery API to perform set operations on sequences.
75+ :
76+ : @author Paul J. Lucas
77+ : @project Zorba/Sequence
78+ :)
79+
80+module namespace seq = "http://zorba.io/modules/sequence";
81+
82+declare namespace ver = "http://zorba.io/options/versioning";
83+declare option ver:module-version "1.0";
84+
85+(:===========================================================================:)
86+
87+(:~
88+ : Performs a set intersection of two sequences of atomic items based on their
89+ : values.
90+ :
91+ : @param $seq1 The first sequence.
92+ : @param $seq2 The second sequence.
93+ : @return a sequence containing only items from <code>$seq1</code> that are
94+ : also in <code>$seq2</code>.
95+ :)
96+declare function seq:value-intersect( $seq1 as xs:anyAtomicType*,
97+ $seq2 as xs:anyAtomicType* )
98+ as xs:anyAtomicType* external;
99+
100+(:~
101+ : Performs a set union of two sequences of atomic items based on their values.
102+ :
103+ : @param $seq1 The first sequence.
104+ : @param $seq2 The second sequence.
105+ : @return a sequence containing all items from <code>$seq1</code>
106+ : and <code>seq2$</code> but without duplicates.
107+ :)
108+declare function seq:value-union( $seq1 as xs:anyAtomicType*,
109+ $seq2 as xs:anyAtomicType* )
110+ as xs:anyAtomicType* external;
111+
112+(:~
113+ : Filters the first sequence of atomic items such that they are not in the
114+ : second sequence based on their values.
115+ :
116+ : @param $seq1 The first sequence.
117+ : @param $seq2 The second sequence.
118+ : @return a sequence only containing items from <code>$seq1</code>
119+ : that are not in <code>$seq2</code>.
120+ :)
121+declare function seq:value-except( $seq1 as xs:anyAtomicType*,
122+ $seq2 as xs:anyAtomicType* )
123+ as xs:anyAtomicType* external;
124+
125+(:===========================================================================:)
126+
127+(: vim:set et sw=2 ts=2: :)
128
129=== modified file 'src/context/static_context.cpp'
130--- src/context/static_context.cpp 2013-10-01 03:34:33 +0000
131+++ src/context/static_context.cpp 2013-10-01 23:33:38 +0000
132@@ -450,6 +450,10 @@
133 "http://www.zorba-xquery.com/zorba/scripting";
134
135 const char*
136+static_context::ZORBA_SEQ_FN_NS =
137+"http://zorba.io/modules/sequence";
138+
139+const char*
140 static_context::ZORBA_STRING_FN_NS =
141 "http://zorba.io/modules/string";
142
143@@ -563,6 +567,7 @@
144 ns == ZORBA_FETCH_FN_NS ||
145 ns == ZORBA_NODE_FN_NS ||
146 ns == ZORBA_ITEM_FN_NS ||
147+ ns == ZORBA_SEQ_FN_NS ||
148 ns == ZORBA_UTIL_FN_NS ||
149 #ifndef ZORBA_NO_FULL_TEXT
150 ns == ZORBA_FULL_TEXT_FN_NS ||
151
152=== modified file 'src/context/static_context.h'
153--- src/context/static_context.h 2013-10-01 00:52:37 +0000
154+++ src/context/static_context.h 2013-10-01 23:33:38 +0000
155@@ -539,6 +539,7 @@
156 static const char* JSONIQ_FN_NS;
157
158 static const char* ZORBA_SCHEMA_FN_NS;
159+ static const char* ZORBA_SEQ_FN_NS;
160 static const char* ZORBA_XQDOC_FN_NS;
161 static const char* ZORBA_RANDOM_FN_NS;
162 static const char* ZORBA_SCTX_FN_NS;
163
164=== modified file 'src/functions/library.cpp'
165--- src/functions/library.cpp 2013-09-17 23:05:29 +0000
166+++ src/functions/library.cpp 2013-10-01 23:33:38 +0000
167@@ -67,6 +67,7 @@
168 #include "functions/func_reflection.h"
169 #include "functions/func_schema.h"
170 #include "functions/func_sctx.h"
171+#include "functions/func_seq.h"
172 #include "functions/func_sequences.h"
173 #include "functions/func_sequences_impl.h"
174 #include "functions/func_strings.h"
175@@ -143,6 +144,7 @@
176 populate_context_random(sctx);
177 populate_context_schema(sctx);
178 populate_context_sctx(sctx);
179+ populate_context_seq(sctx);
180 populate_context_strings(sctx);
181 populate_context_strings_impl(sctx);
182 populate_context_uris(sctx);
183
184=== added file 'src/functions/pregenerated/func_seq.cpp'
185--- src/functions/pregenerated/func_seq.cpp 1970-01-01 00:00:00 +0000
186+++ src/functions/pregenerated/func_seq.cpp 2013-10-01 23:33:38 +0000
187@@ -0,0 +1,110 @@
188+/*
189+ * Copyright 2006-2012 The FLWOR Foundation.
190+ *
191+ * Licensed under the Apache License, Version 2.0 (the "License");
192+ * you may not use this file except in compliance with the License.
193+ * You may obtain a copy of the License at
194+ *
195+ * http://www.apache.org/licenses/LICENSE-2.0
196+ *
197+ * Unless required by applicable law or agreed to in writing, software
198+ * distributed under the License is distributed on an "AS IS" BASIS,
199+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200+ * See the License for the specific language governing permissions and
201+ * limitations under the License.
202+ */
203+
204+// ******************************************
205+// * *
206+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
207+// * SEE .xml FILE WITH SAME NAME *
208+// * *
209+// ******************************************
210+
211+
212+#include "stdafx.h"
213+#include "runtime/seq/seq.h"
214+#include "functions/func_seq.h"
215+
216+
217+namespace zorba{
218+
219+
220+
221+PlanIter_t fn_zorba_seq_value_intersect::codegen(
222+ CompilerCB*,
223+ static_context* sctx,
224+ const QueryLoc& loc,
225+ std::vector<PlanIter_t>& argv,
226+ expr& ann) const
227+{
228+ return new SeqValueIntersectIterator(sctx, loc, argv);
229+}
230+
231+PlanIter_t fn_zorba_seq_value_union::codegen(
232+ CompilerCB*,
233+ static_context* sctx,
234+ const QueryLoc& loc,
235+ std::vector<PlanIter_t>& argv,
236+ expr& ann) const
237+{
238+ return new SeqValueUnionIterator(sctx, loc, argv);
239+}
240+
241+PlanIter_t fn_zorba_seq_value_except::codegen(
242+ CompilerCB*,
243+ static_context* sctx,
244+ const QueryLoc& loc,
245+ std::vector<PlanIter_t>& argv,
246+ expr& ann) const
247+{
248+ return new SeqValueExceptIterator(sctx, loc, argv);
249+}
250+
251+void populate_context_seq(static_context* sctx)
252+{
253+
254+
255+ {
256+ DECL_WITH_KIND(sctx, fn_zorba_seq_value_intersect,
257+ (createQName("http://zorba.io/modules/sequence","","value-intersect"),
258+ GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
259+ GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
260+ GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR),
261+ FunctionConsts::FN_ZORBA_SEQ_VALUE_INTERSECT_2);
262+
263+ }
264+
265+
266+
267+
268+ {
269+ DECL_WITH_KIND(sctx, fn_zorba_seq_value_union,
270+ (createQName("http://zorba.io/modules/sequence","","value-union"),
271+ GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
272+ GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
273+ GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR),
274+ FunctionConsts::FN_ZORBA_SEQ_VALUE_UNION_2);
275+
276+ }
277+
278+
279+
280+
281+ {
282+ DECL_WITH_KIND(sctx, fn_zorba_seq_value_except,
283+ (createQName("http://zorba.io/modules/sequence","","value-except"),
284+ GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
285+ GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR,
286+ GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR),
287+ FunctionConsts::FN_ZORBA_SEQ_VALUE_EXCEPT_2);
288+
289+ }
290+
291+}
292+
293+
294+}
295+
296+
297+
298
299=== added file 'src/functions/pregenerated/func_seq.h'
300--- src/functions/pregenerated/func_seq.h 1970-01-01 00:00:00 +0000
301+++ src/functions/pregenerated/func_seq.h 2013-10-01 23:33:38 +0000
302@@ -0,0 +1,94 @@
303+/*
304+ * Copyright 2006-2012 The FLWOR Foundation.
305+ *
306+ * Licensed under the Apache License, Version 2.0 (the "License");
307+ * you may not use this file except in compliance with the License.
308+ * You may obtain a copy of the License at
309+ *
310+ * http://www.apache.org/licenses/LICENSE-2.0
311+ *
312+ * Unless required by applicable law or agreed to in writing, software
313+ * distributed under the License is distributed on an "AS IS" BASIS,
314+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
315+ * See the License for the specific language governing permissions and
316+ * limitations under the License.
317+ */
318+
319+// ******************************************
320+// * *
321+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
322+// * SEE .xml FILE WITH SAME NAME *
323+// * *
324+// ******************************************
325+
326+
327+#ifndef ZORBA_FUNCTIONS_SEQ_H
328+#define ZORBA_FUNCTIONS_SEQ_H
329+
330+
331+#include "common/shared_types.h"
332+#include "functions/function_impl.h"
333+
334+
335+namespace zorba {
336+
337+
338+void populate_context_seq(static_context* sctx);
339+
340+
341+
342+
343+//fn-zorba-seq:value-intersect
344+class fn_zorba_seq_value_intersect : public function
345+{
346+public:
347+ fn_zorba_seq_value_intersect(const signature& sig, FunctionConsts::FunctionKind kind)
348+ :
349+ function(sig, kind)
350+ {
351+
352+ }
353+
354+ CODEGEN_DECL();
355+};
356+
357+
358+//fn-zorba-seq:value-union
359+class fn_zorba_seq_value_union : public function
360+{
361+public:
362+ fn_zorba_seq_value_union(const signature& sig, FunctionConsts::FunctionKind kind)
363+ :
364+ function(sig, kind)
365+ {
366+
367+ }
368+
369+ CODEGEN_DECL();
370+};
371+
372+
373+//fn-zorba-seq:value-except
374+class fn_zorba_seq_value_except : public function
375+{
376+public:
377+ fn_zorba_seq_value_except(const signature& sig, FunctionConsts::FunctionKind kind)
378+ :
379+ function(sig, kind)
380+ {
381+
382+ }
383+
384+ CODEGEN_DECL();
385+};
386+
387+
388+} //namespace zorba
389+
390+
391+#endif
392+/*
393+ * Local variables:
394+ * mode: c++
395+ * End:
396+ */
397
398=== modified file 'src/functions/pregenerated/function_enum.h'
399--- src/functions/pregenerated/function_enum.h 2013-10-01 03:25:43 +0000
400+++ src/functions/pregenerated/function_enum.h 2013-10-01 23:33:38 +0000
401@@ -394,6 +394,9 @@
402 FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACE_BINDING_1,
403 FN_ZORBA_SCTX_STATICALLY_KNOWN_NAMESPACES_0,
404 FN_ZORBA_SCTX_XPATH10_COMPATIBILITY_MODE_0,
405+ FN_ZORBA_SEQ_VALUE_INTERSECT_2,
406+ FN_ZORBA_SEQ_VALUE_UNION_2,
407+ FN_ZORBA_SEQ_VALUE_EXCEPT_2,
408 OP_CONCATENATE_N,
409 FN_INDEX_OF_2,
410 FN_INDEX_OF_3,
411
412=== modified file 'src/runtime/CMakeLists.txt'
413--- src/runtime/CMakeLists.txt 2013-10-01 00:52:37 +0000
414+++ src/runtime/CMakeLists.txt 2013-10-01 23:33:38 +0000
415@@ -153,6 +153,7 @@
416 )
417
418 ADD_SRC_SUBFOLDER(RUNTIME_SRCS csv CSV_SRCS)
419+ADD_SRC_SUBFOLDER(RUNTIME_SRCS seq SEQ_SRCS)
420
421 IF(NOT ZORBA_NO_FULL_TEXT)
422 ADD_SRC_SUBFOLDER(RUNTIME_SRCS full_text FULLTEXT_SRCS)
423
424=== modified file 'src/runtime/pregenerated/iterator_enum.h'
425--- src/runtime/pregenerated/iterator_enum.h 2013-10-01 03:25:43 +0000
426+++ src/runtime/pregenerated/iterator_enum.h 2013-10-01 23:33:38 +0000
427@@ -290,6 +290,9 @@
428 TYPE_SctxStaticallyKnownNamespaceBindingIterator,
429 TYPE_SctxStaticallyKnownNamespacesIterator,
430 TYPE_SctxXPath10CompatModeIterator,
431+ TYPE_SeqValueIntersectIterator,
432+ TYPE_SeqValueUnionIterator,
433+ TYPE_SeqValueExceptIterator,
434 TYPE_FnConcatIterator,
435 TYPE_FnIndexOfIterator,
436 TYPE_FnEmptyIterator,
437
438=== added directory 'src/runtime/seq'
439=== added file 'src/runtime/seq/CMakeLists.txt'
440--- src/runtime/seq/CMakeLists.txt 1970-01-01 00:00:00 +0000
441+++ src/runtime/seq/CMakeLists.txt 2013-10-01 23:33:38 +0000
442@@ -0,0 +1,19 @@
443+# Copyright 2006-2013 The FLWOR Foundation.
444+#
445+# Licensed under the Apache License, Version 2.0 (the "License");
446+# you may not use this file except in compliance with the License.
447+# You may obtain a copy of the License at
448+#
449+# http://www.apache.org/licenses/LICENSE-2.0
450+#
451+# Unless required by applicable law or agreed to in writing, software
452+# distributed under the License is distributed on an "AS IS" BASIS,
453+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
454+# See the License for the specific language governing permissions and
455+# limitations under the License.
456+
457+SET(SEQ_SRCS
458+ seq_impl.cpp
459+ )
460+
461+# vim:set et sw=2 ts=2:
462
463=== added directory 'src/runtime/seq/pregenerated'
464=== added file 'src/runtime/seq/pregenerated/seq.cpp'
465--- src/runtime/seq/pregenerated/seq.cpp 1970-01-01 00:00:00 +0000
466+++ src/runtime/seq/pregenerated/seq.cpp 2013-10-01 23:33:38 +0000
467@@ -0,0 +1,159 @@
468+/*
469+ * Copyright 2006-2012 The FLWOR Foundation.
470+ *
471+ * Licensed under the Apache License, Version 2.0 (the "License");
472+ * you may not use this file except in compliance with the License.
473+ * You may obtain a copy of the License at
474+ *
475+ * http://www.apache.org/licenses/LICENSE-2.0
476+ *
477+ * Unless required by applicable law or agreed to in writing, software
478+ * distributed under the License is distributed on an "AS IS" BASIS,
479+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
480+ * See the License for the specific language governing permissions and
481+ * limitations under the License.
482+ */
483+
484+// ******************************************
485+// * *
486+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
487+// * SEE .xml FILE WITH SAME NAME *
488+// * *
489+// ******************************************
490+
491+#include "stdafx.h"
492+#include "zorbatypes/rchandle.h"
493+#include "zorbatypes/zstring.h"
494+#include "runtime/visitors/planiter_visitor.h"
495+#include "runtime/seq/seq.h"
496+#include "system/globalenv.h"
497+
498+
499+#include "store/api/iterator.h"
500+
501+namespace zorba {
502+
503+// <SeqValueIntersectIterator>
504+SERIALIZABLE_CLASS_VERSIONS(SeqValueIntersectIterator)
505+
506+void SeqValueIntersectIterator::serialize(::zorba::serialization::Archiver& ar)
507+{
508+ serialize_baseclass(ar,
509+ (NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>*)this);
510+}
511+
512+
513+void SeqValueIntersectIterator::accept(PlanIterVisitor& v) const
514+{
515+ v.beginVisit(*this);
516+
517+ std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
518+ std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
519+ for ( ; lIter != lEnd; ++lIter ){
520+ (*lIter)->accept(v);
521+ }
522+
523+ v.endVisit(*this);
524+}
525+
526+SeqValueIntersectIterator::~SeqValueIntersectIterator() {}
527+
528+SeqValueIntersectIteratorState::SeqValueIntersectIteratorState() {}
529+
530+SeqValueIntersectIteratorState::~SeqValueIntersectIteratorState() {}
531+
532+
533+void SeqValueIntersectIteratorState::init(PlanState& planState) {
534+ PlanIteratorState::init(planState);
535+}
536+
537+void SeqValueIntersectIteratorState::reset(PlanState& planState) {
538+ PlanIteratorState::reset(planState);
539+}
540+// </SeqValueIntersectIterator>
541+
542+
543+// <SeqValueUnionIterator>
544+SERIALIZABLE_CLASS_VERSIONS(SeqValueUnionIterator)
545+
546+void SeqValueUnionIterator::serialize(::zorba::serialization::Archiver& ar)
547+{
548+ serialize_baseclass(ar,
549+ (NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>*)this);
550+}
551+
552+
553+void SeqValueUnionIterator::accept(PlanIterVisitor& v) const
554+{
555+ v.beginVisit(*this);
556+
557+ std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
558+ std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
559+ for ( ; lIter != lEnd; ++lIter ){
560+ (*lIter)->accept(v);
561+ }
562+
563+ v.endVisit(*this);
564+}
565+
566+SeqValueUnionIterator::~SeqValueUnionIterator() {}
567+
568+SeqValueUnionIteratorState::SeqValueUnionIteratorState() {}
569+
570+SeqValueUnionIteratorState::~SeqValueUnionIteratorState() {}
571+
572+
573+void SeqValueUnionIteratorState::init(PlanState& planState) {
574+ PlanIteratorState::init(planState);
575+}
576+
577+void SeqValueUnionIteratorState::reset(PlanState& planState) {
578+ PlanIteratorState::reset(planState);
579+}
580+// </SeqValueUnionIterator>
581+
582+
583+// <SeqValueExceptIterator>
584+SERIALIZABLE_CLASS_VERSIONS(SeqValueExceptIterator)
585+
586+void SeqValueExceptIterator::serialize(::zorba::serialization::Archiver& ar)
587+{
588+ serialize_baseclass(ar,
589+ (NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>*)this);
590+}
591+
592+
593+void SeqValueExceptIterator::accept(PlanIterVisitor& v) const
594+{
595+ v.beginVisit(*this);
596+
597+ std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
598+ std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
599+ for ( ; lIter != lEnd; ++lIter ){
600+ (*lIter)->accept(v);
601+ }
602+
603+ v.endVisit(*this);
604+}
605+
606+SeqValueExceptIterator::~SeqValueExceptIterator() {}
607+
608+SeqValueExceptIteratorState::SeqValueExceptIteratorState() {}
609+
610+SeqValueExceptIteratorState::~SeqValueExceptIteratorState() {}
611+
612+
613+void SeqValueExceptIteratorState::init(PlanState& planState) {
614+ PlanIteratorState::init(planState);
615+}
616+
617+void SeqValueExceptIteratorState::reset(PlanState& planState) {
618+ PlanIteratorState::reset(planState);
619+}
620+// </SeqValueExceptIterator>
621+
622+
623+
624+}
625+
626+
627
628=== added file 'src/runtime/seq/pregenerated/seq.h'
629--- src/runtime/seq/pregenerated/seq.h 1970-01-01 00:00:00 +0000
630+++ src/runtime/seq/pregenerated/seq.h 2013-10-01 23:33:38 +0000
631@@ -0,0 +1,173 @@
632+/*
633+ * Copyright 2006-2012 The FLWOR Foundation.
634+ *
635+ * Licensed under the Apache License, Version 2.0 (the "License");
636+ * you may not use this file except in compliance with the License.
637+ * You may obtain a copy of the License at
638+ *
639+ * http://www.apache.org/licenses/LICENSE-2.0
640+ *
641+ * Unless required by applicable law or agreed to in writing, software
642+ * distributed under the License is distributed on an "AS IS" BASIS,
643+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
644+ * See the License for the specific language governing permissions and
645+ * limitations under the License.
646+ */
647+
648+// ******************************************
649+// * *
650+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
651+// * SEE .xml FILE WITH SAME NAME *
652+// * *
653+// ******************************************
654+#ifndef ZORBA_RUNTIME_SEQ_SEQ_H
655+#define ZORBA_RUNTIME_SEQ_SEQ_H
656+
657+
658+#include "common/shared_types.h"
659+
660+
661+
662+#include "runtime/base/narybase.h"
663+#include "runtime/seq/seq_util.h"
664+
665+
666+namespace zorba {
667+
668+/**
669+ *
670+ * Author:
671+ */
672+class SeqValueIntersectIteratorState : public PlanIteratorState
673+{
674+public:
675+ Item_set_type* set_[2]; //
676+
677+ SeqValueIntersectIteratorState();
678+
679+ ~SeqValueIntersectIteratorState();
680+
681+ void init(PlanState&);
682+ void reset(PlanState&);
683+};
684+
685+class SeqValueIntersectIterator : public NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>
686+{
687+public:
688+ SERIALIZABLE_CLASS(SeqValueIntersectIterator);
689+
690+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqValueIntersectIterator,
691+ NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>);
692+
693+ void serialize( ::zorba::serialization::Archiver& ar);
694+
695+ SeqValueIntersectIterator(
696+ static_context* sctx,
697+ const QueryLoc& loc,
698+ std::vector<PlanIter_t>& children)
699+ :
700+ NaryBaseIterator<SeqValueIntersectIterator, SeqValueIntersectIteratorState>(sctx, loc, children)
701+ {}
702+
703+ virtual ~SeqValueIntersectIterator();
704+
705+ void accept(PlanIterVisitor& v) const;
706+
707+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
708+};
709+
710+
711+/**
712+ *
713+ * Author:
714+ */
715+class SeqValueUnionIteratorState : public PlanIteratorState
716+{
717+public:
718+ int child_; //
719+ Item_set_type* set_; //
720+
721+ SeqValueUnionIteratorState();
722+
723+ ~SeqValueUnionIteratorState();
724+
725+ void init(PlanState&);
726+ void reset(PlanState&);
727+};
728+
729+class SeqValueUnionIterator : public NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>
730+{
731+public:
732+ SERIALIZABLE_CLASS(SeqValueUnionIterator);
733+
734+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqValueUnionIterator,
735+ NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>);
736+
737+ void serialize( ::zorba::serialization::Archiver& ar);
738+
739+ SeqValueUnionIterator(
740+ static_context* sctx,
741+ const QueryLoc& loc,
742+ std::vector<PlanIter_t>& children)
743+ :
744+ NaryBaseIterator<SeqValueUnionIterator, SeqValueUnionIteratorState>(sctx, loc, children)
745+ {}
746+
747+ virtual ~SeqValueUnionIterator();
748+
749+ void accept(PlanIterVisitor& v) const;
750+
751+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
752+};
753+
754+
755+/**
756+ *
757+ * Author:
758+ */
759+class SeqValueExceptIteratorState : public PlanIteratorState
760+{
761+public:
762+ Item_set_type* set_; //
763+
764+ SeqValueExceptIteratorState();
765+
766+ ~SeqValueExceptIteratorState();
767+
768+ void init(PlanState&);
769+ void reset(PlanState&);
770+};
771+
772+class SeqValueExceptIterator : public NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>
773+{
774+public:
775+ SERIALIZABLE_CLASS(SeqValueExceptIterator);
776+
777+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqValueExceptIterator,
778+ NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>);
779+
780+ void serialize( ::zorba::serialization::Archiver& ar);
781+
782+ SeqValueExceptIterator(
783+ static_context* sctx,
784+ const QueryLoc& loc,
785+ std::vector<PlanIter_t>& children)
786+ :
787+ NaryBaseIterator<SeqValueExceptIterator, SeqValueExceptIteratorState>(sctx, loc, children)
788+ {}
789+
790+ virtual ~SeqValueExceptIterator();
791+
792+ void accept(PlanIterVisitor& v) const;
793+
794+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
795+};
796+
797+
798+}
799+#endif
800+/*
801+ * Local variables:
802+ * mode: c++
803+ * End:
804+ */
805
806=== added file 'src/runtime/seq/seq_impl.cpp'
807--- src/runtime/seq/seq_impl.cpp 1970-01-01 00:00:00 +0000
808+++ src/runtime/seq/seq_impl.cpp 2013-10-01 23:33:38 +0000
809@@ -0,0 +1,145 @@
810+/*
811+ * Copyright 2006-2013 The FLWOR Foundation.
812+ *
813+ * Licensed under the Apache License, Version 2.0 (the "License");
814+ * you may not use this file except in compliance with the License.
815+ * You may obtain a copy of the License at
816+ *
817+ * http://www.apache.org/licenses/LICENSE-2.0
818+ *
819+ * Unless required by applicable law or agreed to in writing, software
820+ * distributed under the License is distributed on an "AS IS" BASIS,
821+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
822+ * See the License for the specific language governing permissions and
823+ * limitations under the License.
824+ */
825+
826+#include "stdafx.h"
827+
828+#include <zorba/config.h>
829+#include <zorba/internal/cxx_util.h>
830+
831+#include "context/dynamic_context.h"
832+#include "context/static_context.h"
833+#include "runtime/seq/seq.h"
834+#include "runtime/seq/seq_util.h"
835+#include "types/typemanager.h"
836+#include "util/stl_util.h"
837+
838+using namespace std;
839+
840+namespace zorba {
841+
842+///////////////////////////////////////////////////////////////////////////////
843+
844+inline Item_set_type* new_Item_set( TypeManager const *tm, long tz,
845+ XQPCollator *coll, QueryLoc const &loc ) {
846+ return new Item_set_type(
847+ ztd::prime_rehash_policy::default_bucket_count,
848+ Item_set_type::hasher(),
849+ Item_value_equal( tm, tz, coll, loc )
850+ );
851+}
852+
853+static void delete_Item_set( Item_set_type *set ) {
854+ MUTATE_EACH( Item_set_type, i, *set )
855+ (*i)->removeReference();
856+ delete set;
857+}
858+
859+///////////////////////////////////////////////////////////////////////////////
860+
861+bool SeqValueIntersectIterator::nextImpl( store::Item_t &result,
862+ PlanState &plan_state ) const {
863+ XQPCollator *const coll = theSctx->get_default_collator( loc );
864+ store::Item_t item;
865+ TypeManager *const tm = getTypeManager();
866+ long tz;
867+
868+ SeqValueIntersectIteratorState *state;
869+ DEFAULT_STACK_INIT( SeqValueIntersectIteratorState, state, plan_state );
870+
871+ tz = plan_state.theLocalDynCtx->get_implicit_timezone();
872+
873+ state->set_[0] = new_Item_set( tm, tz, coll, loc );
874+ state->set_[1] = new_Item_set( tm, tz, coll, loc );
875+
876+ while ( consumeNext( item, theChildren[0], plan_state ) )
877+ if ( state->set_[0]->insert( item.getp() ).second )
878+ item->addReference();
879+
880+ while ( consumeNext( item, theChildren[1], plan_state ) )
881+ if ( ztd::contains( *state->set_[0], item.getp() ) &&
882+ state->set_[1]->insert( item.getp() ).second ) {
883+ item->addReference();
884+ result = item;
885+ STACK_PUSH( true, state );
886+ }
887+
888+ delete_Item_set( state->set_[0] );
889+ delete_Item_set( state->set_[1] );
890+ STACK_END( state );
891+}
892+
893+///////////////////////////////////////////////////////////////////////////////
894+
895+bool SeqValueUnionIterator::nextImpl( store::Item_t &result,
896+ PlanState &plan_state ) const {
897+ XQPCollator *const coll = theSctx->get_default_collator( loc );
898+ store::Item_t item;
899+ TypeManager *const tm = getTypeManager();
900+ long tz;
901+
902+ SeqValueUnionIteratorState *state;
903+ DEFAULT_STACK_INIT( SeqValueUnionIteratorState, state, plan_state );
904+
905+ tz = plan_state.theLocalDynCtx->get_implicit_timezone();
906+ state->set_ = new_Item_set( tm, tz, coll, loc );
907+
908+ for ( state->child_ = 0; state->child_ < 2; ++state->child_ )
909+ while ( consumeNext( item, theChildren[ state->child_ ], plan_state ) )
910+ if ( state->set_->insert( item.getp() ).second ) {
911+ item->addReference();
912+ result = item;
913+ STACK_PUSH( true, state );
914+ }
915+
916+ delete_Item_set( state->set_ );
917+ STACK_END( state );
918+}
919+
920+///////////////////////////////////////////////////////////////////////////////
921+
922+bool SeqValueExceptIterator::nextImpl( store::Item_t &result,
923+ PlanState &plan_state ) const {
924+ XQPCollator *const coll = theSctx->get_default_collator( loc );
925+ store::Item_t item;
926+ TypeManager *const tm = getTypeManager();
927+ long tz;
928+
929+ SeqValueExceptIteratorState *state;
930+ DEFAULT_STACK_INIT( SeqValueExceptIteratorState, state, plan_state );
931+
932+ tz = plan_state.theLocalDynCtx->get_implicit_timezone();
933+ state->set_ = new_Item_set( tm, tz, coll, loc );
934+
935+ while ( consumeNext( item, theChildren[1], plan_state ) )
936+ if ( state->set_->insert( item.getp() ).second )
937+ item->addReference();
938+
939+ while ( consumeNext( item, theChildren[0], plan_state ) )
940+ if ( state->set_->insert( item.getp() ).second ) {
941+ item->addReference();
942+ result = item;
943+ STACK_PUSH( true, state );
944+ }
945+
946+ delete_Item_set( state->set_ );
947+ STACK_END( state );
948+}
949+
950+///////////////////////////////////////////////////////////////////////////////
951+
952+} // namespace zorba
953+
954+/* vim:set et sw=2 ts=2: */
955
956=== added file 'src/runtime/seq/seq_util.h'
957--- src/runtime/seq/seq_util.h 1970-01-01 00:00:00 +0000
958+++ src/runtime/seq/seq_util.h 2013-10-01 23:33:38 +0000
959@@ -0,0 +1,64 @@
960+/*
961+ * Copyright 2006-2013 The FLWOR Foundation.
962+ *
963+ * Licensed under the Apache License, Version 2.0 (the "License");
964+ * you may not use this file except in compliance with the License.
965+ * You may obtain a copy of the License at
966+ *
967+ * http://www.apache.org/licenses/LICENSE-2.0
968+ *
969+ * Unless required by applicable law or agreed to in writing, software
970+ * distributed under the License is distributed on an "AS IS" BASIS,
971+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
972+ * See the License for the specific language governing permissions and
973+ * limitations under the License.
974+ */
975+
976+#ifndef ZORBA_SEQ_UTIL_H
977+#define ZORBA_SEQ_UTIL_H
978+
979+#include <functional>
980+
981+#include "runtime/booleans/BooleanImpl.h"
982+#include "util/hash/hash.h"
983+#include "util/unordered_set.h"
984+#include "zorbautils/specializations.h"
985+
986+namespace zorba {
987+
988+class TypeManager;
989+class XQPCollator;
990+
991+///////////////////////////////////////////////////////////////////////////////
992+
993+struct Item_value_equal : std::binary_function<store::Item*,store::Item*,bool> {
994+ Item_value_equal( TypeManager const *tm, long tz, XQPCollator *coll,
995+ QueryLoc const &loc ) :
996+ tm_( tm ),
997+ tz_( tz ),
998+ coll_( coll ),
999+ loc_( loc )
1000+ {
1001+ }
1002+
1003+ bool operator()( store::Item *i, store::Item *j ) const {
1004+ store::Item_t it( i ), jt( j );
1005+ return CompareIterator::valueEqual( loc_, it, jt, tm_, tz_, coll_ );
1006+ }
1007+
1008+private:
1009+ TypeManager const *const tm_;
1010+ long const tz_;
1011+ XQPCollator *const coll_;
1012+ QueryLoc const loc_;
1013+};
1014+
1015+typedef std::unordered_set<store::Item*,ztd::hash<store::Item*>,Item_value_equal
1016+ > Item_set_type;
1017+
1018+///////////////////////////////////////////////////////////////////////////////
1019+
1020+} // namespace zorba
1021+
1022+#endif /* ZORBA_SEQ_UTIL_H */
1023+/* vim:set et sw=2 ts=2: */
1024
1025=== modified file 'src/runtime/spec/mappings.xml'
1026--- src/runtime/spec/mappings.xml 2013-10-01 03:34:33 +0000
1027+++ src/runtime/spec/mappings.xml 2013-10-01 23:33:38 +0000
1028@@ -23,10 +23,10 @@
1029 <zorba:namespace uri="http://zorba.io/modules/reference"
1030 define="ZORBA_REF_FN_NS"
1031 prefix="fn-reference"/>
1032-
1033+
1034 <zorba:namespace uri="http://zorba.io/modules/node-position"
1035 define="ZORBA_NODEPOS_FN_NS"
1036- prefix="fn-zorba-pos"/>
1037+ prefix="fn-zorba-pos"/>
1038
1039 <zorba:namespace uri="http://zorba.io/modules/schema"
1040 define="ZORBA_SCHEMA_FN_NS"
1041@@ -86,12 +86,12 @@
1042 define="ZORBA_DATETIME_FN_NS"
1043 prefix="fn-zorba-dateTime"/>
1044
1045- <zorba:namespace uri="http://www.zorba-xquery.com/modules/xqdoc"
1046- define="ZORBA_XQDOC_FN_NS"
1047+ <zorba:namespace uri="http://www.zorba-xquery.com/modules/xqdoc"
1048+ define="ZORBA_XQDOC_FN_NS"
1049 prefix="fn-zorba-xqdoc"/>
1050
1051- <zorba:namespace uri="http://zorba.io/modules/random"
1052- define="ZORBA_RANDOM_FN_NS"
1053+ <zorba:namespace uri="http://zorba.io/modules/random"
1054+ define="ZORBA_RANDOM_FN_NS"
1055 prefix="fn-zorba-random"/>
1056
1057 <zorba:namespace uri="http://zorba.io/modules/sctx"
1058@@ -99,7 +99,7 @@
1059 prefix="fn-zorba-sctx"/>
1060
1061 <zorba:namespace uri="http://www.zorba-xquery.com/modules/reflection"
1062- define="ZORBA_REFLECTION_FN_NS"
1063+ define="ZORBA_REFLECTION_FN_NS"
1064 prefix="fn-zorba-reflection"/>
1065
1066 <zorba:namespace uri="http://zorba.io/util-functions"
1067@@ -107,35 +107,39 @@
1068 prefix="fn-zorba-util"/>
1069
1070 <zorba:namespace uri="http://zorba.io/modules/string"
1071- define="ZORBA_STRING_FN_NS"
1072+ define="ZORBA_STRING_FN_NS"
1073 prefix="fn-zorba-string"/>
1074
1075 <zorba:namespace uri="http://www.zorba-xquery.com/modules/uri"
1076- define="ZORBA_URI_FN_NS"
1077+ define="ZORBA_URI_FN_NS"
1078 prefix="fn-zorba-uri"/>
1079
1080 <zorba:namespace uri="http://zorba.io/modules/json-csv"
1081- define="ZORBA_JSON_CSV_FN_NS"
1082+ define="ZORBA_JSON_CSV_FN_NS"
1083 prefix="fn-zorba-csv"/>
1084
1085 <zorba:namespace uri="http://zorba.io/modules/json-xml"
1086- define="ZORBA_JSON_XML_FN_NS"
1087+ define="ZORBA_JSON_XML_FN_NS"
1088 prefix="fn-zorba-json"/>
1089
1090 <zorba:namespace uri="http://www.zorba-xquery.com/modules/fetch"
1091- define="ZORBA_FETCH_FN_NS"
1092+ define="ZORBA_FETCH_FN_NS"
1093 prefix="fn-zorba-fetch"/>
1094
1095- <zorba:namespace uri="http://zorba.io/modules/node"
1096- define="ZORBA_NODE_FN_NS"
1097+ <zorba:namespace uri="http://zorba.io/modules/node"
1098+ define="ZORBA_NODE_FN_NS"
1099 prefix="fn-zorba-node"/>
1100
1101- <zorba:namespace uri="http://zorba.io/modules/item"
1102- define="ZORBA_ITEM_FN_NS"
1103+ <zorba:namespace uri="http://zorba.io/modules/item"
1104+ define="ZORBA_ITEM_FN_NS"
1105 prefix="fn-zorba-item"/>
1106-
1107+
1108+ <zorba:namespace uri="http://zorba.io/modules/sequence"
1109+ define="ZORBA_SEQ_FN_NS"
1110+ prefix="fn-zorba-seq"/>
1111+
1112 <zorba:namespace uri="http://zorba.io/modules/xml"
1113- define="ZORBA_XML_FN_NS"
1114+ define="ZORBA_XML_FN_NS"
1115 prefix="fn-zorba-xml"/>
1116
1117 <zorba:namespace uri="http://zorba.io/internal/xquery-ops"
1118@@ -214,7 +218,7 @@
1119
1120 <zorba:type zorbaType="ANY_URI">xs:anyURI</zorba:type>
1121 <zorba:type zorbaType="QNAME">xs:QName</zorba:type>
1122- <zorba:type zorbaType="NOTATION">xs:NOTATION</zorba:type>
1123+ <zorba:type zorbaType="NOTATION">xs:NOTATION</zorba:type>
1124 <zorba:type zorbaType="ANY_FUNCTION">function()</zorba:type>
1125 <zorba:type zorbaType="STRUCTURED_ITEM">structured-item()</zorba:type>
1126 <zorba:type zorbaType="JSON_ITEM">json-item()</zorba:type>
1127@@ -235,3 +239,4 @@
1128 -->
1129
1130 </zorba:mappings>
1131+<!-- vim:set et sw=2 ts=2: -->
1132
1133=== added directory 'src/runtime/spec/seq'
1134=== added file 'src/runtime/spec/seq/seq.xml'
1135--- src/runtime/spec/seq/seq.xml 1970-01-01 00:00:00 +0000
1136+++ src/runtime/spec/seq/seq.xml 2013-10-01 23:33:38 +0000
1137@@ -0,0 +1,65 @@
1138+<?xml version="1.0" encoding="UTF-8"?>
1139+
1140+<zorba:iterators
1141+ xmlns:zorba="http://www.zorba-xquery.com"
1142+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1143+ xsi:schemaLocation="http://www.zorba-xquery.com ../runtime.xsd">
1144+
1145+<zorba:header>
1146+ <zorba:include form="Quoted">runtime/seq/seq_util.h</zorba:include>
1147+</zorba:header>
1148+
1149+<zorba:source>
1150+ <zorba:include form="Quoted">store/api/iterator.h</zorba:include>
1151+</zorba:source>
1152+
1153+<!--========================================================================-->
1154+
1155+<zorba:iterator name="SeqValueIntersectIterator" arity="nary">
1156+ <zorba:function>
1157+ <zorba:signature localname="value-intersect" prefix="fn-zorba-seq">
1158+ <zorba:param>xs:anyAtomicType*</zorba:param>
1159+ <zorba:param>xs:anyAtomicType*</zorba:param>
1160+ <zorba:output>xs:anyAtomicType*</zorba:output>
1161+ </zorba:signature>
1162+ </zorba:function>
1163+ <zorba:state>
1164+ <zorba:member type="Item_set_type*" name="set_[2]"/>
1165+ </zorba:state>
1166+</zorba:iterator>
1167+
1168+<!--========================================================================-->
1169+
1170+<zorba:iterator name="SeqValueUnionIterator" arity="nary">
1171+ <zorba:function>
1172+ <zorba:signature localname="value-union" prefix="fn-zorba-seq">
1173+ <zorba:param>xs:anyAtomicType*</zorba:param>
1174+ <zorba:param>xs:anyAtomicType*</zorba:param>
1175+ <zorba:output>xs:anyAtomicType*</zorba:output>
1176+ </zorba:signature>
1177+ </zorba:function>
1178+ <zorba:state>
1179+ <zorba:member type="int" name="child_"/>
1180+ <zorba:member type="Item_set_type*" name="set_"/>
1181+ </zorba:state>
1182+</zorba:iterator>
1183+
1184+<!--========================================================================-->
1185+
1186+<zorba:iterator name="SeqValueExceptIterator" arity="nary">
1187+ <zorba:function>
1188+ <zorba:signature localname="value-except" prefix="fn-zorba-seq">
1189+ <zorba:param>xs:anyAtomicType*</zorba:param>
1190+ <zorba:param>xs:anyAtomicType*</zorba:param>
1191+ <zorba:output>xs:anyAtomicType*</zorba:output>
1192+ </zorba:signature>
1193+ </zorba:function>
1194+ <zorba:state>
1195+ <zorba:member type="Item_set_type*" name="set_"/>
1196+ </zorba:state>
1197+</zorba:iterator>
1198+
1199+<!--========================================================================-->
1200+
1201+</zorba:iterators>
1202+<!-- vim:set et sw=2 ts=2: -->
1203
1204=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
1205--- src/runtime/visitors/pregenerated/planiter_visitor.h 2013-10-01 03:25:43 +0000
1206+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2013-10-01 23:33:38 +0000
1207@@ -587,6 +587,12 @@
1208
1209 class SctxXPath10CompatModeIterator;
1210
1211+ class SeqValueIntersectIterator;
1212+
1213+ class SeqValueUnionIterator;
1214+
1215+ class SeqValueExceptIterator;
1216+
1217 class FnConcatIterator;
1218
1219 class FnIndexOfIterator;
1220@@ -1592,6 +1598,15 @@
1221 virtual void beginVisit ( const SctxXPath10CompatModeIterator& ) = 0;
1222 virtual void endVisit ( const SctxXPath10CompatModeIterator& ) = 0;
1223
1224+ virtual void beginVisit ( const SeqValueIntersectIterator& ) = 0;
1225+ virtual void endVisit ( const SeqValueIntersectIterator& ) = 0;
1226+
1227+ virtual void beginVisit ( const SeqValueUnionIterator& ) = 0;
1228+ virtual void endVisit ( const SeqValueUnionIterator& ) = 0;
1229+
1230+ virtual void beginVisit ( const SeqValueExceptIterator& ) = 0;
1231+ virtual void endVisit ( const SeqValueExceptIterator& ) = 0;
1232+
1233 virtual void beginVisit ( const FnConcatIterator& ) = 0;
1234 virtual void endVisit ( const FnConcatIterator& ) = 0;
1235
1236
1237=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
1238--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-10-01 03:25:43 +0000
1239+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-10-01 23:33:38 +0000
1240@@ -67,6 +67,7 @@
1241 #include "runtime/reference/reference.h"
1242 #include "runtime/schema/schema.h"
1243 #include "runtime/sctx/sctx.h"
1244+#include "runtime/seq/seq.h"
1245 #include "runtime/sequences/sequences.h"
1246 #include "runtime/store/documents.h"
1247 #include "runtime/store/maps.h"
1248@@ -3776,6 +3777,48 @@
1249 // </SctxXPath10CompatModeIterator>
1250
1251
1252+// <SeqValueIntersectIterator>
1253+void PrinterVisitor::beginVisit ( const SeqValueIntersectIterator& a) {
1254+ thePrinter.startBeginVisit("SeqValueIntersectIterator", ++theId);
1255+ printCommons( &a, theId );
1256+ thePrinter.endBeginVisit( theId );
1257+}
1258+
1259+void PrinterVisitor::endVisit ( const SeqValueIntersectIterator& ) {
1260+ thePrinter.startEndVisit();
1261+ thePrinter.endEndVisit();
1262+}
1263+// </SeqValueIntersectIterator>
1264+
1265+
1266+// <SeqValueUnionIterator>
1267+void PrinterVisitor::beginVisit ( const SeqValueUnionIterator& a) {
1268+ thePrinter.startBeginVisit("SeqValueUnionIterator", ++theId);
1269+ printCommons( &a, theId );
1270+ thePrinter.endBeginVisit( theId );
1271+}
1272+
1273+void PrinterVisitor::endVisit ( const SeqValueUnionIterator& ) {
1274+ thePrinter.startEndVisit();
1275+ thePrinter.endEndVisit();
1276+}
1277+// </SeqValueUnionIterator>
1278+
1279+
1280+// <SeqValueExceptIterator>
1281+void PrinterVisitor::beginVisit ( const SeqValueExceptIterator& a) {
1282+ thePrinter.startBeginVisit("SeqValueExceptIterator", ++theId);
1283+ printCommons( &a, theId );
1284+ thePrinter.endBeginVisit( theId );
1285+}
1286+
1287+void PrinterVisitor::endVisit ( const SeqValueExceptIterator& ) {
1288+ thePrinter.startEndVisit();
1289+ thePrinter.endEndVisit();
1290+}
1291+// </SeqValueExceptIterator>
1292+
1293+
1294 // <FnConcatIterator>
1295 void PrinterVisitor::beginVisit ( const FnConcatIterator& a) {
1296 thePrinter.startBeginVisit("FnConcatIterator", ++theId);
1297
1298=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
1299--- src/runtime/visitors/pregenerated/printer_visitor.h 2013-10-01 03:25:43 +0000
1300+++ src/runtime/visitors/pregenerated/printer_visitor.h 2013-10-01 23:33:38 +0000
1301@@ -891,6 +891,15 @@
1302 void beginVisit( const SctxXPath10CompatModeIterator& );
1303 void endVisit ( const SctxXPath10CompatModeIterator& );
1304
1305+ void beginVisit( const SeqValueIntersectIterator& );
1306+ void endVisit ( const SeqValueIntersectIterator& );
1307+
1308+ void beginVisit( const SeqValueUnionIterator& );
1309+ void endVisit ( const SeqValueUnionIterator& );
1310+
1311+ void beginVisit( const SeqValueExceptIterator& );
1312+ void endVisit ( const SeqValueExceptIterator& );
1313+
1314 void beginVisit( const FnConcatIterator& );
1315 void endVisit ( const FnConcatIterator& );
1316
1317
1318=== modified file 'src/util/stl_util.h'
1319--- src/util/stl_util.h 2013-08-23 11:15:04 +0000
1320+++ src/util/stl_util.h 2013-10-01 23:33:38 +0000
1321@@ -102,7 +102,7 @@
1322 };
1323
1324 /**
1325- * Specialization of std::equal_to for C strings.
1326+ * Specialization of ztd::equal_to for C strings.
1327 */
1328 template<>
1329 struct equal_to<char const*> :
1330
1331=== added file 'src/zorbautils/specializations.h'
1332--- src/zorbautils/specializations.h 1970-01-01 00:00:00 +0000
1333+++ src/zorbautils/specializations.h 2013-10-01 23:33:38 +0000
1334@@ -0,0 +1,46 @@
1335+/*
1336+ * Copyright 2006-2013 The FLWOR Foundation.
1337+ *
1338+ * Licensed under the Apache License, Version 2.0 (the "License");
1339+ * you may not use this file except in compliance with the License.
1340+ * You may obtain a copy of the License at
1341+ *
1342+ * http://www.apache.org/licenses/LICENSE-2.0
1343+ *
1344+ * Unless required by applicable law or agreed to in writing, software
1345+ * distributed under the License is distributed on an "AS IS" BASIS,
1346+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1347+ * See the License for the specific language governing permissions and
1348+ * limitations under the License.
1349+ */
1350+
1351+#ifndef ZORBA_SPECIALIZATIONS_H
1352+#define ZORBA_SPECIALIZATIONS_H
1353+
1354+#include "store/api/item.h"
1355+#include "util/hash/hash.h"
1356+
1357+namespace zorba {
1358+namespace ztd {
1359+
1360+///////////////////////////////////////////////////////////////////////////////
1361+
1362+/** Specialization for <code>store::Item*</code>. */
1363+template<> inline
1364+size_t hash<store::Item*>::operator()( store::Item *item ) const {
1365+ return item->hash();
1366+}
1367+
1368+/** Specialization for <code>store::Item const*</code>. */
1369+template<> inline
1370+size_t hash<store::Item const*>::operator()( store::Item const *item ) const {
1371+ return item->hash();
1372+}
1373+
1374+///////////////////////////////////////////////////////////////////////////////
1375+
1376+} // namespace ztd
1377+} // namespace zorba
1378+
1379+#endif /* ZORBA_SPECIALIZATIONS_H */
1380+/* vim:set et sw=2 ts=2: */
1381
1382=== added directory 'test/rbkt/ExpQueryResults/zorba/seq'
1383=== added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res'
1384--- test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res 1970-01-01 00:00:00 +0000
1385+++ test/rbkt/ExpQueryResults/zorba/seq/seq-value-except-01.xml.res 2013-10-01 23:33:38 +0000
1386@@ -0,0 +1,1 @@
1387+1
1388
1389=== added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res'
1390--- test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res 1970-01-01 00:00:00 +0000
1391+++ test/rbkt/ExpQueryResults/zorba/seq/seq-value-intersect-01.xml.res 2013-10-01 23:33:38 +0000
1392@@ -0,0 +1,1 @@
1393+2 3
1394
1395=== added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res'
1396--- test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res 1970-01-01 00:00:00 +0000
1397+++ test/rbkt/ExpQueryResults/zorba/seq/seq-value-union-01.xml.res 2013-10-01 23:33:38 +0000
1398@@ -0,0 +1,1 @@
1399+1 2 3 4
1400
1401=== added directory 'test/rbkt/Queries/zorba/seq'
1402=== added file 'test/rbkt/Queries/zorba/seq/seq-value-except-01.xq'
1403--- test/rbkt/Queries/zorba/seq/seq-value-except-01.xq 1970-01-01 00:00:00 +0000
1404+++ test/rbkt/Queries/zorba/seq/seq-value-except-01.xq 2013-10-01 23:33:38 +0000
1405@@ -0,0 +1,7 @@
1406+import module namespace seq = "http://zorba.io/modules/sequence";
1407+
1408+let $s1 := (1, 1, 2, 3)
1409+let $s2 := (2, 3, 3, 4, 4)
1410+return seq:value-except( $s1, $s2 )
1411+
1412+(: vim:set et sw=2 ts=2: :)
1413
1414=== added file 'test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq'
1415--- test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq 1970-01-01 00:00:00 +0000
1416+++ test/rbkt/Queries/zorba/seq/seq-value-intersect-01.xq 2013-10-01 23:33:38 +0000
1417@@ -0,0 +1,7 @@
1418+import module namespace seq = "http://zorba.io/modules/sequence";
1419+
1420+let $s1 := (1, 1, 2, 3)
1421+let $s2 := (2, 3, 3, 4, 4)
1422+return seq:value-intersect( $s1, $s2 )
1423+
1424+(: vim:set et sw=2 ts=2: :)
1425
1426=== added file 'test/rbkt/Queries/zorba/seq/seq-value-union-01.xq'
1427--- test/rbkt/Queries/zorba/seq/seq-value-union-01.xq 1970-01-01 00:00:00 +0000
1428+++ test/rbkt/Queries/zorba/seq/seq-value-union-01.xq 2013-10-01 23:33:38 +0000
1429@@ -0,0 +1,7 @@
1430+import module namespace seq = "http://zorba.io/modules/sequence";
1431+
1432+let $s1 := (1, 1, 2, 3)
1433+let $s2 := (2, 3, 3, 4, 4)
1434+return seq:value-union( $s1, $s2 )
1435+
1436+(: vim:set et sw=2 ts=2: :)

Subscribers

People subscribed via source and target branches