[Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-29 Thread David Graf
The proposal to merge lp:~davidagraf/zorba/paging into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-29 Thread David Graf
David Graf has proposed merging lp:~davidagraf/zorba/paging into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Till Westmann (tillw)

For more details, see:
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112775

Positional pagination
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112775
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-06-28 22:07:25 +
+++ ChangeLog	2012-06-29 13:52:27 +
@@ -10,6 +10,7 @@
 - fn:parse-xml-fragment#1
   * Added support for transient maps to the http://www.zorba-xquery.com/modules/store/data-structures/unordered-map module.
   * Added support for fragments to fn:path
+  * Positional pagination support for collections
 
 Optimizations:
   * Small optimization of comparison operations.

=== modified file 'modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq'
--- modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq	2012-06-28 04:14:03 +
+++ modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq	2012-06-29 13:52:27 +
@@ -615,6 +615,23 @@
 
 
 (:~
+ : The collection function returns the sequence of nodes and/or json items
+ : that belong to the collection identified by the given name.
+ :
+ : @param $name The name of the collection.
+ : @param $skip The number of collection items to skip.
+ :
+ : @return The sequence contained in the given collection.
+ :
+ : @error zerr:ZDDY0003 If available collections does not provide a mapping
+ :for the expanded QName $name.
+ :
+ :)
+declare function
+dml:collection($name as xs:QName, $skip as xs:integer) as item()* external;
+
+
+(:~
  : The collection-name function returns the name of the collection the given
  : item (node or json item) belongs to.
  :

=== modified file 'modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq'
--- modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq	2012-06-28 04:14:03 +
+++ modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq	2012-06-29 13:52:27 +
@@ -867,6 +867,23 @@
 
 
 (:~
+ : The collection function returns the sequence of nodes and/or json items
+ : that belong to the collection identified by the given name.
+ :
+ : @param $name The name of the collection.
+ : @param $skip The number of collection items to skip.
+ :
+ : @return The sequence contained in the given collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ :
+ :)
+declare function 
+cdml:collection($name as xs:QName, $skip as xs:integer) as item()*  external;
+
+
+(:~
  : The collection-name function returns the name of the collection the given
  : item (node or json item) belongs to.
  :

=== modified file 'src/functions/func_sequences_impl.cpp'
--- src/functions/func_sequences_impl.cpp	2012-06-28 04:14:03 +
+++ src/functions/func_sequences_impl.cpp	2012-06-29 13:52:27 +
@@ -543,20 +543,16 @@
 ZorbaCollectionIterator collection =
 static_castZorbaCollectionIterator(*argv[0]);
 
-if (collection.isDynamic())
-{
-  return new CountCollectionIterator(sctx,
- loc,
- collection.getChildren(),
- CountCollectionIterator::ZORBADYNAMIC);
-}
-else
-{
-  return new CountCollectionIterator(sctx,
- loc,
- collection.getChildren(),
- CountCollectionIterator::ZORBASTATIC);
-}
+return new CountCollectionIterator(
+ sctx,
+ loc,
+ collection.getChildren(),
+ (
+   collection.isDynamic()
+ ? CountCollectionIterator::ZORBADYNAMIC
+ : CountCollectionIterator::ZORBASTATIC
+ )
+   );
   }
   else if (typeid(FnCollectionIterator) == counted_type)
   {
@@ -600,10 +596,9 @@
 return new ProbeIndexRangeGeneralIterator(
 sctx, loc, lIter.getChildren(), true);
   }
-  else
-  {
-return new FnCountIterator(sctx, loc, argv);
-  }
+  
+  // fallback
+  return new FnCountIterator(sctx, loc, argv);
 }
 
 

=== modified file 'src/functions/pregenerated/func_collections.cpp'
--- src/functions/pregenerated/func_collections.cpp	2012-06-28 04:14:03 +
+++ src/functions/pregenerated/func_collections.cpp	2012-06-29 13:52:27 +
@@ -342,6 +342,19 @@
 
   {
 DECL_WITH_KIND(sctx, static_collections_dml_collection,
+(createQName(http://www.zorba-xquery.com/modules/store/static/collections/dml,,collection;), 
+GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
+GENV_TYPESYSTEM.INTEGER_TYPE_ONE, 
+GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR),
+

[Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-29 Thread David Graf
The proposal to merge lp:~davidagraf/zorba/paging into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112775
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112775
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-29 Thread Zorba Build Bot
Validation queue job paging-2012-06-29T13-48-12.365Z is finished. The final 
status was:

All tests succeeded!
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112775
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-29 Thread noreply
The proposal to merge lp:~davidagraf/zorba/paging into lp:zorba has been 
updated.

Status: Approved = Merged

For more details, see:
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112775
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112775
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-28 Thread David Graf
David Graf has proposed merging lp:~davidagraf/zorba/paging into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Till Westmann (tillw)

For more details, see:
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611

Positional pagination
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-06-28 04:14:03 +
+++ ChangeLog	2012-06-28 16:58:18 +
@@ -8,6 +8,7 @@
   * New XQuery 3.0 functions
 - fn:parse-xml-fragment#1
   * Added support for transient maps to the http://www.zorba-xquery.com/modules/store/data-structures/unordered-map module.
+	* Positional pagination support for collections
 
 Optimizations:
   * Small optimization of comparison operations.

=== modified file 'src/functions/func_sequences_impl.cpp'
--- src/functions/func_sequences_impl.cpp	2012-06-28 04:14:03 +
+++ src/functions/func_sequences_impl.cpp	2012-06-28 16:58:18 +
@@ -543,19 +543,19 @@
 ZorbaCollectionIterator collection =
 static_castZorbaCollectionIterator(*argv[0]);
 
-if (collection.isDynamic())
-{
-  return new CountCollectionIterator(sctx,
- loc,
- collection.getChildren(),
- CountCollectionIterator::ZORBADYNAMIC);
-}
-else
-{
-  return new CountCollectionIterator(sctx,
- loc,
- collection.getChildren(),
- CountCollectionIterator::ZORBASTATIC);
+/* no optimization if collection iterator skips nodes */
+if (!collection.hasSkip())
+{
+  return new CountCollectionIterator(
+   sctx,
+   loc,
+   collection.getChildren(),
+   (
+ collection.isDynamic()
+   ? CountCollectionIterator::ZORBADYNAMIC
+   : CountCollectionIterator::ZORBASTATIC
+   )
+ );
 }
   }
   else if (typeid(FnCollectionIterator) == counted_type)
@@ -600,10 +600,9 @@
 return new ProbeIndexRangeGeneralIterator(
 sctx, loc, lIter.getChildren(), true);
   }
-  else
-  {
-return new FnCountIterator(sctx, loc, argv);
-  }
+  
+  // fallback
+  return new FnCountIterator(sctx, loc, argv);
 }
 
 

=== modified file 'src/functions/pregenerated/func_collections.cpp'
--- src/functions/pregenerated/func_collections.cpp	2012-06-28 04:14:03 +
+++ src/functions/pregenerated/func_collections.cpp	2012-06-28 16:58:18 +
@@ -342,6 +342,19 @@
 
   {
 DECL_WITH_KIND(sctx, static_collections_dml_collection,
+(createQName(http://www.zorba-xquery.com/modules/store/static/collections/dml,,collection;), 
+GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
+GENV_TYPESYSTEM.INTEGER_TYPE_ONE, 
+GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR),
+FunctionConsts::STATIC_COLLECTIONS_DML_COLLECTION_2);
+
+  }
+
+
+
+
+  {
+DECL_WITH_KIND(sctx, static_collections_dml_collection,
 (createQName(http://www.zorba-xquery.com/modules/store/dynamic/collections/dml,,collection;), 
 GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
 GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR),
@@ -353,6 +366,19 @@
 
 
   {
+DECL_WITH_KIND(sctx, static_collections_dml_collection,
+(createQName(http://www.zorba-xquery.com/modules/store/dynamic/collections/dml,,collection;), 
+GENV_TYPESYSTEM.QNAME_TYPE_ONE, 
+GENV_TYPESYSTEM.INTEGER_TYPE_ONE, 
+GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR),
+FunctionConsts::DYNAMIC_COLLECTIONS_DML_COLLECTION_2);
+
+  }
+
+
+
+
+  {
 DECL_WITH_KIND(sctx, static_collections_dml_collection_name,
 (createQName(http://www.zorba-xquery.com/modules/store/static/collections/dml,,collection-name;), 
 GENV_TYPESYSTEM.ANY_NODE_TYPE_ONE, 

=== modified file 'src/functions/pregenerated/function_enum.h'
--- src/functions/pregenerated/function_enum.h	2012-06-28 04:14:03 +
+++ src/functions/pregenerated/function_enum.h	2012-06-28 16:58:18 +
@@ -54,7 +54,9 @@
   FN_COLLECTION_0,
   FN_COLLECTION_1,
   STATIC_COLLECTIONS_DML_COLLECTION_1,
+  STATIC_COLLECTIONS_DML_COLLECTION_2,
   DYNAMIC_COLLECTIONS_DML_COLLECTION_1,
+  DYNAMIC_COLLECTIONS_DML_COLLECTION_2,
   STATIC_COLLECTIONS_DML_COLLECTION_NAME_1,
   DYNAMIC_COLLECTIONS_DML_COLLECTION_NAME_1,
   STATIC_COLLECTIONS_DML_INDEX_OF_1,

=== modified file 'src/runtime/collections/collections_impl.cpp'
--- src/runtime/collections/collections_impl.cpp	2012-06-28 04:14:03 +
+++ src/runtime/collections/collections_impl.cpp	2012-06-28 16:58:18 +
@@ -369,7 +369,16 @@
   (void)getCollection(theSctx, name, loc, theIsDynamic, collection);
 
   // return the nodes of the collection
-  state-theIterator = collection-getIterator();
+  

[Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-28 Thread David Graf
The proposal to merge lp:~davidagraf/zorba/paging into lp:zorba has been 
updated.

Commit Message changed to:

Positional pagination

For more details, see:
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-28 Thread Matthias Brantner
Review: Needs Fixing

- code conventions in collections_impl.cpp
- getIterator(xs_integer aSkip)
  - should be getIterator(xs_integer aSkip) because xs_integer can be MAPM
  - could be one function with default parameter 0
- to_xs_long conversion in SimpleCollection can raise an error which should be 
caught somewhere in the iterator and a location needs to be added
- CollectionIter(SimpleCollection* collection, xs_integer aSkip); = 
CollectionIter(SimpleCollection* collection, xs_integer aSkip);
- store::Iterator_t getIterator(xs_integer aSkip); = store::Iterator_t 
getIterator(xs_integer aSkip);
- functions should be in the .xq modules and have documentation
- dml:collection(xs:QName(local:test2), -1) produces a segfault
- dml:collection(xs:QName(local:test2), x) produces a segfault if x is bigger 
than the size of the collection
- skip and count optimizations don't seem to play well together (maybe not 
needed)
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-28 Thread Till Westmann
Review: Approve


-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-28 Thread Matthias Brantner
Review: Approve

The documentation of the two functions is a little weak. For example, it 
doesn't say what's happening to the skip parameter if it's negative or bigger 
than the size of the collection. Also, it would make sense to say that the 
function also makes sense for unordered collections because nodes are returned 
in a stable order.
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-28 Thread Till Westmann
The proposal to merge lp:~davidagraf/zorba/paging into lp:zorba has been 
updated.

Commit Message changed to:

add positional skipping to access of static and dynamic collections

For more details, see:
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-28 Thread Till Westmann
The proposal to merge lp:~davidagraf/zorba/paging into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-28 Thread Zorba Build Bot
Attempt to merge into lp:zorba failed due to conflicts: 

text conflict in ChangeLog
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~davidagraf/zorba/paging into lp:zorba

2012-06-28 Thread Zorba Build Bot
The proposal to merge lp:~davidagraf/zorba/paging into lp:zorba has been 
updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
-- 
https://code.launchpad.net/~davidagraf/zorba/paging/+merge/112611
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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