Matthias Brantner has proposed merging lp:~zorba-coders/zorba/bug-1058398 into lp:zorba.
Commit message: Bug #1058398: set-based sequence operations Requested reviews: Matthias Brantner (matthias-brantner) Related bugs: Bug #1058398 in Zorba: "set-based sequence operations" https://bugs.launchpad.net/zorba/+bug/1058398 For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-1058398/+merge/187965 -- https://code.launchpad.net/~zorba-coders/zorba/bug-1058398/+merge/187965 Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog' --- ChangeLog 2013-09-22 17:52:24 +0000 +++ ChangeLog 2013-09-27 03:33:21 +0000 @@ -54,6 +54,7 @@ * Fixed bug #1190261 (relative paths bug in file module) * Fixed bug #1189798 (Update core module "errors") * Fixed bug #1187537 (Eliminate (or at least reduce) use of MAX_PATH) + * Fixed bug #1058398 (set-based sequence operations) * Fixed bug #1180220 (Consolidate redundant path/file public APIs) * Fixed bug #1158052 (createBase64Binary() API too subtle) * Fixed bug #1103115 (Timezone units as hours are wrong) === modified file 'modules/CMakeLists.txt' --- modules/CMakeLists.txt 2013-09-09 23:47:17 +0000 +++ modules/CMakeLists.txt 2013-09-27 03:33:21 +0000 @@ -13,18 +13,19 @@ # limitations under the License. ADD_SUBDIRECTORY(atomic) -ADD_SUBDIRECTORY(store) ADD_SUBDIRECTORY(com) -ADD_SUBDIRECTORY(org) +ADD_SUBDIRECTORY(full-text) ADD_SUBDIRECTORY(functx) -ADD_SUBDIRECTORY(zorba-query) -ADD_SUBDIRECTORY(w3c) -ADD_SUBDIRECTORY(full-text) -ADD_SUBDIRECTORY(xml) ADD_SUBDIRECTORY(http-client) +ADD_SUBDIRECTORY(item) ADD_SUBDIRECTORY(json) +ADD_SUBDIRECTORY(org) +ADD_SUBDIRECTORY(sequence) +ADD_SUBDIRECTORY(store) ADD_SUBDIRECTORY(structured-items) -ADD_SUBDIRECTORY(item) +ADD_SUBDIRECTORY(w3c) +ADD_SUBDIRECTORY(xml) +ADD_SUBDIRECTORY(zorba-query) # Add external module projects - any subdirectories of a directory === added directory 'modules/sequence' === added file 'modules/sequence/CMakeLists.txt' --- modules/sequence/CMakeLists.txt 1970-01-01 00:00:00 +0000 +++ modules/sequence/CMakeLists.txt 2013-09-27 03:33:21 +0000 @@ -0,0 +1,18 @@ +# Copyright 2013 The FLWOR Foundation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DECLARE_ZORBA_MODULE(FILE sequence.xq VERSION 1.0 + URI "http://zorba.io/modules/sequence") + +# vim:set et sw=2 ts=2: === added file 'modules/sequence/sequence.xq' --- modules/sequence/sequence.xq 1970-01-01 00:00:00 +0000 +++ modules/sequence/sequence.xq 2013-09-27 03:33:21 +0000 @@ -0,0 +1,73 @@ +xquery version "3.0"; + +(: + : Copyright 2006-2013 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. + :) + +(:===========================================================================:) + +(:~ + : This module provides an XQuery API to perform set operations on sequences. + : + : @author Paul J. Lucas + : @project Zorba/Sequence + :) + +module namespace seq = "http://zorba.io/modules/sequence"; + +declare namespace ver = "http://zorba.io/options/versioning"; +declare option ver:module-version "1.0"; + +(:===========================================================================:) + +(:~ + : Performs an intersection of two sequences. + : + : @param $seq1 The first sequence. + : @param $seq2 The second sequence. + : @return a sequence only containing items from <code>$seq1</code> that are + : also in <code>$seq2</code> + :) +declare function seq:set-intersect( $seq1 as xs:anyAtomicType*, + $seq2 as xs:anyAtomicType* ) + as xs:anyAtomicType* external; + +(:~ + : Performs a union of two sequences. + : + : @param $seq1 The first sequence. + : @param $seq2 The second sequence. + : @return a sequence containing all items from <code>$seq1</code> + : and <code>seq2$</code> but without duplicates. + :) +declare function seq:set-union( $seq1 as xs:anyAtomicType*, + $seq2 as xs:anyAtomicType* ) + as xs:anyAtomicType* external; + +(:~ + : Performs TODO + : + : @param $seq1 The first sequence. + : @param $seq2 The second sequence. + : @return a sequence only containing items from <code>$seq1</code> + : that are not in <code>$seq2</code>. + :) +declare function seq:set-except( $seq1 as xs:anyAtomicType*, + $seq2 as xs:anyAtomicType* ) + as xs:anyAtomicType* external; + +(:===========================================================================:) + +(: vim:set et sw=2 ts=2: :) === modified file 'src/context/static_context.cpp' --- src/context/static_context.cpp 2013-09-17 23:05:29 +0000 +++ src/context/static_context.cpp 2013-09-27 03:33:21 +0000 @@ -450,6 +450,10 @@ "http://www.zorba-xquery.com/zorba/scripting"; const char* +static_context::ZORBA_SEQ_FN_NS = +"http://zorba.io/modules/sequence"; + +const char* static_context::ZORBA_STRING_FN_NS = "http://zorba.io/modules/string"; @@ -563,6 +567,7 @@ ns == ZORBA_FETCH_FN_NS || ns == ZORBA_NODE_FN_NS || ns == ZORBA_ITEM_FN_NS || + ns == ZORBA_SEQ_FN_NS || ns == ZORBA_UTIL_FN_NS || #ifndef ZORBA_NO_FULL_TEXT ns == ZORBA_FULL_TEXT_FN_NS || === modified file 'src/context/static_context.h' --- src/context/static_context.h 2013-09-17 23:05:29 +0000 +++ src/context/static_context.h 2013-09-27 03:33:21 +0000 @@ -539,6 +539,7 @@ static const char* JSONIQ_FN_NS; static const char* ZORBA_SCHEMA_FN_NS; + static const char* ZORBA_SEQ_FN_NS; static const char* ZORBA_XQDOC_FN_NS; static const char* ZORBA_RANDOM_FN_NS; static const char* ZORBA_INTROSP_SCTX_FN_NS; === modified file 'src/functions/library.cpp' --- src/functions/library.cpp 2013-09-17 23:05:29 +0000 +++ src/functions/library.cpp 2013-09-27 03:33:21 +0000 @@ -67,6 +67,7 @@ #include "functions/func_reflection.h" #include "functions/func_schema.h" #include "functions/func_sctx.h" +#include "functions/func_seq.h" #include "functions/func_sequences.h" #include "functions/func_sequences_impl.h" #include "functions/func_strings.h" @@ -143,6 +144,7 @@ populate_context_random(sctx); populate_context_schema(sctx); populate_context_sctx(sctx); + populate_context_seq(sctx); populate_context_strings(sctx); populate_context_strings_impl(sctx); populate_context_uris(sctx); === added file 'src/functions/pregenerated/func_seq.cpp' --- src/functions/pregenerated/func_seq.cpp 1970-01-01 00:00:00 +0000 +++ src/functions/pregenerated/func_seq.cpp 2013-09-27 03:33:21 +0000 @@ -0,0 +1,110 @@ +/* + * Copyright 2006-2012 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************** +// * * +// * THIS IS A GENERATED FILE. DO NOT EDIT! * +// * SEE .xml FILE WITH SAME NAME * +// * * +// ****************************************** + + +#include "stdafx.h" +#include "runtime/seq/seq.h" +#include "functions/func_seq.h" + + +namespace zorba{ + + + +PlanIter_t fn_zorba_seq_set_intersect::codegen( + CompilerCB*, + static_context* sctx, + const QueryLoc& loc, + std::vector<PlanIter_t>& argv, + expr& ann) const +{ + return new SeqSetIntersectIterator(sctx, loc, argv); +} + +PlanIter_t fn_zorba_seq_set_union::codegen( + CompilerCB*, + static_context* sctx, + const QueryLoc& loc, + std::vector<PlanIter_t>& argv, + expr& ann) const +{ + return new SeqSetUnionIterator(sctx, loc, argv); +} + +PlanIter_t fn_zorba_seq_set_except::codegen( + CompilerCB*, + static_context* sctx, + const QueryLoc& loc, + std::vector<PlanIter_t>& argv, + expr& ann) const +{ + return new SeqSetExceptIterator(sctx, loc, argv); +} + +void populate_context_seq(static_context* sctx) +{ + + + { + DECL_WITH_KIND(sctx, fn_zorba_seq_set_intersect, + (createQName("http://zorba.io/modules/sequence","","set-intersect"), + GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, + GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, + GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR), + FunctionConsts::FN_ZORBA_SEQ_SET_INTERSECT_2); + + } + + + + + { + DECL_WITH_KIND(sctx, fn_zorba_seq_set_union, + (createQName("http://zorba.io/modules/sequence","","set-union"), + GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, + GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, + GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR), + FunctionConsts::FN_ZORBA_SEQ_SET_UNION_2); + + } + + + + + { + DECL_WITH_KIND(sctx, fn_zorba_seq_set_except, + (createQName("http://zorba.io/modules/sequence","","set-except"), + GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, + GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR, + GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_STAR), + FunctionConsts::FN_ZORBA_SEQ_SET_EXCEPT_2); + + } + +} + + +} + + + === added file 'src/functions/pregenerated/func_seq.h' --- src/functions/pregenerated/func_seq.h 1970-01-01 00:00:00 +0000 +++ src/functions/pregenerated/func_seq.h 2013-09-27 03:33:21 +0000 @@ -0,0 +1,94 @@ +/* + * Copyright 2006-2012 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************** +// * * +// * THIS IS A GENERATED FILE. DO NOT EDIT! * +// * SEE .xml FILE WITH SAME NAME * +// * * +// ****************************************** + + +#ifndef ZORBA_FUNCTIONS_SEQ_H +#define ZORBA_FUNCTIONS_SEQ_H + + +#include "common/shared_types.h" +#include "functions/function_impl.h" + + +namespace zorba { + + +void populate_context_seq(static_context* sctx); + + + + +//fn-zorba-seq:set-intersect +class fn_zorba_seq_set_intersect : public function +{ +public: + fn_zorba_seq_set_intersect(const signature& sig, FunctionConsts::FunctionKind kind) + : + function(sig, kind) + { + + } + + CODEGEN_DECL(); +}; + + +//fn-zorba-seq:set-union +class fn_zorba_seq_set_union : public function +{ +public: + fn_zorba_seq_set_union(const signature& sig, FunctionConsts::FunctionKind kind) + : + function(sig, kind) + { + + } + + CODEGEN_DECL(); +}; + + +//fn-zorba-seq:set-except +class fn_zorba_seq_set_except : public function +{ +public: + fn_zorba_seq_set_except(const signature& sig, FunctionConsts::FunctionKind kind) + : + function(sig, kind) + { + + } + + CODEGEN_DECL(); +}; + + +} //namespace zorba + + +#endif +/* + * Local variables: + * mode: c++ + * End: + */ === modified file 'src/functions/pregenerated/function_enum.h' --- src/functions/pregenerated/function_enum.h 2013-09-24 00:48:42 +0000 +++ src/functions/pregenerated/function_enum.h 2013-09-27 03:33:21 +0000 @@ -393,6 +393,9 @@ FN_ZORBA_SCHEMA_VALIDATE_IN_PLACE_1, FN_ZORBA_SCHEMA_SCHEMA_TYPE_1, FN_ZORBA_SCHEMA_IS_VALIDATED_1, + FN_ZORBA_SEQ_SET_INTERSECT_2, + FN_ZORBA_SEQ_SET_UNION_2, + FN_ZORBA_SEQ_SET_EXCEPT_2, OP_CONCATENATE_N, FN_INDEX_OF_2, FN_INDEX_OF_3, === modified file 'src/runtime/CMakeLists.txt' --- src/runtime/CMakeLists.txt 2013-08-21 23:52:57 +0000 +++ src/runtime/CMakeLists.txt 2013-09-27 03:33:21 +0000 @@ -153,6 +153,7 @@ ) ADD_SRC_SUBFOLDER(RUNTIME_SRCS csv CSV_SRCS) +ADD_SRC_SUBFOLDER(RUNTIME_SRCS seq SEQ_SRCS) IF(NOT ZORBA_NO_FULL_TEXT) ADD_SRC_SUBFOLDER(RUNTIME_SRCS full_text FULLTEXT_SRCS) === modified file 'src/runtime/pregenerated/iterator_enum.h' --- src/runtime/pregenerated/iterator_enum.h 2013-09-19 16:09:35 +0000 +++ src/runtime/pregenerated/iterator_enum.h 2013-09-27 03:33:21 +0000 @@ -289,6 +289,9 @@ TYPE_ZorbaValidateInPlaceIterator, TYPE_ZorbaSchemaTypeIterator, TYPE_ZorbaIsValidatedIterator, + TYPE_SeqSetIntersectIterator, + TYPE_SeqSetUnionIterator, + TYPE_SeqSetExceptIterator, TYPE_FnConcatIterator, TYPE_FnIndexOfIterator, TYPE_FnEmptyIterator, === added directory 'src/runtime/seq' === added file 'src/runtime/seq/CMakeLists.txt' --- src/runtime/seq/CMakeLists.txt 1970-01-01 00:00:00 +0000 +++ src/runtime/seq/CMakeLists.txt 2013-09-27 03:33:21 +0000 @@ -0,0 +1,19 @@ +# Copyright 2006-2013 The FLWOR Foundation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SET(SEQ_SRCS + seq_impl.cpp + ) + +# vim:set et sw=2 ts=2: === added directory 'src/runtime/seq/pregenerated' === added file 'src/runtime/seq/pregenerated/seq.cpp' --- src/runtime/seq/pregenerated/seq.cpp 1970-01-01 00:00:00 +0000 +++ src/runtime/seq/pregenerated/seq.cpp 2013-09-27 03:33:21 +0000 @@ -0,0 +1,159 @@ +/* + * Copyright 2006-2012 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************** +// * * +// * THIS IS A GENERATED FILE. DO NOT EDIT! * +// * SEE .xml FILE WITH SAME NAME * +// * * +// ****************************************** + +#include "stdafx.h" +#include "zorbatypes/rchandle.h" +#include "zorbatypes/zstring.h" +#include "runtime/visitors/planiter_visitor.h" +#include "runtime/seq/seq.h" +#include "system/globalenv.h" + + +#include "store/api/iterator.h" + +namespace zorba { + +// <SeqSetIntersectIterator> +SERIALIZABLE_CLASS_VERSIONS(SeqSetIntersectIterator) + +void SeqSetIntersectIterator::serialize(::zorba::serialization::Archiver& ar) +{ + serialize_baseclass(ar, + (NaryBaseIterator<SeqSetIntersectIterator, SeqSetIntersectIteratorState>*)this); +} + + +void SeqSetIntersectIterator::accept(PlanIterVisitor& v) const +{ + v.beginVisit(*this); + + std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); + std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); + for ( ; lIter != lEnd; ++lIter ){ + (*lIter)->accept(v); + } + + v.endVisit(*this); +} + +SeqSetIntersectIterator::~SeqSetIntersectIterator() {} + +SeqSetIntersectIteratorState::SeqSetIntersectIteratorState() {} + +SeqSetIntersectIteratorState::~SeqSetIntersectIteratorState() {} + + +void SeqSetIntersectIteratorState::init(PlanState& planState) { + PlanIteratorState::init(planState); +} + +void SeqSetIntersectIteratorState::reset(PlanState& planState) { + PlanIteratorState::reset(planState); +} +// </SeqSetIntersectIterator> + + +// <SeqSetUnionIterator> +SERIALIZABLE_CLASS_VERSIONS(SeqSetUnionIterator) + +void SeqSetUnionIterator::serialize(::zorba::serialization::Archiver& ar) +{ + serialize_baseclass(ar, + (NaryBaseIterator<SeqSetUnionIterator, SeqSetUnionIteratorState>*)this); +} + + +void SeqSetUnionIterator::accept(PlanIterVisitor& v) const +{ + v.beginVisit(*this); + + std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); + std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); + for ( ; lIter != lEnd; ++lIter ){ + (*lIter)->accept(v); + } + + v.endVisit(*this); +} + +SeqSetUnionIterator::~SeqSetUnionIterator() {} + +SeqSetUnionIteratorState::SeqSetUnionIteratorState() {} + +SeqSetUnionIteratorState::~SeqSetUnionIteratorState() {} + + +void SeqSetUnionIteratorState::init(PlanState& planState) { + PlanIteratorState::init(planState); +} + +void SeqSetUnionIteratorState::reset(PlanState& planState) { + PlanIteratorState::reset(planState); +} +// </SeqSetUnionIterator> + + +// <SeqSetExceptIterator> +SERIALIZABLE_CLASS_VERSIONS(SeqSetExceptIterator) + +void SeqSetExceptIterator::serialize(::zorba::serialization::Archiver& ar) +{ + serialize_baseclass(ar, + (NaryBaseIterator<SeqSetExceptIterator, SeqSetExceptIteratorState>*)this); +} + + +void SeqSetExceptIterator::accept(PlanIterVisitor& v) const +{ + v.beginVisit(*this); + + std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); + std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); + for ( ; lIter != lEnd; ++lIter ){ + (*lIter)->accept(v); + } + + v.endVisit(*this); +} + +SeqSetExceptIterator::~SeqSetExceptIterator() {} + +SeqSetExceptIteratorState::SeqSetExceptIteratorState() {} + +SeqSetExceptIteratorState::~SeqSetExceptIteratorState() {} + + +void SeqSetExceptIteratorState::init(PlanState& planState) { + PlanIteratorState::init(planState); +} + +void SeqSetExceptIteratorState::reset(PlanState& planState) { + PlanIteratorState::reset(planState); +} +// </SeqSetExceptIterator> + + + +} + + === added file 'src/runtime/seq/pregenerated/seq.h' --- src/runtime/seq/pregenerated/seq.h 1970-01-01 00:00:00 +0000 +++ src/runtime/seq/pregenerated/seq.h 2013-09-27 03:33:21 +0000 @@ -0,0 +1,173 @@ +/* + * Copyright 2006-2012 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************** +// * * +// * THIS IS A GENERATED FILE. DO NOT EDIT! * +// * SEE .xml FILE WITH SAME NAME * +// * * +// ****************************************** +#ifndef ZORBA_RUNTIME_SEQ_SEQ_H +#define ZORBA_RUNTIME_SEQ_SEQ_H + + +#include "common/shared_types.h" + + + +#include "runtime/base/narybase.h" +#include "runtime/seq/seq_util.h" + + +namespace zorba { + +/** + * + * Author: + */ +class SeqSetIntersectIteratorState : public PlanIteratorState +{ +public: + Item_set_type* set_[2]; // + + SeqSetIntersectIteratorState(); + + ~SeqSetIntersectIteratorState(); + + void init(PlanState&); + void reset(PlanState&); +}; + +class SeqSetIntersectIterator : public NaryBaseIterator<SeqSetIntersectIterator, SeqSetIntersectIteratorState> +{ +public: + SERIALIZABLE_CLASS(SeqSetIntersectIterator); + + SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqSetIntersectIterator, + NaryBaseIterator<SeqSetIntersectIterator, SeqSetIntersectIteratorState>); + + void serialize( ::zorba::serialization::Archiver& ar); + + SeqSetIntersectIterator( + static_context* sctx, + const QueryLoc& loc, + std::vector<PlanIter_t>& children) + : + NaryBaseIterator<SeqSetIntersectIterator, SeqSetIntersectIteratorState>(sctx, loc, children) + {} + + virtual ~SeqSetIntersectIterator(); + + void accept(PlanIterVisitor& v) const; + + bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; +}; + + +/** + * + * Author: + */ +class SeqSetUnionIteratorState : public PlanIteratorState +{ +public: + int child_; // + Item_set_type* set_; // + + SeqSetUnionIteratorState(); + + ~SeqSetUnionIteratorState(); + + void init(PlanState&); + void reset(PlanState&); +}; + +class SeqSetUnionIterator : public NaryBaseIterator<SeqSetUnionIterator, SeqSetUnionIteratorState> +{ +public: + SERIALIZABLE_CLASS(SeqSetUnionIterator); + + SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqSetUnionIterator, + NaryBaseIterator<SeqSetUnionIterator, SeqSetUnionIteratorState>); + + void serialize( ::zorba::serialization::Archiver& ar); + + SeqSetUnionIterator( + static_context* sctx, + const QueryLoc& loc, + std::vector<PlanIter_t>& children) + : + NaryBaseIterator<SeqSetUnionIterator, SeqSetUnionIteratorState>(sctx, loc, children) + {} + + virtual ~SeqSetUnionIterator(); + + void accept(PlanIterVisitor& v) const; + + bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; +}; + + +/** + * + * Author: + */ +class SeqSetExceptIteratorState : public PlanIteratorState +{ +public: + Item_set_type* set_; // + + SeqSetExceptIteratorState(); + + ~SeqSetExceptIteratorState(); + + void init(PlanState&); + void reset(PlanState&); +}; + +class SeqSetExceptIterator : public NaryBaseIterator<SeqSetExceptIterator, SeqSetExceptIteratorState> +{ +public: + SERIALIZABLE_CLASS(SeqSetExceptIterator); + + SERIALIZABLE_CLASS_CONSTRUCTOR2T(SeqSetExceptIterator, + NaryBaseIterator<SeqSetExceptIterator, SeqSetExceptIteratorState>); + + void serialize( ::zorba::serialization::Archiver& ar); + + SeqSetExceptIterator( + static_context* sctx, + const QueryLoc& loc, + std::vector<PlanIter_t>& children) + : + NaryBaseIterator<SeqSetExceptIterator, SeqSetExceptIteratorState>(sctx, loc, children) + {} + + virtual ~SeqSetExceptIterator(); + + void accept(PlanIterVisitor& v) const; + + bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; +}; + + +} +#endif +/* + * Local variables: + * mode: c++ + * End: + */ === added file 'src/runtime/seq/seq_impl.cpp' --- src/runtime/seq/seq_impl.cpp 1970-01-01 00:00:00 +0000 +++ src/runtime/seq/seq_impl.cpp 2013-09-27 03:33:21 +0000 @@ -0,0 +1,154 @@ +/* + * Copyright 2006-2013 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "stdafx.h" + +#include <zorba/config.h> +#include <zorba/internal/cxx_util.h> + +#include "context/dynamic_context.h" +#include "context/static_context.h" +#include "runtime/seq/seq.h" +#include "runtime/seq/seq_util.h" +#include "types/typemanager.h" +#include "util/stl_util.h" + +using namespace std; + +namespace zorba { + +/////////////////////////////////////////////////////////////////////////////// + +static void delete_Item_set( Item_set_type *set ) { + MUTATE_EACH( Item_set_type, i, *set ) + (*i)->removeReference(); + delete set; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool SeqSetIntersectIterator::nextImpl( store::Item_t &result, + PlanState &plan_state ) const { + XQPCollator *const coll = theSctx->get_default_collator( loc ); + store::Item_t item; + TypeManager *const tm = getTypeManager(); + long tz; + + SeqSetIntersectIteratorState *state; + DEFAULT_STACK_INIT( SeqSetIntersectIteratorState, state, plan_state ); + + tz = plan_state.theLocalDynCtx->get_implicit_timezone(); + + state->set_[0] = new Item_set_type( + ztd::prime_rehash_policy::default_bucket_count, + Item_set_type::hasher(), + Item_value_equal( tm, tz, coll, loc ) + ); + state->set_[1] = new Item_set_type( + ztd::prime_rehash_policy::default_bucket_count, + Item_set_type::hasher(), + Item_value_equal( tm, tz, coll, loc ) + ); + + while ( consumeNext( item, theChildren[0], plan_state ) ) + if ( state->set_[0]->insert( item.getp() ).second ) + item->addReference(); + + while ( consumeNext( item, theChildren[1], plan_state ) ) + if ( ztd::contains( *state->set_[0], item.getp() ) && + state->set_[1]->insert( item.getp() ).second ) { + item->addReference(); + result = item; + STACK_PUSH( true, state ); + } + + delete_Item_set( state->set_[0] ); + delete_Item_set( state->set_[1] ); + STACK_END( state ); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool SeqSetUnionIterator::nextImpl( store::Item_t &result, + PlanState &plan_state ) const { + XQPCollator *const coll = theSctx->get_default_collator( loc ); + store::Item_t item; + TypeManager *const tm = getTypeManager(); + long tz; + + SeqSetUnionIteratorState *state; + DEFAULT_STACK_INIT( SeqSetUnionIteratorState, state, plan_state ); + + tz = plan_state.theLocalDynCtx->get_implicit_timezone(); + + state->set_ = new Item_set_type( + ztd::prime_rehash_policy::default_bucket_count, + Item_set_type::hasher(), + Item_value_equal( tm, tz, coll, loc ) + ); + + for ( state->child_ = 0; state->child_ < 2; ++state->child_ ) + while ( consumeNext( item, theChildren[ state->child_ ], plan_state ) ) + if ( state->set_->insert( item.getp() ).second ) { + item->addReference(); + result = item; + STACK_PUSH( true, state ); + } + + delete_Item_set( state->set_ ); + STACK_END( state ); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool SeqSetExceptIterator::nextImpl( store::Item_t &result, + PlanState &plan_state ) const { + XQPCollator *const coll = theSctx->get_default_collator( loc ); + store::Item_t item; + TypeManager *const tm = getTypeManager(); + long tz; + + SeqSetExceptIteratorState *state; + DEFAULT_STACK_INIT( SeqSetExceptIteratorState, state, plan_state ); + + tz = plan_state.theLocalDynCtx->get_implicit_timezone(); + + state->set_ = new Item_set_type( + ztd::prime_rehash_policy::default_bucket_count, + Item_set_type::hasher(), + Item_value_equal( tm, tz, coll, loc ) + ); + + while ( consumeNext( item, theChildren[1], plan_state ) ) + if ( state->set_->insert( item.getp() ).second ) + item->addReference(); + + while ( consumeNext( item, theChildren[0], plan_state ) ) + if ( state->set_->insert( item.getp() ).second ) { + item->addReference(); + result = item; + STACK_PUSH( true, state ); + } + + delete_Item_set( state->set_ ); + STACK_END( state ); +} + +/////////////////////////////////////////////////////////////////////////////// + +} // namespace zorba + +/* vim:set et sw=2 ts=2: */ === added file 'src/runtime/seq/seq_util.h' --- src/runtime/seq/seq_util.h 1970-01-01 00:00:00 +0000 +++ src/runtime/seq/seq_util.h 2013-09-27 03:33:21 +0000 @@ -0,0 +1,64 @@ +/* + * Copyright 2006-2013 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ZORBA_SEQ_UTIL_H +#define ZORBA_SEQ_UTIL_H + +#include <zorba/config.h> + +#include "runtime/booleans/BooleanImpl.h" +#include "util/hash/hash.h" +#include "util/unordered_set.h" +#include "zorbautils/specializations.h" + +namespace zorba { + +class TypeManager; +class XQPCollator; + +/////////////////////////////////////////////////////////////////////////////// + +struct Item_value_equal { + Item_value_equal( TypeManager const *tm, long timezone, XQPCollator *coll, + QueryLoc const &loc ) : + tm_( tm ), + tz_( timezone ), + coll_( coll ), + loc_( loc ) + { + } + + bool operator()( store::Item *i, store::Item *j ) const { + store::Item_t it( i ), jt( j ); + return CompareIterator::valueEqual( loc_, it, jt, tm_, tz_, coll_ ); + } + +private: + TypeManager const *const tm_; + long const tz_; + XQPCollator *const coll_; + QueryLoc const loc_; +}; + +typedef std::unordered_set<store::Item*,ztd::hash<store::Item*>,Item_value_equal + > Item_set_type; + +/////////////////////////////////////////////////////////////////////////////// + +} // namespace zorba + +#endif /* ZORBA_SEQ_UTIL_H */ +/* vim:set et sw=2 ts=2: */ === modified file 'src/runtime/spec/mappings.xml' --- src/runtime/spec/mappings.xml 2013-09-09 23:47:17 +0000 +++ src/runtime/spec/mappings.xml 2013-09-27 03:33:21 +0000 @@ -23,10 +23,10 @@ <zorba:namespace uri="http://zorba.io/modules/reference" define="ZORBA_REF_FN_NS" prefix="fn-reference"/> - + <zorba:namespace uri="http://zorba.io/modules/node-position" define="ZORBA_NODEPOS_FN_NS" - prefix="fn-zorba-pos"/> + prefix="fn-zorba-pos"/> <zorba:namespace uri="http://www.zorba-xquery.com/modules/schema" define="ZORBA_SCHEMA_FN_NS" @@ -86,20 +86,20 @@ define="ZORBA_DATETIME_FN_NS" prefix="fn-zorba-dateTime"/> - <zorba:namespace uri="http://www.zorba-xquery.com/modules/xqdoc" - define="ZORBA_XQDOC_FN_NS" + <zorba:namespace uri="http://www.zorba-xquery.com/modules/xqdoc" + define="ZORBA_XQDOC_FN_NS" prefix="fn-zorba-xqdoc"/> - <zorba:namespace uri="http://zorba.io/modules/random" - define="ZORBA_RANDOM_FN_NS" + <zorba:namespace uri="http://zorba.io/modules/random" + define="ZORBA_RANDOM_FN_NS" prefix="fn-zorba-random"/> <zorba:namespace uri="http://www.zorba-xquery.com/modules/introspection/sctx" - define="ZORBA_INTROSPECT_SCTX_FN_NS" + define="ZORBA_INTROSPECT_SCTX_FN_NS" prefix="fn-zorba-introspect-sctx"/> <zorba:namespace uri="http://www.zorba-xquery.com/modules/reflection" - define="ZORBA_REFLECTION_FN_NS" + define="ZORBA_REFLECTION_FN_NS" prefix="fn-zorba-reflection"/> <zorba:namespace uri="http://zorba.io/util-functions" @@ -107,35 +107,39 @@ prefix="fn-zorba-util"/> <zorba:namespace uri="http://zorba.io/modules/string" - define="ZORBA_STRING_FN_NS" + define="ZORBA_STRING_FN_NS" prefix="fn-zorba-string"/> <zorba:namespace uri="http://www.zorba-xquery.com/modules/uri" - define="ZORBA_URI_FN_NS" + define="ZORBA_URI_FN_NS" prefix="fn-zorba-uri"/> <zorba:namespace uri="http://zorba.io/modules/json-csv" - define="ZORBA_JSON_CSV_FN_NS" + define="ZORBA_JSON_CSV_FN_NS" prefix="fn-zorba-csv"/> <zorba:namespace uri="http://zorba.io/modules/json-xml" - define="ZORBA_JSON_XML_FN_NS" + define="ZORBA_JSON_XML_FN_NS" prefix="fn-zorba-json"/> <zorba:namespace uri="http://www.zorba-xquery.com/modules/fetch" - define="ZORBA_FETCH_FN_NS" + define="ZORBA_FETCH_FN_NS" prefix="fn-zorba-fetch"/> - <zorba:namespace uri="http://zorba.io/modules/node" - define="ZORBA_NODE_FN_NS" + <zorba:namespace uri="http://zorba.io/modules/node" + define="ZORBA_NODE_FN_NS" prefix="fn-zorba-node"/> - <zorba:namespace uri="http://zorba.io/modules/item" - define="ZORBA_ITEM_FN_NS" + <zorba:namespace uri="http://zorba.io/modules/item" + define="ZORBA_ITEM_FN_NS" prefix="fn-zorba-item"/> - + + <zorba:namespace uri="http://zorba.io/modules/sequence" + define="ZORBA_SEQ_FN_NS" + prefix="fn-zorba-seq"/> + <zorba:namespace uri="http://zorba.io/modules/xml" - define="ZORBA_XML_FN_NS" + define="ZORBA_XML_FN_NS" prefix="fn-zorba-xml"/> <zorba:namespace uri="http://zorba.io/internal/xquery-ops" @@ -214,7 +218,7 @@ <zorba:type zorbaType="ANY_URI">xs:anyURI</zorba:type> <zorba:type zorbaType="QNAME">xs:QName</zorba:type> - <zorba:type zorbaType="NOTATION">xs:NOTATION</zorba:type> + <zorba:type zorbaType="NOTATION">xs:NOTATION</zorba:type> <zorba:type zorbaType="ANY_FUNCTION">function()</zorba:type> <zorba:type zorbaType="STRUCTURED_ITEM">structured-item()</zorba:type> <zorba:type zorbaType="JSON_ITEM">json-item()</zorba:type> @@ -235,3 +239,4 @@ --> </zorba:mappings> +<!-- vim:set et sw=2 ts=2: --> === added directory 'src/runtime/spec/seq' === added file 'src/runtime/spec/seq/seq.xml' --- src/runtime/spec/seq/seq.xml 1970-01-01 00:00:00 +0000 +++ src/runtime/spec/seq/seq.xml 2013-09-27 03:33:21 +0000 @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<zorba:iterators + xmlns:zorba="http://www.zorba-xquery.com" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.zorba-xquery.com ../runtime.xsd"> + +<zorba:header> + <zorba:include form="Quoted">runtime/seq/seq_util.h</zorba:include> +</zorba:header> + +<zorba:source> + <zorba:include form="Quoted">store/api/iterator.h</zorba:include> +</zorba:source> + +<!--========================================================================--> + +<zorba:iterator name="SeqSetIntersectIterator" arity="nary"> + <zorba:function> + <zorba:signature localname="set-intersect" prefix="fn-zorba-seq"> + <zorba:param>xs:anyAtomicType*</zorba:param> + <zorba:param>xs:anyAtomicType*</zorba:param> + <zorba:output>xs:anyAtomicType*</zorba:output> + </zorba:signature> + </zorba:function> + <zorba:state> + <zorba:member type="Item_set_type*" name="set_[2]"/> + </zorba:state> +</zorba:iterator> + +<!--========================================================================--> + +<zorba:iterator name="SeqSetUnionIterator" arity="nary"> + <zorba:function> + <zorba:signature localname="set-union" prefix="fn-zorba-seq"> + <zorba:param>xs:anyAtomicType*</zorba:param> + <zorba:param>xs:anyAtomicType*</zorba:param> + <zorba:output>xs:anyAtomicType*</zorba:output> + </zorba:signature> + </zorba:function> + <zorba:state> + <zorba:member type="int" name="child_"/> + <zorba:member type="Item_set_type*" name="set_"/> + </zorba:state> +</zorba:iterator> + +<!--========================================================================--> + +<zorba:iterator name="SeqSetExceptIterator" arity="nary"> + <zorba:function> + <zorba:signature localname="set-except" prefix="fn-zorba-seq"> + <zorba:param>xs:anyAtomicType*</zorba:param> + <zorba:param>xs:anyAtomicType*</zorba:param> + <zorba:output>xs:anyAtomicType*</zorba:output> + </zorba:signature> + </zorba:function> + <zorba:state> + <zorba:member type="Item_set_type*" name="set_"/> + </zorba:state> +</zorba:iterator> + +<!--========================================================================--> + +</zorba:iterators> +<!-- vim:set et sw=2 ts=2: --> === modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h' --- src/runtime/visitors/pregenerated/planiter_visitor.h 2013-09-19 16:09:35 +0000 +++ src/runtime/visitors/pregenerated/planiter_visitor.h 2013-09-27 03:33:21 +0000 @@ -585,6 +585,12 @@ class ZorbaIsValidatedIterator; + class SeqSetIntersectIterator; + + class SeqSetUnionIterator; + + class SeqSetExceptIterator; + class FnConcatIterator; class FnIndexOfIterator; @@ -1587,6 +1593,15 @@ virtual void beginVisit ( const ZorbaIsValidatedIterator& ) = 0; virtual void endVisit ( const ZorbaIsValidatedIterator& ) = 0; + virtual void beginVisit ( const SeqSetIntersectIterator& ) = 0; + virtual void endVisit ( const SeqSetIntersectIterator& ) = 0; + + virtual void beginVisit ( const SeqSetUnionIterator& ) = 0; + virtual void endVisit ( const SeqSetUnionIterator& ) = 0; + + virtual void beginVisit ( const SeqSetExceptIterator& ) = 0; + virtual void endVisit ( const SeqSetExceptIterator& ) = 0; + virtual void beginVisit ( const FnConcatIterator& ) = 0; virtual void endVisit ( const FnConcatIterator& ) = 0; === modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp' --- src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-09-19 16:09:35 +0000 +++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-09-27 03:33:21 +0000 @@ -67,6 +67,7 @@ #include "runtime/random/random.h" #include "runtime/reference/reference.h" #include "runtime/schema/schema.h" +#include "runtime/seq/seq.h" #include "runtime/sequences/sequences.h" #include "runtime/store/documents.h" #include "runtime/store/maps.h" @@ -3762,6 +3763,48 @@ // </ZorbaIsValidatedIterator> +// <SeqSetIntersectIterator> +void PrinterVisitor::beginVisit ( const SeqSetIntersectIterator& a) { + thePrinter.startBeginVisit("SeqSetIntersectIterator", ++theId); + printCommons( &a, theId ); + thePrinter.endBeginVisit( theId ); +} + +void PrinterVisitor::endVisit ( const SeqSetIntersectIterator& ) { + thePrinter.startEndVisit(); + thePrinter.endEndVisit(); +} +// </SeqSetIntersectIterator> + + +// <SeqSetUnionIterator> +void PrinterVisitor::beginVisit ( const SeqSetUnionIterator& a) { + thePrinter.startBeginVisit("SeqSetUnionIterator", ++theId); + printCommons( &a, theId ); + thePrinter.endBeginVisit( theId ); +} + +void PrinterVisitor::endVisit ( const SeqSetUnionIterator& ) { + thePrinter.startEndVisit(); + thePrinter.endEndVisit(); +} +// </SeqSetUnionIterator> + + +// <SeqSetExceptIterator> +void PrinterVisitor::beginVisit ( const SeqSetExceptIterator& a) { + thePrinter.startBeginVisit("SeqSetExceptIterator", ++theId); + printCommons( &a, theId ); + thePrinter.endBeginVisit( theId ); +} + +void PrinterVisitor::endVisit ( const SeqSetExceptIterator& ) { + thePrinter.startEndVisit(); + thePrinter.endEndVisit(); +} +// </SeqSetExceptIterator> + + // <FnConcatIterator> void PrinterVisitor::beginVisit ( const FnConcatIterator& a) { thePrinter.startBeginVisit("FnConcatIterator", ++theId); === modified file 'src/runtime/visitors/pregenerated/printer_visitor.h' --- src/runtime/visitors/pregenerated/printer_visitor.h 2013-09-19 16:09:35 +0000 +++ src/runtime/visitors/pregenerated/printer_visitor.h 2013-09-27 03:33:21 +0000 @@ -888,6 +888,15 @@ void beginVisit( const ZorbaIsValidatedIterator& ); void endVisit ( const ZorbaIsValidatedIterator& ); + void beginVisit( const SeqSetIntersectIterator& ); + void endVisit ( const SeqSetIntersectIterator& ); + + void beginVisit( const SeqSetUnionIterator& ); + void endVisit ( const SeqSetUnionIterator& ); + + void beginVisit( const SeqSetExceptIterator& ); + void endVisit ( const SeqSetExceptIterator& ); + void beginVisit( const FnConcatIterator& ); void endVisit ( const FnConcatIterator& ); === modified file 'src/util/stl_util.h' --- src/util/stl_util.h 2013-08-23 11:15:04 +0000 +++ src/util/stl_util.h 2013-09-27 03:33:21 +0000 @@ -102,7 +102,7 @@ }; /** - * Specialization of std::equal_to for C strings. + * Specialization of ztd::equal_to for C strings. */ template<> struct equal_to<char const*> : === added file 'src/zorbautils/specializations.h' --- src/zorbautils/specializations.h 1970-01-01 00:00:00 +0000 +++ src/zorbautils/specializations.h 2013-09-27 03:33:21 +0000 @@ -0,0 +1,46 @@ +/* + * Copyright 2006-2013 The FLWOR Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ZORBA_SPECIALIZATIONS_H +#define ZORBA_SPECIALIZATIONS_H + +#include "store/api/item.h" +#include "util/hash/hash.h" + +namespace zorba { +namespace ztd { + +/////////////////////////////////////////////////////////////////////////////// + +/** Specialization for <code>store::Item*</code>. */ +template<> inline +size_t hash<store::Item*>::operator()( store::Item *item ) const { + return item->hash(); +} + +/** Specialization for <code>store::Item const*</code>. */ +template<> inline +size_t hash<store::Item const*>::operator()( store::Item const *item ) const { + return item->hash(); +} + +/////////////////////////////////////////////////////////////////////////////// + +} // namespace ztd +} // namespace zorba + +#endif /* ZORBA_SPECIALIZATIONS_H */ +/* vim:set et sw=2 ts=2: */ === added directory 'test/rbkt/ExpQueryResults/zorba/seq' === added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-set-except-01.xml.res' --- test/rbkt/ExpQueryResults/zorba/seq/seq-set-except-01.xml.res 1970-01-01 00:00:00 +0000 +++ test/rbkt/ExpQueryResults/zorba/seq/seq-set-except-01.xml.res 2013-09-27 03:33:21 +0000 @@ -0,0 +1,1 @@ +1 === added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-set-intersect-01.xml.res' --- test/rbkt/ExpQueryResults/zorba/seq/seq-set-intersect-01.xml.res 1970-01-01 00:00:00 +0000 +++ test/rbkt/ExpQueryResults/zorba/seq/seq-set-intersect-01.xml.res 2013-09-27 03:33:21 +0000 @@ -0,0 +1,1 @@ +2 3 === added file 'test/rbkt/ExpQueryResults/zorba/seq/seq-set-union-01.xml.res' --- test/rbkt/ExpQueryResults/zorba/seq/seq-set-union-01.xml.res 1970-01-01 00:00:00 +0000 +++ test/rbkt/ExpQueryResults/zorba/seq/seq-set-union-01.xml.res 2013-09-27 03:33:21 +0000 @@ -0,0 +1,1 @@ +1 2 3 4 === added directory 'test/rbkt/Queries/zorba/seq' === added file 'test/rbkt/Queries/zorba/seq/seq-set-except-01.xq' --- test/rbkt/Queries/zorba/seq/seq-set-except-01.xq 1970-01-01 00:00:00 +0000 +++ test/rbkt/Queries/zorba/seq/seq-set-except-01.xq 2013-09-27 03:33:21 +0000 @@ -0,0 +1,7 @@ +import module namespace seq = "http://zorba.io/modules/sequence"; + +let $s1 := (1, 1, 2, 3) +let $s2 := (2, 3, 3, 4, 4) +return seq:set-except( $s1, $s2 ) + +(: vim:set et sw=2 ts=2: :) === added file 'test/rbkt/Queries/zorba/seq/seq-set-intersect-01.xq' --- test/rbkt/Queries/zorba/seq/seq-set-intersect-01.xq 1970-01-01 00:00:00 +0000 +++ test/rbkt/Queries/zorba/seq/seq-set-intersect-01.xq 2013-09-27 03:33:21 +0000 @@ -0,0 +1,7 @@ +import module namespace seq = "http://zorba.io/modules/sequence"; + +let $s1 := (1, 1, 2, 3) +let $s2 := (2, 3, 3, 4, 4) +return seq:set-intersect( $s1, $s2 ) + +(: vim:set et sw=2 ts=2: :) === added file 'test/rbkt/Queries/zorba/seq/seq-set-union-01.xq' --- test/rbkt/Queries/zorba/seq/seq-set-union-01.xq 1970-01-01 00:00:00 +0000 +++ test/rbkt/Queries/zorba/seq/seq-set-union-01.xq 2013-09-27 03:33:21 +0000 @@ -0,0 +1,7 @@ +import module namespace seq = "http://zorba.io/modules/sequence"; + +let $s1 := (1, 1, 2, 3) +let $s2 := (2, 3, 3, 4, 4) +return seq:set-union( $s1, $s2 ) + +(: vim:set et sw=2 ts=2: :)
-- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp