tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkupp...@apache.org
Subject [tinkerpop] branch TINKERPOP-1849 updated: fixed issues mentioned by @spmallette
Date Mon, 10 Dec 2018 15:37:58 GMT
This is an automated email from the ASF dual-hosted git repository.

dkuppitz pushed a commit to branch TINKERPOP-1849
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/TINKERPOP-1849 by this push:
     new c6739f9  fixed issues mentioned by @spmallette
c6739f9 is described below

commit c6739f9302fede0974b004828f1980e2c362bd8b
Author: Daniel Kuppitz <daniel_kuppitz@hotmail.com>
AuthorDate: Mon Dec 10 08:37:44 2018 -0700

    fixed issues mentioned by @spmallette
---
 docs/src/reference/the-traversal.asciidoc | 16 +++++++++-------
 docs/src/upgrade/release-3.4.x.asciidoc   | 19 ++++++++++++++++++-
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index 3f55a33..028a14e 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -1087,34 +1087,36 @@ link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/grem
 [[index-step]]
 === Index Step
 
-The `index()`-step (*map*) indexes each element in the current collection. If the current
traverser's value is not a collection, then it's treated as a single-item collection. There
two indexers
+The `index()`-step (*map*) indexes each element in the current collection. If the current
traverser's value is not a collection, then it's treated as a single-item collection. There
are two indexers
 available, which can be chosen using the `with()` modulator. The list indexer (default) creates
a list for each collection item, with the first item being the original element and the second
element
 being the index. The map indexer created a linked hash map in which the index represents
the key and the original item is used as the value.
 
 [gremlin-groovy,modern]
 ----
+g.V().hasLabel("software").index()  <1>
 g.V().hasLabel("software").values("name").fold().
   order(Scope.local).
   index().
   unfold().
   order().
-    by(__.tail(Scope.local, 1))  <1>
+    by(__.tail(Scope.local, 1))     <2>
 g.V().hasLabel("software").values("name").fold().
   order(Scope.local).
   index().
     with(WithOptions.indexer, WithOptions.list).
   unfold().
   order().
-    by(__.tail(Scope.local, 1))  <2>
+    by(__.tail(Scope.local, 1))     <3>
 g.V().hasLabel("person").values("name").fold().
   order(Scope.local).
   index().
-    with(WithOptions.indexer, WithOptions.map)  <3>
+    with(WithOptions.indexer, WithOptions.map)  <4>
 ----
 
-<1> Index all software names in their alphabetical order.
-<2> Same as statement 1, but with an explicitely specified list indexer.
-<3> Index all person names in their alphabetical order and store the result in an ordered
map.
+<1> Indexing non-collection items results in multiple indexed single-item collections.
+<2> Index all software names in their alphabetical order.
+<3> Same as statement 1, but with an explicitely specified list indexer.
+<4> Index all person names in their alphabetical order and store the result in an ordered
map.
 
 *Additional References*
 
diff --git a/docs/src/upgrade/release-3.4.x.asciidoc b/docs/src/upgrade/release-3.4.x.asciidoc
index 4eaddb9..7621fe0 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -29,6 +29,23 @@ Please see the link:https://github.com/apache/tinkerpop/blob/3.4.0/CHANGELOG.asc
 
 === Upgrading for Users
 
+==== Indexing of collections
+
+TinkerPOp 3.4.0 adds a new `index()`-step, which allows users to transform simple collections
into index collections or maps.
+
+```
+gremlin> g.V().hasLabel("software").values("name").fold().
+......1>   order(local).
+......2>   index().unfold()
+==>[lop,0]
+==>[ripple,1]
+gremlin> g.V().hasLabel("person").values("name").fold().
+......1>   order(local).by(decr).
+......2>   index().
+......3>     with(WithOptions.indexer, WithOptions.map)
+==>[0:vadas,1:peter,2:marko,3:josh]
+```
+
 ==== Modulation of valueMap()
 
 The `valueMap()` step now supports `by` and `with` modulation, which also led to the deprecation
of `valueMap(true)` overloads.
@@ -753,4 +770,4 @@ The two deprecated synchronous `submit()` methods on the `RemoteConnection`
inte
 that `RemoteConnection` implementations will need to implement `submitAsync(Bytecode)` if
they have not already done
 so.
 
-See: link:https://issues.apache.org/jira/browse/TINKERPOP-2103[TINKERPOP-2103]
\ No newline at end of file
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-2103[TINKERPOP-2103]


Mime
View raw message