You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2018/01/21 01:04:08 UTC

[01/21] tinkerpop git commit: Added docker build param KEEP_CONTAINER to not remove container by default - CTR [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1447 3450aa4a8 -> bca37a888 (forced update)


Added docker build param KEEP_CONTAINER to not remove container by default - CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/47cebd48
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/47cebd48
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/47cebd48

Branch: refs/heads/TINKERPOP-1447
Commit: 47cebd482723210ea983341d05cea81de8a2c0d7
Parents: e042879
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Dec 27 09:10:25 2017 -0500
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Dec 27 09:10:25 2017 -0500

----------------------------------------------------------------------
 docker/build.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/47cebd48/docker/build.sh
----------------------------------------------------------------------
diff --git a/docker/build.sh b/docker/build.sh
index a102f83..7b83d29 100755
--- a/docker/build.sh
+++ b/docker/build.sh
@@ -31,6 +31,9 @@ function cleanup {
 }
 trap cleanup EXIT
 
+REMOVE_CONTAINER="--rm"
+[[ -n ${KEEP_CONTAINER} ]] && unset REMOVE_CONTAINER
+
 case "$1" in
   -h | --help ) ${DIR}/scripts/build.sh -h; exit 0 ;;
 esac
@@ -47,6 +50,6 @@ CMD ["sh", "-c", "docker/scripts/build.sh $@"]
 EOF
 
 docker build -t tinkerpop:${BUILD_TAG} .
-docker run ${TINKERPOP_DOCKER_OPTS} --rm -ti tinkerpop:${BUILD_TAG}
+docker run ${TINKERPOP_DOCKER_OPTS} ${REMOVE_CONTAINER} -ti tinkerpop:${BUILD_TAG}
 
 popd > /dev/null


[12/21] tinkerpop git commit: Update changelog and minor tweak to if statement null check CTR

Posted by dk...@apache.org.
Update changelog and minor tweak to if statement null check CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c4b0f9de
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c4b0f9de
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c4b0f9de

Branch: refs/heads/TINKERPOP-1447
Commit: c4b0f9de04fda08db5b6b03a91ba58f3def0217a
Parents: 7e80bcc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jan 8 12:43:38 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jan 8 12:43:38 2018 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                                 | 1 +
 .../apache/tinkerpop/gremlin/driver/message/RequestMessage.java    | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c4b0f9de/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 06261fd..ed32f05 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-2-8]]
 === TinkerPop 3.2.8 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Delayed setting of the request identifier until `RequestMessage` construction by the builder.
 
 [[release-3-2-7]]
 === TinkerPop 3.2.7 (Release Date: December 17, 2017)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c4b0f9de/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/RequestMessage.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/RequestMessage.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/RequestMessage.java
index e836568..dc10baf 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/RequestMessage.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/RequestMessage.java
@@ -155,7 +155,7 @@ public final class RequestMessage {
          * Create the request message given the settings provided to the {@link Builder}.
          */
         public RequestMessage create() {
-            return new RequestMessage(requestId == null ? UUID.randomUUID() : requestId, op, processor, args);
+            return new RequestMessage(null == requestId ? UUID.randomUUID() : requestId, op, processor, args);
         }
     }
 


[20/21] tinkerpop git commit: Fixed issue that accidentally caused non-source code blocks to slip into the new tabbified view. cc/ @robertdale

Posted by dk...@apache.org.
Fixed issue that accidentally caused non-source code blocks to slip into the new tabbified view.
cc/ @robertdale


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/617f623f
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/617f623f
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/617f623f

Branch: refs/heads/TINKERPOP-1447
Commit: 617f623ff21f4b1aca06be45415c4b9a6ae9d0a7
Parents: f1d15f4
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Tue Jan 2 10:41:14 2018 -0700
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Sat Jan 20 18:03:58 2018 -0700

----------------------------------------------------------------------
 docs/preprocessor/awk/tabify.awk      | 4 ++--
 docs/src/dev/provider/index.asciidoc  | 4 ++--
 docs/src/recipes/index.asciidoc       | 4 ++--
 docs/src/reference/the-graph.asciidoc | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/617f623f/docs/preprocessor/awk/tabify.awk
----------------------------------------------------------------------
diff --git a/docs/preprocessor/awk/tabify.awk b/docs/preprocessor/awk/tabify.awk
index bc8d644..df92734 100644
--- a/docs/preprocessor/awk/tabify.awk
+++ b/docs/preprocessor/awk/tabify.awk
@@ -61,7 +61,7 @@ BEGIN {
   code = ""
 }
 
-/^\[source,/ {
+/^\[source,(csharp|groovy|java|python)/ {
   if (status == 3) {
     status = 1
     lang = gensub(/^\[source,([^\]]+).*/, "\\1", "g", $0)
@@ -69,7 +69,7 @@ BEGIN {
   }
 }
 
-! /^\[source,/ {
+! /^\[source,(csharp|groovy|java|python)/ {
   if (status == 3 && $0 != "") {
     print_tabs(next_id, tabs, blocks)
     next_id = next_id + length(tabs)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/617f623f/docs/src/dev/provider/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/provider/index.asciidoc b/docs/src/dev/provider/index.asciidoc
index 926602a..16d4e8b 100644
--- a/docs/src/dev/provider/index.asciidoc
+++ b/docs/src/dev/provider/index.asciidoc
@@ -611,7 +611,7 @@ features it implements) or should not otherwise be executed.  It is possible for
 by using the `@Graph.OptOut` annotation.  The following is an example of this annotation usage as taken from
 `HadoopGraph`:
 
-[source, java]
+[source,java]
 ----
 @Graph.OptIn(Graph.OptIn.SUITE_PROCESS_STANDARD)
 @Graph.OptIn(Graph.OptIn.SUITE_PROCESS_COMPUTER)
@@ -648,7 +648,7 @@ Also note that some of the tests in the Gremlin Test Suite are parameterized tes
 specificity to be properly ignored.  To ignore these types of tests, examine the name template of the parameterized
 tests.  It is defined by a Java annotation that looks like this:
 
-[source, java]
+[source,java]
 @Parameterized.Parameters(name = "expect({0})")
 
 The annotation above shows that the name of each parameterized test will be prefixed with "expect" and have

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/617f623f/docs/src/recipes/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/index.asciidoc b/docs/src/recipes/index.asciidoc
index c59cc89..3fdee22 100644
--- a/docs/src/recipes/index.asciidoc
+++ b/docs/src/recipes/index.asciidoc
@@ -90,12 +90,12 @@ prior to submitting a recipe.
 
 To contribute a recipe, first clone the repository:
 
-[source, shell]
+[source,shell]
 git clone https://github.com/apache/tinkerpop.git
 
 The recipes can be found in this directory:
 
-[source, shell]
+[source,shell]
 ls docs/src/recipes
 
 Each recipe exists within a separate `.asciidoc` file.  The file name should match the name of the recipe. Recipe names

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/617f623f/docs/src/reference/the-graph.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graph.asciidoc b/docs/src/reference/the-graph.asciidoc
index 339b392..fa8cdb5 100644
--- a/docs/src/reference/the-graph.asciidoc
+++ b/docs/src/reference/the-graph.asciidoc
@@ -721,7 +721,7 @@ f.close()
 Creating a GraphSON 2.0 mapper is done by calling `.version(GraphSONVersion.V2_0)` on the mapper builder. Here's is the
 example output from the code above:
 
-[source, json]
+[source,json]
 ----
 {
     "@type": "g:Vertex",


[21/21] tinkerpop git commit: transformed callouts to enable easy copy/pasting from code tabs

Posted by dk...@apache.org.
transformed callouts to enable easy copy/pasting from code tabs


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/bca37a88
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/bca37a88
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/bca37a88

Branch: refs/heads/TINKERPOP-1447
Commit: bca37a888f859c8d582d362e89f6938db44da5b5
Parents: 617f623
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Wed Jan 3 10:13:06 2018 -0700
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Sat Jan 20 18:03:58 2018 -0700

----------------------------------------------------------------------
 docs/preprocessor/awk/tabify.awk | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bca37a88/docs/preprocessor/awk/tabify.awk
----------------------------------------------------------------------
diff --git a/docs/preprocessor/awk/tabify.awk b/docs/preprocessor/awk/tabify.awk
index df92734..24d42a6 100644
--- a/docs/preprocessor/awk/tabify.awk
+++ b/docs/preprocessor/awk/tabify.awk
@@ -47,6 +47,10 @@ function print_tabs(next_id, tabs, blocks) {
   print "++++\n"
 }
 
+function transform_callouts(code, c) {
+  return gensub(/\s*((<[0-9]+>\s*)*<[0-9]+>)\s*\n/, " " c c " \\1\\2\n", "g", code)
+}
+
 BEGIN {
   id_part=systime()
   status = 0
@@ -98,7 +102,15 @@ BEGIN {
         i++
       }
       tabs[i] = lang
-      blocks[i] = "[source," lang "]" code "\n" $0 "\n"
+      switch (lang) {
+        case "python":
+          c = "#"
+          break
+        default:
+          c = "//"
+          break
+      }
+      blocks[i] = "[source," lang "]" transform_callouts(code, c) "\n" $0 "\n"
     }
   } else {
     if (status == 0) print


[13/21] tinkerpop git commit: Removed a hardcoded expectation in test suite around metrics serialization CTR

Posted by dk...@apache.org.
Removed a hardcoded expectation in test suite around metrics serialization CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a94baa0e
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a94baa0e
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a94baa0e

Branch: refs/heads/TINKERPOP-1447
Commit: a94baa0e017ff40f45642b1b1286e5e1cfc7c391
Parents: c4b0f9d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jan 11 09:57:27 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jan 11 09:57:27 2018 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                             | 1 +
 .../apache/tinkerpop/gremlin/structure/SerializationTest.java  | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a94baa0e/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ed32f05..c388425 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -24,6 +24,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 === TinkerPop 3.2.8 (Release Date: NOT OFFICIALLY RELEASED YET)
 
 * Delayed setting of the request identifier until `RequestMessage` construction by the builder.
+* Removed hardcoded expectation in metrics serialization test suite as different providers may have different outputs.
 
 [[release-3-2-7]]
 === TinkerPop 3.2.7 (Release Date: December 17, 2017)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a94baa0e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
index 4dacf48..1de30de 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
@@ -213,7 +213,7 @@ public class SerializationTest {
             final GryoWriter gryoWriter = gryoIo.writer().create();
             final GryoReader gryoReader = gryoIo.reader().create();
 
-            final TraversalMetrics before = (TraversalMetrics) g.V().both().profile().next();
+            final TraversalMetrics before = g.V().both().profile().next();
             final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
             gryoWriter.writeObject(outputStream, before);
 
@@ -355,7 +355,7 @@ public class SerializationTest {
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeTraversalMetrics() throws Exception {
             final ObjectMapper mapper = graph.io(GraphSONIo.build()).mapper().create().createMapper();
-            final TraversalMetrics tm = (TraversalMetrics) g.V().both().profile().next();
+            final TraversalMetrics tm = g.V().both().profile().next();
             final String json = mapper.writeValueAsString(tm);
             final Map<String, Object> m = mapper.readValue(json, mapTypeReference);
 
@@ -363,7 +363,7 @@ public class SerializationTest {
             assertTrue(m.containsKey(GraphSONTokens.METRICS));
 
             final List<Map<String, Object>> metrics = (List<Map<String, Object>>) m.get(GraphSONTokens.METRICS);
-            assertEquals(2, metrics.size());
+            assertEquals(tm.getMetrics().size(), metrics.size());
 
             final Map<String, Object> metrics0 = metrics.get(0);
             assertTrue(metrics0.containsKey(GraphSONTokens.ID));


[15/21] tinkerpop git commit: Added some more details on collections recipe for List CTR

Posted by dk...@apache.org.
Added some more details on collections recipe for List CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/4eb80bd4
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/4eb80bd4
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/4eb80bd4

Branch: refs/heads/TINKERPOP-1447
Commit: 4eb80bd4878d455bff761c091b8fcd8414d59660
Parents: 586e432
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jan 16 14:31:55 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jan 16 14:31:55 2018 -0500

----------------------------------------------------------------------
 docs/src/recipes/collections.asciidoc | 282 ++++++++++++++++++++++++++++-
 1 file changed, 279 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4eb80bd4/docs/src/recipes/collections.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/collections.asciidoc b/docs/src/recipes/collections.asciidoc
index 446ed46..5db1e6b 100644
--- a/docs/src/recipes/collections.asciidoc
+++ b/docs/src/recipes/collections.asciidoc
@@ -21,9 +21,237 @@ image:gremlin-collections.png[width=400]
 
 Lists and maps form the basis for much of the processing in Gremlin traversals. They are core to how side-effects
 are typically held and how results are generally produced. Being able to pick them apart and reformat them is sometimes
-required.
+required. This need to shape the date within a traversal may arise both at the
+link:http://tinkerpop.apache.org/docs/current/reference/#terminal-steps[terminal step] of the traversal (technically
+just prior to the terminal step) or in the middle of a traversal. Considering the former, a transformation just prior
+to iteration will get the result into the form required by the application which would remove the need for additional
+application level manipulation. Moreover, a transformation at this stage may reduce the size of the payload being
+returned which could be useful in remote applications. Examining the latter, there may be times where a `List` or `Map`
+requires some mid-traversal transformation so as to continue with the general logic of the traversal itself. For
+example, a traversal at some point might produce a `Map` of `List` objects where the lists contain vertices, where each
+`List` might need to be sorted by some criteria and then the top item for each extracted to become the basis for the
+continued traversal. Executing transformations for either of these types of situations can be made possible with the
+patterns described in this section.
 
-One of the most common ways to end up with a `Map` is with `valueMap()`:
+The appearance of a `List` as a traverser in Gremlin usually arises as a result of a `fold()` operation, but may also
+appear by way of some side-effect steps like `store()`:
+
+[gremlin-groovy,modern]
+----
+g.V().fold()
+g.V().store('a').cap('a')
+----
+
+It is worth noting that while a `Path` is not technically a `List` it does present like one and can be manipulated in
+similar fashion to lists:
+
+[gremlin-groovy,modern]
+----
+g.V().out().out().path()
+----
+
+These examples are obviously trivial and there are other ways that a traverser might end up in a `List` form, but, at
+this moment, the point here is to focus less on how to get a `List` and more on how to manipulate one within the
+Gremlin language. The examples going forward will also be similarly contrived insofar as producing a usable `List` to
+manipulate. Bear in mind that it may be quite possible to get the same end results of these examples using more direct
+means than what is demonstrated.
+
+It may seem simple, but the most obvious choice to modifying what is in a list is to simply `unfold()` the `List`:
+
+[gremlin-groovy,modern]
+----
+g.V().fold().unfold().values('name')
+g.V().store('a').cap('a').unfold().values('name')
+----
+
+The above examples show that `unfold()` works quite well when you want don't want to preserve the `List` structure of
+the traverser as it just flattens `List` traversers to the traversal stream. The above examples only have one `List`
+as a result, but consider what happens when there is more than one:
+
+[gremlin-groovy,modern]
+----
+g.V().union(fold(),fold())
+g.V().union(fold(),fold()).unfold().values('name')
+----
+
+The two separate `List` traversers are flattened to a single traversal stream and all the results are mixed together.
+While this approach may be acceptable, there are many cases where it might not be so. To preserve the individual
+structure of the `List` traversers "locally" `unfold()` the lists to transform them:
+
+[gremlin-groovy,modern]
+----
+g.V().
+  union(fold(),fold()).
+  local(unfold().values('name').fold())
+----
+
+The call to `local()` executes its anonymous sub-traversal over each individual `List` iterator and as the
+sub-traversal ends with a `fold()` step, the results are reduced back into a `List` to preserve the original structure,
+thus maintaining two traverser results.
+
+This pattern for unfolding and folding `List` traversers ends up having other applications:
+
+[gremlin-groovy,modern]
+----
+g.V().union(limit(3).fold(),tail(3).fold())    <1>
+g.V().union(limit(3).fold(),tail(3).fold()).
+  local(unfold().                              <2>
+        order().
+          by(bothE().count(),decr).
+        limit(1).
+        fold())
+g.V().union(limit(3).fold(),tail(3).fold()).   <3>
+  local(unfold().
+        has('age',gte(29)).
+        values('age').
+        mean())
+----
+
+<1> The output consists of two `List` traversers.
+<2> For each `List` of vertices, order them by their number of edges, and choose the first one which will be the one
+with the highest degree (i.e. number of edges). By ending with `fold()` the `List` traverser structure is preserved
+thus returning two `List` objects. Consider this a method for choosing a "max" or a highly ranked vertex. In this case
+the rank was determined by the number of edges, but it could have just as easily been determined by a vertex property,
+edge property, a calculated value, etc. - one simply needs to alter the `by()` step modulator to `order()`.
+<3> For each `List` of vertices, filter that `List` to only include vertices that have an "age" property with a
+value greater than or equal to "29" and then average the results of each list. More generally, consider how this
+approach performs some kind of reducing calculation on each `List` traverser. In this case, an average was calculated,
+but it might also have been a `sum()`, `count()` or similar operation that reduced the list to a single calculated
+value.
+
+So far, this section has focused on what to do with a `List` traverser once there is one present and there have been
+fairly contrived examples for how to produce one in the first place. The use of `fold()` has been used most frequently
+at this point to achieve list creation and that step should be recalled whenever there is a need to reduce some
+traversal stream to an actual `List`. Of course, it may become necessary to more manually construct a `List`,
+especially in cases where the expected output of the traversal is composed of one or more ordered results in the
+form of a `List`. For example, consider the following three traversals:
+
+[gremlin-groovy,modern]
+----
+g.V().has('name','marko').values('age')     <1>
+g.V().has('name','marko').                  <2>
+  repeat(out()).
+    until(has('lang','java')).
+  path().
+    by('name')
+g.V().has('name','marko').                  <3>
+  repeat(outE().inV()).
+    until(has('lang','java')).
+  path().
+  local(unfold().
+        has('weight').
+        values('weight').
+        mean())
+----
+
+<1> Get the age of "marko"
+<2> get the "name" values of the vertices in the collected paths that traverse out from "marko" to any vertex with
+the "lang" of "java".
+<3> Get the average of the "weight" values of edges in the collected paths that traverse out from "marko" to any vertex
+with the "lang" of "java". Note the use of the earlier defined pattern that used `local()` in conjunction with
+`unfold()`. In this case it filters out vertices from the `Path` as they are not relevant as the concern is only with
+the "weight" property on the edges.
+
+For purposes of this example, the three traversals above happen to represent three pieces of data that are required by
+an application. It is plain to note that all of the above traversals hold a similar pattern that starts with
+"getting 'marko'" and, in the case of the latter two, traversing on outgoing edges away from him and collecting data
+from that path. Ideally, all three of these traversals should execute as one to prevent having to submit three separate
+traversals, thus incurring additional query execution costs for what amounts to be largely the same underlying data but
+with different transformations applied. The goal here would be to return the results of this data as a `List` with
+three results (i.e. triple) that could then be submitted once by the application. The following example demonstrates
+the use of `store()` to aid in construction of this `List`:
+
+[gremlin-groovy,modern]
+----
+g.V().has('name','marko').as('v').                             <1>
+  store('a').                                                  <2>
+    by('age').
+  repeat(outE().as('e').inV().as('v')).                        <3>
+    until(has('lang','java')).
+  aggregate('b').                                              <4>
+    by(select(all,'v').unfold().values('name').fold()).
+  aggregate('c').                                              <5>
+    by(select(all,'e').unfold().values('weight').mean()).
+  fold().                                                      <6>
+  store('a').                                                  <7>
+    by(cap('b')).
+  store('a').                                                  <8>
+    by(cap('c')).
+  cap('a')
+----
+
+<1> Get the "marko" vertex and label that step as "v".
+<2> Store the first "age" of "marko" as the first item in the `List` called "a", which will ultimately be the result.
+<3> Execute the traversal away from "marko" and continue to traverse on outgoing edges until the vertex has the value
+of "java" for the "lang" property. Note the labels of "e" and "v". Note that "e" will contain a `List` of all of the
+edges that have been traversed and "v" will contain a `List` of all the vertices that have been traversed.
+<4> The incoming traverser to `aggregate('b')` are vertices that terminate the `repeat()` (i.e. those with the "lang"
+of "java"). Note however that the `by()` modulator overrides that traverser completely by starting a fresh stream of
+the list of vertices in "v". Those vertices are unfolded to retrieve the name property from each and then are reduced
+with `fold()` back into a list to be stored in the side-effected named "b".
+<5> A similar use of `aggregate()` as the previous step, though this one turns "e" into a stream of edges to calculate
+the `mean()` to store in a `List` called "c". Note that `aggregate()` was used here instead of `store()`, as
+the former is an eager collection of the elements in the stream (`store()` is lazy) and will force the traversal to be
+iterated up to that point before moving forward. Without that eager collection, "v" and "e" would not contain the
+complete information required for the production of "b" and "c".
+<6> Adding `fold()` step here is a bit of a trick. To see the trick, copy and paste all lines of Gremlin up to but
+not including this `fold()` step and run them against the "modern" graph. The output is three vertices and if the
+`profile()` step was added one would also see that the traversal contained three traversers. These three traversers
+with a vertex in each one were produced from the `repeat()` step (i.e. those vertices that had the "lang" of "java"
+when traversing away from "marko"). The `aggregate()` steps are side-effects and just allow the traversers to pass
+through them unchanged. The `fold()` obviously converts those three traversers to a single `List` to make one
+traverser with a `List` inside. That means that the remaining steps following the `fold()` will only be executed one
+time each instead of three, which, as will be shown, is critical to the proper result.
+<7> The single traverser with the `List` of three vertices in it passes to `store()`. The `by()` modulator presents an
+override telling Gremlin to ignore the `List` of three vertices and simply grab the "b" side effect created earlier and
+stick that into "a" as part of the result. The `List` with three vertices passes out unchanged as `store()` is a
+side-effect step.
+<8> Again, the single traverser with the `List` of three vertices passes to `store()` and again, the `by()` modulator
+presents an override to include "c" into the result.
+
+All of the above code and explanation show that `store()` can be used to construct `List` objects as side-effects
+which can then be used as a result. Note that `aggregate()` can be used to similar effect, should it make sense that
+lazy `List` creation is not acceptable with respect to the nature of the traversal. An interesting sub-pattern that
+emerges here is that the `by()` step can modulate its step to completely override the current traverser and ignore its
+contents for purpose of that step. This ability to override a traverser acts as a powerful and flexible tool as it
+means that each traverser can effectively become a completely different object as determined by a sub-traversal.
+
+Another interesting method for `List` creation was demonstrated a bit earlier but not examined in detail - the use of
+`union()`. It was shown earlier in the following context where it helped create a `List` of two lists of three
+vertices each:
+
+[gremlin-groovy,modern]
+----
+g.V().union(limit(3).fold(),tail(3).fold())
+----
+
+By folding the results of `union()`, it becomes possible to essentially construct lists with arbitrary traversal
+results.
+
+[gremlin-groovy,modern]
+----
+g.V().
+  local(union(identity(),                   <1>
+              bothE().count()).
+        fold())
+g.V().
+  store('x').
+    by(union(select('x').count(local),      <2>
+             identity(),
+             bothE().count()).
+             fold()).
+  cap('x')
+----
+
+<1> For each vertex, create a "pair" (i.e. a `List` of two objects) of the vertex itself and its edge count.
+<2> For each vertex, create a "triple" (i.e. a `List`of three objects) of the index of the vertex (starting at zero),
+the vertex itself and its edge count.
+
+The pattern here is to use `union()` in conjunction with `fold()`. As explained earlier, the `fold()` operation reduces
+the stream from `union()` to a single `List` that is then fed forward to the next step in the traversal.
+
+Now that `List` patterns have been explained, there can now be some attention on `Map`. One of the most common ways
+to end up with a `Map` is with `valueMap()`:
 
 [gremlin-groovy,modern]
 ----
@@ -64,4 +292,52 @@ on that sub-traversal (it does not iterate the entire thing).
 Generally speaking, a `Map` constructed as part of `group()` or `project()` will already be in the form required as
 the `by()` modulators would be written in such a fashion as to produce that final output. It would be unnecessary to
 deconstruct/reconstruct it. Be certain that there isn't a way to re-write the `group()` or `project()` to get the
-desired output before taking this approach.
\ No newline at end of file
+desired output before taking this approach.
+
+In the following case, `project()` is used to create a `Map` that does not meet this requirement as it contains some
+unavoidable extraneous keys in the output `Map`:
+
+[gremlin-groovy,modern]
+----
+g.V().
+  project('name','age','lang').
+    by('name').
+    by(coalesce(values('age'),constant('n/a'))).
+    by(coalesce(values('lang'),constant('n/a')))
+----
+
+The use of `coalesce()` works around the problem where "age" and "lang" are not necessarily property keys present on
+every single vertex in the traversal stream. When the "age" or "lang" are not present, the constant of "n/a" is
+supplied. While this may be an acceptable output, it is possible to shape the `Map` to be "nicer":
+
+[gremlin-groovy,modern]
+----
+g.V().
+  project('name','age','lang').
+    by('name').
+    by(coalesce(values('age'),constant('n/a'))).
+    by(coalesce(values('lang'),constant('n/a'))).
+  local(unfold().
+        filter(select(values).is(P.neq('n/a'))).
+        group().
+          by(keys).
+          by(values))
+----
+
+The addition steps above `unfold()` the `Map` to key-value entries and filter the values for "n/a" and remove them
+prior to reconstructing the `Map` with the method shown earlier. To go a step further, apply the pattern presented
+earlier to flatten `List` values within a `Map`:
+
+[gremlin-groovy,modern]
+----
+g.V().
+  project('name','age','lang').
+    by('name').
+    by(coalesce(values('age'),constant('n/a'))).
+    by(coalesce(values('lang'),constant('n/a'))).
+  local(unfold().
+        filter(select(values).is(P.neq('n/a'))).
+        group().
+          by(keys).
+          by(select(values).unfold()))
+----
\ No newline at end of file


[19/21] tinkerpop git commit: Added automatic tab generation for code snippets in asciidoc files.

Posted by dk...@apache.org.
Added automatic tab generation for code snippets in asciidoc files.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f1d15f40
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f1d15f40
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f1d15f40

Branch: refs/heads/TINKERPOP-1447
Commit: f1d15f4068e40b60337979a054919c27008b315f
Parents: 231bbb6
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Fri Dec 15 14:30:59 2017 -0700
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Sat Jan 20 18:03:58 2018 -0700

----------------------------------------------------------------------
 docs/postprocessor/processor.awk     |   4 +
 docs/preprocessor/awk/tabify.awk     | 108 ++++++++++++++++++
 docs/preprocessor/preprocess-file.sh |   4 +-
 docs/sass/compile                    |  30 +++++
 docs/sass/tabs.scss                  | 178 ++++++++++++++++++++++++++++++
 docs/stylesheets/tabs.css            |  19 ++++
 6 files changed, 342 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1d15f40/docs/postprocessor/processor.awk
----------------------------------------------------------------------
diff --git a/docs/postprocessor/processor.awk b/docs/postprocessor/processor.awk
index 18ada47..da82420 100644
--- a/docs/postprocessor/processor.awk
+++ b/docs/postprocessor/processor.awk
@@ -33,6 +33,10 @@ BEGIN {
   }
 }
 
+/<body/ {
+  print "<link rel=\"stylesheet\" href=\"/docs/x.y.z/stylesheets/tabs.css\" />"
+}
+
 !/<span class="comment">/ {
   if (firstMatch || !isHeader) {
     print gensub(/(<b class="conum">)\(([0-9]+)\)(<\/b>)/,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1d15f40/docs/preprocessor/awk/tabify.awk
----------------------------------------------------------------------
diff --git a/docs/preprocessor/awk/tabify.awk b/docs/preprocessor/awk/tabify.awk
new file mode 100644
index 0000000..bc8d644
--- /dev/null
+++ b/docs/preprocessor/awk/tabify.awk
@@ -0,0 +1,108 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+#
+# @author Daniel Kuppitz (http://gremlin.guru)
+#
+function print_tabs(next_id, tabs, blocks) {
+
+  num_tabs = length(tabs)
+  x = next_id
+
+  print "++++"
+  print "<section class=\"tabs tabs-" num_tabs "\">"
+
+  for (i in tabs) {
+    title = tabs[i]
+    print "  <input id=\"tab-" id_part "-" x "\" type=\"radio\" name=\"radio-set-" id_part "-" next_id "\" class=\"tab-selector-" i "\"" (i == 1 ? " checked=\"checked\"" : "") " />"
+    print "  <label for=\"tab-" id_part "-" x "\" class=\"tab-label-" i "\">" title "</label>"
+    x++
+  }
+
+  for (i in blocks) {
+    print "  <div class=\"tabcontent\">"
+    print "    <div class=\"tabcontent-" i "\">"
+    print "++++\n"
+    print blocks[i]
+    print "++++"
+    print "    </div>"
+    print "  </div>"
+  }
+
+  print "</section>"
+  print "++++\n"
+}
+
+BEGIN {
+  id_part=systime()
+  status = 0
+  next_id = 1
+  block[0] = 0 # initialize "blocks" as an array
+  delete blocks[0]
+}
+
+/^\[gremlin-/ {
+  status = 1
+  lang = gensub(/^\[gremlin-([^,\]]+).*/, "\\1", "g", $0)
+  code = ""
+}
+
+/^\[source,/ {
+  if (status == 3) {
+    status = 1
+    lang = gensub(/^\[source,([^\]]+).*/, "\\1", "g", $0)
+    code = ""
+  }
+}
+
+! /^\[source,/ {
+  if (status == 3 && $0 != "") {
+    print_tabs(next_id, tabs, blocks)
+    next_id = next_id + length(tabs)
+    for (i in tabs) {
+      delete tabs[i]
+      delete blocks[i]
+    }
+    status = 0
+  }
+}
+
+/^----$/ {
+  if (status == 1) {
+    status = 2
+  } else if (status == 2) {
+    status = 3
+  }
+}
+
+{ if (status == 3) {
+    if ($0 == "----") {
+      i = length(blocks) + 1
+      if (i == 1) {
+        tabs[i] = "console (" lang ")"
+        blocks[i] = code_header code "\n" $0 "\n"
+        i++
+      }
+      tabs[i] = lang
+      blocks[i] = "[source," lang "]" code "\n" $0 "\n"
+    }
+  } else {
+    if (status == 0) print
+    else if (status == 1) code_header = $0
+    else code = code "\n" $0
+  }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1d15f40/docs/preprocessor/preprocess-file.sh
----------------------------------------------------------------------
diff --git a/docs/preprocessor/preprocess-file.sh b/docs/preprocessor/preprocess-file.sh
index 0ca534a..ab98340 100755
--- a/docs/preprocessor/preprocess-file.sh
+++ b/docs/preprocessor/preprocess-file.sh
@@ -129,6 +129,7 @@ if [ ! ${SKIP} ] && [ $(grep -c '^\[gremlin' ${input}) -gt 0 ]; then
   fi
 
   sed 's/\t/    /g' ${input} |
+  awk -f ${AWK_SCRIPTS}/tabify.awk |
   awk -f ${AWK_SCRIPTS}/prepare.awk |
   awk -f ${AWK_SCRIPTS}/init-code-blocks.awk -v TP_HOME="${TP_HOME}" -v PYTHONPATH="${TP_HOME}/gremlin-python/target/classes/Lib" |
   awk -f ${AWK_SCRIPTS}/progressbar.awk -v tpl=${AWK_SCRIPTS}/progressbar.groovy.template |
@@ -138,8 +139,9 @@ if [ ! ${SKIP} ] && [ $(grep -c '^\[gremlin' ${input}) -gt 0 ]; then
   ${lb} awk -f ${AWK_SCRIPTS}/cleanup.awk  |
   ${lb} awk -f ${AWK_SCRIPTS}/language-variants.awk > ${output}
 
+  # check exit code for each of the previously piped commands
   ps=(${PIPESTATUS[@]})
-  for i in {0..6}; do
+  for i in {0..9}; do
     ec=${ps[i]}
     [ ${ec} -eq 0 ] || break
   done

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1d15f40/docs/sass/compile
----------------------------------------------------------------------
diff --git a/docs/sass/compile b/docs/sass/compile
new file mode 100755
index 0000000..002954e
--- /dev/null
+++ b/docs/sass/compile
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+#
+
+DIR=`dirname $0`
+
+IF="${DIR}/tabs.scss"
+OF="${DIR}/../stylesheets/tabs.css"
+TF=`mktemp`
+
+scss --sourcemap=none -t compressed -C ${IF} ${OF}
+
+cat ${DIR}/../stylesheets/tinkerpop.css | awk 'BEGIN {p=1} {if (p) print} /\*\// {p=0}' | cat - ${OF} > ${TF} && mv ${TF} ${OF}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1d15f40/docs/sass/tabs.scss
----------------------------------------------------------------------
diff --git a/docs/sass/tabs.scss b/docs/sass/tabs.scss
new file mode 100644
index 0000000..39c88f4
--- /dev/null
+++ b/docs/sass/tabs.scss
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+$blue: #3f6b9d;
+$orange: #e08f24;
+$white: #fefefe;
+$black: #1a1a1a;
+$gray: #eee;
+
+$active: #609060;
+$inactive: #e9ffe9;
+
+$tabHeight: 50px;
+$minTabs: 2;
+$maxTabs: 4;
+
+@mixin single-transition($property:all, $speed:150ms, $ease:ease, $delay: 0s) {
+  -webkit-transition: $property $speed $ease $delay;  
+  transition: $property $speed $ease $delay;
+}
+
+.tabs {
+
+  position: relative;
+  margin: 40px auto;
+  width: 1024px;
+  max-width: 100%;
+  overflow: hidden;
+  padding-top: 10px;
+  margin-bottom: 60px;
+
+  input  {
+    position: absolute;
+    z-index: 1000;
+    height: $tabHeight;
+    left: 0;
+    top: 0;
+    opacity: 0;
+    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
+    filter: alpha(opacity=0);
+    cursor: pointer;
+    margin: 0;
+    &:hover + label {
+      background: $orange;
+    }
+  }
+
+  label {
+    background: $inactive;
+    color: $black;
+    font-size: 15px;
+    line-height: $tabHeight;
+    height: $tabHeight + 10;
+    position: relative;
+    top: 0;
+    padding: 0 20px;
+    float: left;
+    display: block;
+    letter-spacing: 1px;
+    text-transform: uppercase;
+    font-weight: bold;
+    text-align: center;
+    box-shadow: 2px 0 2px rgba(0,0,0,0.1), -2px 0 2px rgba(0,0,0,0.1);
+    box-sizing: border-box;
+    @include single-transition();
+    &:hover{
+      cursor: pointer;
+    }
+    &:after {
+      content: '';
+      background: $active;
+      position: absolute;
+      bottom: -2px;
+      left: 0;
+      width: 100%;
+      height: 2px;
+      display: block;
+    }
+  }  
+}
+
+@for $n from $minTabs through $maxTabs {
+
+  .tabs-#{$n} {
+
+    input {
+      width: 100% / $n;
+      @for $i from 1 through $n {
+        &.tab-selector-#{$i}{
+          left: ($i - 1) * (100% / $n);
+        }
+      }
+    }
+
+    label {
+      width: 100% / $n;
+    }
+  }
+}
+
+.tabs label:first-of-type {
+  z-index: 4;
+}
+.tab-label-2 {
+  z-index: 4;
+}
+.tab-label-3 {
+  z-index: 3;
+}
+.tab-label-4 {
+  z-index: 2;
+}
+
+.tabs input:checked + label {
+  background: $active;
+  color: $white;
+  z-index: 6;
+}
+
+.clear-shadow {
+  clear: both;
+}
+
+.tabcontent {
+  height: auto;
+  width: 100%;
+  float: left;
+  position: relative;
+  z-index: 5;
+  background: $gray;
+  top: -10px;
+  box-sizing: border-box;
+  &>div{
+    position: relative;
+    float: left;
+    width: 0;
+    height: 0;
+    box-sizing: border-box;
+    top: 0;
+    left: 0;
+    z-index: 1;
+    opacity: 0;
+    background: $gray;
+  }
+  .CodeRay {
+    background-color: $white;
+  }
+}
+
+@for $i from 1 through $maxTabs {
+  .tabs .tab-selector-#{$i}:checked ~ .tabcontent .tabcontent-#{$i} {
+    z-index: 100;
+    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
+    filter: alpha(opacity=100);
+    opacity: 1;
+    width: 100%;
+    height: auto;
+    width: 100%;
+    height: auto;
+    padding-top: 30px;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1d15f40/docs/stylesheets/tabs.css
----------------------------------------------------------------------
diff --git a/docs/stylesheets/tabs.css b/docs/stylesheets/tabs.css
new file mode 100644
index 0000000..df508b7
--- /dev/null
+++ b/docs/stylesheets/tabs.css
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+.tabs{position:relative;margin:40px auto;width:1024px;max-width:100%;overflow:hidden;padding-top:10px;margin-bottom:60px}.tabs input{position:absolute;z-index:1000;height:50px;left:0;top:0;opacity:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);cursor:pointer;margin:0}.tabs input:hover+label{background:#e08f24}.tabs label{background:#e9ffe9;color:#1a1a1a;font-size:15px;line-height:50px;height:60px;position:relative;top:0;padding:0 20px;float:left;display:block;letter-spacing:1px;text-transform:uppercase;font-weight:bold;text-align:center;box-shadow:2px 0 2px rgba(0,0,0,0.1),-2px 0 2px rgba(0,0,0,0.1);box-sizing:border-box;-webkit-transition:all 150ms ease 0s;transition:all 150ms ease 0s}.tabs label:hover{cursor:pointer}.tabs label:after{content:'';background:#609060;position:absolute;bottom:-2px;left:0;width:100%;height:2px;display:block}.tabs-2 input{width:50%}.tabs-2 input.tab-selector-1{left:0%}.tabs-2 input.tab-selector-2{left:50%}.tabs-
 2 label{width:50%}.tabs-3 input{width:33.33333%}.tabs-3 input.tab-selector-1{left:0%}.tabs-3 input.tab-selector-2{left:33.33333%}.tabs-3 input.tab-selector-3{left:66.66667%}.tabs-3 label{width:33.33333%}.tabs-4 input{width:25%}.tabs-4 input.tab-selector-1{left:0%}.tabs-4 input.tab-selector-2{left:25%}.tabs-4 input.tab-selector-3{left:50%}.tabs-4 input.tab-selector-4{left:75%}.tabs-4 label{width:25%}.tabs label:first-of-type{z-index:4}.tab-label-2{z-index:4}.tab-label-3{z-index:3}.tab-label-4{z-index:2}.tabs input:checked+label{background:#609060;color:#fefefe;z-index:6}.clear-shadow{clear:both}.tabcontent{height:auto;width:100%;float:left;position:relative;z-index:5;background:#eee;top:-10px;box-sizing:border-box}.tabcontent>div{position:relative;float:left;width:0;height:0;box-sizing:border-box;top:0;left:0;z-index:1;opacity:0;background:#eee}.tabcontent .CodeRay{background-color:#fefefe}.tabs .tab-selector-1:checked ~ .tabcontent .tabcontent-1{z-index:100;-ms-filter:"progid:DXImag
 eTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;width:100%;height:auto;width:100%;height:auto;padding-top:30px}.tabs .tab-selector-2:checked ~ .tabcontent .tabcontent-2{z-index:100;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;width:100%;height:auto;width:100%;height:auto;padding-top:30px}.tabs .tab-selector-3:checked ~ .tabcontent .tabcontent-3{z-index:100;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;width:100%;height:auto;width:100%;height:auto;padding-top:30px}.tabs .tab-selector-4:checked ~ .tabcontent .tabcontent-4{z-index:100;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;width:100%;height:auto;width:100%;height:auto;padding-top:30px}


[14/21] tinkerpop git commit: Merge branch 'TINKERPOP-1860' into tp32

Posted by dk...@apache.org.
Merge branch 'TINKERPOP-1860' into tp32


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/586e432b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/586e432b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/586e432b

Branch: refs/heads/TINKERPOP-1447
Commit: 586e432bbef36eb1e509e63031caa6f2aa44ef3d
Parents: a94baa0 caede9c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jan 16 08:11:28 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jan 16 08:11:28 2018 -0500

----------------------------------------------------------------------
 .../step/map/GroovyValueMapTest.groovy          | 10 +++
 .../src/main/jython/radish/feature_steps.py     |  8 +-
 gremlin-test/features/map/ValueMap.feature      | 32 +++++++
 .../traversal/step/map/ValueMapTest.java        | 95 ++++++++++++++++++++
 4 files changed, 144 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[04/21] tinkerpop git commit: Placed a limit on python tornado dependency version

Posted by dk...@apache.org.
Placed a limit on python tornado dependency version

Doesn't seem to work with 5.0 with the current version of python we were supporting. CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9511dacd
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9511dacd
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9511dacd

Branch: refs/heads/TINKERPOP-1447
Commit: 9511dacdb08cfe9cd472ffaa0b3f3d45cb7b10a2
Parents: bef9e9b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Dec 27 14:31:31 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Dec 27 14:31:31 2017 -0500

----------------------------------------------------------------------
 gremlin-python/src/main/jython/setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9511dacd/gremlin-python/src/main/jython/setup.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/setup.py b/gremlin-python/src/main/jython/setup.py
index c72a4d3..5d26749 100644
--- a/gremlin-python/src/main/jython/setup.py
+++ b/gremlin-python/src/main/jython/setup.py
@@ -46,7 +46,7 @@ version = __version__.version
 
 install_requires = [
     'aenum>=1.4.5',
-    'tornado>=4.4.1',
+    'tornado>=4.4.1,<5.0',
     'six>=1.10.0'
 ]
 


[03/21] tinkerpop git commit: Added a couple of recipes - collections/edge move CTR

Posted by dk...@apache.org.
Added a couple of recipes - collections/edge move CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/bef9e9bc
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/bef9e9bc
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/bef9e9bc

Branch: refs/heads/TINKERPOP-1447
Commit: bef9e9bce3961fff0a3eaddaa59fe6dcd94e56f1
Parents: 189953a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Dec 27 10:00:33 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Dec 27 10:01:38 2017 -0500

----------------------------------------------------------------------
 docs/src/recipes/collections.asciidoc      |  67 ++++++++++++++++++++++++
 docs/src/recipes/edge-move.asciidoc        |  57 ++++++++++++++++++++
 docs/src/recipes/index.asciidoc            |   4 ++
 docs/static/images/gremlin-collections.png | Bin 0 -> 48305 bytes
 docs/static/images/gremlin-edge.png        | Bin 0 -> 79829 bytes
 5 files changed, 128 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bef9e9bc/docs/src/recipes/collections.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/collections.asciidoc b/docs/src/recipes/collections.asciidoc
new file mode 100644
index 0000000..446ed46
--- /dev/null
+++ b/docs/src/recipes/collections.asciidoc
@@ -0,0 +1,67 @@
+////
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+////
+[[collections]]
+== Collections
+
+image:gremlin-collections.png[width=400]
+
+Lists and maps form the basis for much of the processing in Gremlin traversals. They are core to how side-effects
+are typically held and how results are generally produced. Being able to pick them apart and reformat them is sometimes
+required.
+
+One of the most common ways to end up with a `Map` is with `valueMap()`:
+
+[gremlin-groovy,modern]
+----
+g.V().has('name','marko').valueMap('name','age')
+----
+
+The problem is that unless the graph is making use of multi-properties, there is little need to have the value of each
+property stored as a `List`. One way to unwrap this value from the list is to avoid having it there in the first place
+by avoiding use of `valueMap()`:
+
+[gremlin-groovy,modern]
+----
+g.V().has('name','marko').
+  local(properties('name','age').
+  group().by(key()).by(value()))
+----
+
+Interestingly, it's worth looking at how to process the output of `valueMap()` to attain this output as the approach is
+generally applicable to processing any `Map` instances with any sorts of values:
+
+[gremlin-groovy,modern]
+----
+g.V().has('name','marko').
+  valueMap('name','age').
+  unfold().
+  group().
+    by(keys).
+    by(select(values).unfold())
+----
+
+The code above, basically deconstruct then reconstructs the `Map`. The key to the pattern is to first `unfold()` the
+`Map` into its key and value entries. Then for each key and value produce a new `Map` using `group()` where the key
+for that map is the key of the entry (those are obviously unique as you picked them out of the `valueMap()`) and the
+value is simply the `unfold()` of the list of values in each entry. Recall that the `select(values).unfold()` only
+returns one value (i.e. the first) not only because there is only one, but also because `by()` will only call `next()`
+on that sub-traversal (it does not iterate the entire thing).
+
+Generally speaking, a `Map` constructed as part of `group()` or `project()` will already be in the form required as
+the `by()` modulators would be written in such a fashion as to produce that final output. It would be unnecessary to
+deconstruct/reconstruct it. Be certain that there isn't a way to re-write the `group()` or `project()` to get the
+desired output before taking this approach.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bef9e9bc/docs/src/recipes/edge-move.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/edge-move.asciidoc b/docs/src/recipes/edge-move.asciidoc
new file mode 100644
index 0000000..f31b060
--- /dev/null
+++ b/docs/src/recipes/edge-move.asciidoc
@@ -0,0 +1,57 @@
+////
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+////
+[[edge-move]]
+== Moving an Edge
+
+image:gremlin-edge.png[width=145]
+
+Aside from their properties, edges are immutable structures where the label and the related in and out vertices
+cannot be modified. To "move" an edge from one vertex to another, it requires that the edge be dropped and a new edge
+be created with the same properties and label. It is possible to simulate this "move" in a single traversal as
+follows:
+
+[gremlin-groovy,modern]
+----
+g.V().has('name','marko').
+  outE().inV().
+  path().by('name').by(valueMap(true))
+----
+
+The "marko" vertex contains a "knows" edge to the "vadas" vertex. The following code shows how to "move" that edge to
+the "peter" vertex in a single traversal:
+
+[gremlin-groovy,modern]
+----
+g.V().has('name','marko').as('a').
+  outE('knows').as('e1').filter(inV().has('name','vadas')).       <1>
+  V().has('name','peter').
+  addE('knows').from('a').as('e2').                               <2>
+  sideEffect(select('e1').properties().
+             unfold().as('p').
+             select('e2').
+             property(select('p').key(), select('p').value())).   <3>
+  select('e1').drop()                                             <4>
+g.V().has('name','marko').
+  outE().inV().
+  path().by('name').by(valueMap(true))
+----
+
+<1> Find the edge to "move" and label that as "e1". It will be necessary to reference this later to get the edge
+properties to transfer to the new "moved" edge.
+<2> Add the "moved" edge and label it as "e2".
+<3> Use a `sideEffect()` to transfer the properties from "e1" to "e2".
+<4> Use `drop()` to get rid of the old edge at "e1" now that the new "e2" edge is in place.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bef9e9bc/docs/src/recipes/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/index.asciidoc b/docs/src/recipes/index.asciidoc
index bb88301..c59cc89 100644
--- a/docs/src/recipes/index.asciidoc
+++ b/docs/src/recipes/index.asciidoc
@@ -38,6 +38,8 @@ include::between-vertices.asciidoc[]
 
 include::centrality.asciidoc[]
 
+include::collections.asciidoc[]
+
 include::connected-components.asciidoc[]
 
 include::cycle-detection.asciidoc[]
@@ -46,6 +48,8 @@ include::duplicate-edge.asciidoc[]
 
 include::duplicate-vertex.asciidoc[]
 
+include::edge-move.asciidoc[]
+
 include::if-then-based-grouping.asciidoc[]
 
 include::pagination.asciidoc[]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bef9e9bc/docs/static/images/gremlin-collections.png
----------------------------------------------------------------------
diff --git a/docs/static/images/gremlin-collections.png b/docs/static/images/gremlin-collections.png
new file mode 100755
index 0000000..178c166
Binary files /dev/null and b/docs/static/images/gremlin-collections.png differ

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bef9e9bc/docs/static/images/gremlin-edge.png
----------------------------------------------------------------------
diff --git a/docs/static/images/gremlin-edge.png b/docs/static/images/gremlin-edge.png
new file mode 100755
index 0000000..62b834f
Binary files /dev/null and b/docs/static/images/gremlin-edge.png differ


[17/21] tinkerpop git commit: Fixed build problems with python given dep issues with radish

Posted by dk...@apache.org.
Fixed build problems with python given dep issues with radish

Radish uses colorful which just bumped version and ends up breaking something in radish. Manually loaded deps for now until that is resolved in radish. CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b54c9740
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b54c9740
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b54c9740

Branch: refs/heads/TINKERPOP-1447
Commit: b54c9740ae1efd08b0a26b780ee109641728b9e8
Parents: 7b37a25
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jan 18 07:10:04 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jan 18 07:10:04 2018 -0500

----------------------------------------------------------------------
 gremlin-python/pom.xml | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b54c9740/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index c6373bd..ec8a8d3 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -315,17 +315,27 @@ limitations under the License.
                                               failonerror="true">
                                             <arg line="--python=python2 env"/>
                                         </exec>
+                                        <!-- temporary manual installation of deps to hardcode colorful version given radish/PyHamcrest troubles -->
                                         <exec dir="${project.build.directory}/python2" executable="env/bin/pip"
                                               failonerror="true">
-                                            <arg line="install wheel radish-bdd PyHamcrest aenum"/>
+                                            <arg line="install wheel aenum pysingleton humanize radish-parse_type docopt 'colorful==0.4.0' 'tag-expressions>=1.0.0'"/>
+                                        </exec>
+                                        <exec dir="${project.build.directory}/python2" executable="env/bin/pip"
+                                              failonerror="true">
+                                            <arg line="install radish-bdd PyHamcrest --no-deps"/>
                                         </exec>
                                         <exec dir="${project.build.directory}/python3" executable="virtualenv"
                                               failonerror="true">
                                             <arg line="--python=python3 env"/>
                                         </exec>
+                                        <!-- temporary manual installation of deps to hardcode colorful version given radish/PyHamcrest troubles -->
+                                        <exec dir="${project.build.directory}/python3" executable="env/bin/pip"
+                                              failonerror="true">
+                                            <arg line="install wheel aenum pysingleton humanize radish-parse_type docopt 'colorful==0.4.0' 'tag-expressions>=1.0.0'"/>
+                                        </exec>
                                         <exec dir="${project.build.directory}/python3" executable="env/bin/pip"
                                               failonerror="true">
-                                            <arg line="install wheel radish-bdd PyHamcrest aenum"/>
+                                            <arg line="install radish-bdd PyHamcrest --no-deps"/>
                                         </exec>
                                         <exec dir="${project.build.directory}/python-packaged" executable="virtualenv"
                                               failonerror="true">


[16/21] tinkerpop git commit: Expanded more on Map merging in the collections recipe CTR

Posted by dk...@apache.org.
Expanded more on Map merging in the collections recipe CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7b37a256
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7b37a256
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7b37a256

Branch: refs/heads/TINKERPOP-1447
Commit: 7b37a256a1c41fb3978a0fbd5716f64a1dd5bc90
Parents: 4eb80bd
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jan 17 16:40:09 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jan 17 16:40:09 2018 -0500

----------------------------------------------------------------------
 docs/src/recipes/collections.asciidoc | 47 +++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7b37a256/docs/src/recipes/collections.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/collections.asciidoc b/docs/src/recipes/collections.asciidoc
index 5db1e6b..61fee99 100644
--- a/docs/src/recipes/collections.asciidoc
+++ b/docs/src/recipes/collections.asciidoc
@@ -282,7 +282,7 @@ g.V().has('name','marko').
     by(select(values).unfold())
 ----
 
-The code above, basically deconstruct then reconstructs the `Map`. The key to the pattern is to first `unfold()` the
+The code above, basically deconstructs then reconstructs the `Map`. The key to the pattern is to first `unfold()` the
 `Map` into its key and value entries. Then for each key and value produce a new `Map` using `group()` where the key
 for that map is the key of the entry (those are obviously unique as you picked them out of the `valueMap()`) and the
 value is simply the `unfold()` of the list of values in each entry. Recall that the `select(values).unfold()` only
@@ -340,4 +340,49 @@ g.V().
         group().
           by(keys).
           by(select(values).unfold()))
+----
+
+As there may be a desire to remove entries from a `Map`, there may also be the need to add keys to a `Map`. The pattern
+here involves the use of a `union()` that returns the `Map` instances which can be flattened to entries and then
+reconstructed as a new `Map` that has been merged together:
+
+[gremlin-groovy,modern]
+----
+g.V().
+  has('name','marko').
+  union(project('degree').         <1>
+          by(bothE().count()),
+        valueMap(true)).
+  unfold().                        <2>
+  group().
+    by(keys).
+    by(select(values).unfold())
+----
+
+<1> The `valueMap(true)` of a `Vertex` can be extended with the "degree" of the `Vertex` by performing a `union()` of
+the two traversals that produce that output (both produce `Map` objects).
+<2> The `unfold()` step is used to decompose the `Map` objects into key/value entries that are then constructed back
+into a single new `Map` given the patterns shown earlier. The `Map` objects of both traversals in the `union()` are
+essentially merged together.
+
+When using this pattern, it is important to recognize that if there are non-unique keys produced by the traversals
+supplied to `union()`, they will overwrite one another given the final `by()` modulator above. If changed to
+`by(select(values).unfold().fold())` they will merge to produce a `List` of values. Of course, that change will bring
+a `List` back for all the values of the new `Map`. With some added logic the `Map` values can be flattened out of
+`List` instances when necessary:
+
+[gremlin-groovy,modern]
+----
+g.V().
+  has('name','marko').
+  union(valueMap(true),
+        project('age').
+          by(constant(100))).
+  unfold().
+  group().
+    by(keys).
+    by(select(values).
+       unfold().
+       fold().
+       choose(count(local).is(eq(1)), unfold()))
 ----
\ No newline at end of file


[18/21] tinkerpop git commit: Improved the method for dealing with the python build problem with radish

Posted by dk...@apache.org.
Improved the method for dealing with the python build problem with radish

The issue is definitely related to the colorful version bump with radish (and PyHamcrest, maybe others??) depend on. Rather than exclude the dependencies and manually import stuff which was messy, David Brown suggested the fix that just involved an environment variable. He is currently looking into opening an issue with colorful for the problem. CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/231bbb65
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/231bbb65
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/231bbb65

Branch: refs/heads/TINKERPOP-1447
Commit: 231bbb6596646db3a6238b1014f9d43b25fc7cfd
Parents: b54c974
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jan 18 14:02:05 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jan 18 14:02:05 2018 -0500

----------------------------------------------------------------------
 gremlin-python/pom.xml | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/231bbb65/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index ec8a8d3..3bbf82c 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -315,27 +315,17 @@ limitations under the License.
                                               failonerror="true">
                                             <arg line="--python=python2 env"/>
                                         </exec>
-                                        <!-- temporary manual installation of deps to hardcode colorful version given radish/PyHamcrest troubles -->
                                         <exec dir="${project.build.directory}/python2" executable="env/bin/pip"
                                               failonerror="true">
-                                            <arg line="install wheel aenum pysingleton humanize radish-parse_type docopt 'colorful==0.4.0' 'tag-expressions>=1.0.0'"/>
-                                        </exec>
-                                        <exec dir="${project.build.directory}/python2" executable="env/bin/pip"
-                                              failonerror="true">
-                                            <arg line="install radish-bdd PyHamcrest --no-deps"/>
+                                            <arg line="install wheel radish-bdd PyHamcrest aenum"/>
                                         </exec>
                                         <exec dir="${project.build.directory}/python3" executable="virtualenv"
                                               failonerror="true">
                                             <arg line="--python=python3 env"/>
                                         </exec>
-                                        <!-- temporary manual installation of deps to hardcode colorful version given radish/PyHamcrest troubles -->
-                                        <exec dir="${project.build.directory}/python3" executable="env/bin/pip"
-                                              failonerror="true">
-                                            <arg line="install wheel aenum pysingleton humanize radish-parse_type docopt 'colorful==0.4.0' 'tag-expressions>=1.0.0'"/>
-                                        </exec>
                                         <exec dir="${project.build.directory}/python3" executable="env/bin/pip"
                                               failonerror="true">
-                                            <arg line="install radish-bdd PyHamcrest --no-deps"/>
+                                            <arg line="install wheel radish-bdd PyHamcrest aenum"/>
                                         </exec>
                                         <exec dir="${project.build.directory}/python-packaged" executable="virtualenv"
                                               failonerror="true">
@@ -433,6 +423,7 @@ limitations under the License.
                                         <exec executable="env/bin/radish" dir="${project.build.directory}/python2"
                                               failonerror="true">
                                             <env key="PYTHONPATH" value=""/>
+                                            <env key="PYTHONIOENCODING" value="utf-8:surrogateescape"/>
                                             <arg line="-e -t -b ${project.build.directory}/python2/radish ${project.basedir}/../gremlin-test/features/"/> <!-- -no-line-jump -->
                                         </exec>
                                     </target>


[02/21] tinkerpop git commit: Return exit status of docker run - CTR

Posted by dk...@apache.org.
Return exit status of docker run - CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/189953a9
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/189953a9
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/189953a9

Branch: refs/heads/TINKERPOP-1447
Commit: 189953a9f02b1f5d1a65726523b6385deab05353
Parents: 47cebd4
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Dec 27 09:12:09 2017 -0500
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Dec 27 09:12:09 2017 -0500

----------------------------------------------------------------------
 docker/build.sh | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/189953a9/docker/build.sh
----------------------------------------------------------------------
diff --git a/docker/build.sh b/docker/build.sh
index 7b83d29..7eb46b4 100755
--- a/docker/build.sh
+++ b/docker/build.sh
@@ -52,4 +52,6 @@ EOF
 docker build -t tinkerpop:${BUILD_TAG} .
 docker run ${TINKERPOP_DOCKER_OPTS} ${REMOVE_CONTAINER} -ti tinkerpop:${BUILD_TAG}
 
+status=$?
 popd > /dev/null
+exit $status


[06/21] tinkerpop git commit: Included data in assertion failure for python GLV tests CTR

Posted by dk...@apache.org.
Included data in assertion failure for python GLV tests CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/df624818
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/df624818
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/df624818

Branch: refs/heads/TINKERPOP-1447
Commit: df624818c159b38b1fda3f94034e6ced2d710ed6
Parents: 85592bf
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jan 4 08:37:46 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jan 4 08:37:46 2018 -0500

----------------------------------------------------------------------
 gremlin-python/src/main/jython/radish/feature_steps.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/df624818/gremlin-python/src/main/jython/radish/feature_steps.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/feature_steps.py b/gremlin-python/src/main/jython/radish/feature_steps.py
index 5cb4b9a..452eaa4 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -177,7 +177,7 @@ def _any_assertion(data, result, ctx):
 
 def _table_assertion(data, result, ctx, ordered):
     # results from traversal should have the same number of entries as the feature data table
-    assert_that(len(result), equal_to(len(data)))
+    assert_that(len(result), equal_to(len(data)), "result:" + str(result))
 
     results_to_test = list(result)
 


[07/21] tinkerpop git commit: Update TinkerGraph docs to include production use cases CTR

Posted by dk...@apache.org.
Update TinkerGraph docs to include production use cases CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e4c8e6a1
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e4c8e6a1
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e4c8e6a1

Branch: refs/heads/TINKERPOP-1447
Commit: e4c8e6a18dc468cdc72e3ce08f953a89e1502687
Parents: df62481
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 5 08:27:38 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jan 5 08:27:38 2018 -0500

----------------------------------------------------------------------
 .../implementations-tinkergraph.asciidoc        | 42 ++++++++++++++++----
 1 file changed, 35 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e4c8e6a1/docs/src/reference/implementations-tinkergraph.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/implementations-tinkergraph.asciidoc b/docs/src/reference/implementations-tinkergraph.asciidoc
index 4ebafb0..775316a 100644
--- a/docs/src/reference/implementations-tinkergraph.asciidoc
+++ b/docs/src/reference/implementations-tinkergraph.asciidoc
@@ -29,16 +29,44 @@ limitations under the License.
 image:tinkerpop-character.png[width=100,float=left] TinkerGraph is a single machine, in-memory (with optional
 persistence), non-transactional graph engine that provides both OLTP and OLAP functionality. It is deployed with
 TinkerPop3 and serves as the reference implementation for other providers to study in order to understand the
-semantics of the various methods of the TinkerPop3 API. Constructing a simple graph in Java8 is presented below.
+semantics of the various methods of the TinkerPop3 API. Its status as a reference implementation does not however imply
+that it is not suitable for production. TinkerGraph has many practical use cases in production applications and their
+development. Some examples of TinkerGraph use cases include:
+
+* Ad-hoc analysis of large immutable graphs that fit in memory.
+* Extract subgraphs, from larger graphs that don't fit in memory, into TinkerGraph for further analysis or other
+purposes.
+* Use TinkerGraph as a sandbox to develop and debug complex traversals by simulating data from a larger graph inside
+a TinkerGraph.
+
+Constructing a simple graph using TinkerGraph in Java8 is presented below:
 
 [source,java]
-Graph g = TinkerGraph.open();
-Vertex marko = g.addVertex("name","marko","age",29);
-Vertex lop = g.addVertex("name","lop","lang","java");
-marko.addEdge("created",lop,"weight",0.6d);
+----
+Graph graph = TinkerGraph.open();
+GraphTraversalSource g = graph.traversal();
+Vertex marko = g.addV("person").property("name","marko").property("age",29).next();
+Vertex lop = g.addV("software").property("name","lop").property("lang","java").next();
+g.withSideEffect("l",lop).V(marko).addE("created").to('l').property("weight",0.6d).iterate();
+----
+
+The above Gremlin creates two vertices named "marko" and "lop" and connects them via a created-edge with a weight=0.6
+property. The addition of these two vertices and the edge between them could also be done in a single Gremlin statement
+as follows:
+
+[source,java]
+----
+g.addV("person").property("name","marko").property("age",29).as("m").
+  addV("software").property("name","lop").property("lang","java").as("l").
+  addE("created").from("m").to("l").property("weight",0.6d).iterate();
+----
+
+IMPORTANT: Pay attention to the fact that traversals end with `next()` or `iterate()`. These methods advance the
+objects in the traversal stream and without those methods, the traversal does nothing. Review the
+link:http://tinkerpop.apache.org/docs/x.y.z/tutorials/the-gremlin-console/#result-iteration[Result Iteration Section]
+of The Gremlin Console tutorial for more information.
 
-The above graph creates two vertices named "marko" and "lop" and connects them via a created-edge with a weight=0.6
-property. Next, the graph can be queried as such.
+Next, the graph can be queried as such.
 
 [source,java]
 g.V().has("name","marko").out("created").values("name")


[08/21] tinkerpop git commit: TINKERPOP-1855 Updated Rexster links

Posted by dk...@apache.org.
TINKERPOP-1855 Updated Rexster links

Old links no longer resolved - pointed to github url instead CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d56862ba
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d56862ba
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d56862ba

Branch: refs/heads/TINKERPOP-1447
Commit: d56862ba0ffbb3d80d3375beaa9bba2c6e519829
Parents: e4c8e6a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 5 14:10:42 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jan 5 14:10:42 2018 -0500

----------------------------------------------------------------------
 docs/src/reference/gremlin-applications.asciidoc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d56862ba/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index 1c6843d..df05ead 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -368,7 +368,7 @@ and recommendation.
 * Provides a method for Non-JVM languages (e.g. Python, Javascript, etc.) to communicate with the TinkerPop stack.
 * Exposes numerous methods for extension and customization to include serialization options, remote commands, etc.
 
-NOTE: Gremlin Server is the replacement for link:http://rexster.tinkerpop.com[Rexster].
+NOTE: Gremlin Server is the replacement for link:https://github.com/tinkerpop/rexster[Rexster].
 
 NOTE: Please see the link:http://tinkerpop.apache.org/docs/x.y.z/dev/provider/[Provider Documentation] for information
 on how to develop a driver for Gremlin Server.
@@ -848,7 +848,7 @@ image:gremlin-rexster.png[width=225,float=left] While the default behavior for G
 WebSocket-based connection, it can also be configured to support link:http://en.wikipedia.org/wiki/Representational_state_transfer[REST].
 The REST endpoint provides for a communication protocol familiar to most developers, with a wide support of
 programming languages, tools and libraries for accessing it.  As a result, REST provides a fast way to get started
-with Gremlin Server.   It also may represent an easier upgrade path from link:http://rexster.tinkerpop.com/[Rexster]
+with Gremlin Server.   It also may represent an easier upgrade path from link:https://github.com/tinkerpop/rexster[Rexster]
 as the API for the endpoint is very similar to Rexster's link:https://github.com/tinkerpop/rexster/wiki/Gremlin-Extension[Gremlin Extension].
 
 Gremlin Server provides for a single REST endpoint - a Gremlin evaluator - which allows the submission of a Gremlin


[09/21] tinkerpop git commit: TINKERPOP-1850 Document the use of -1 in range() step CTR

Posted by dk...@apache.org.
TINKERPOP-1850 Document the use of -1 in range() step CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/fbcb044d
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/fbcb044d
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/fbcb044d

Branch: refs/heads/TINKERPOP-1447
Commit: fbcb044d34ad10e8ec88e0380c6cf0a57f002b09
Parents: d56862b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 5 15:08:59 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jan 5 15:08:59 2018 -0500

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc                      | 6 ++++--
 .../gremlin/process/traversal/dsl/graph/GraphTraversal.java    | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fbcb044d/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index 6bf3059..741cda2 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -1684,13 +1684,15 @@ g.E().propertyMap()
 
 As traversers propagate through the traversal, it is possible to only allow a certain number of them to pass through
 with `range()`-step (*filter*). When the low-end of the range is not met, objects are continued to be iterated. When
-within the low (inclusive) and high (exclusive) range, traversers are emitted. Finally, when above the high range, the
-traversal breaks out of iteration.
+within the low (inclusive) and high (exclusive) range, traversers are emitted. When above the high range, the traversal
+breaks out of iteration. Finally, the use of `-1` on the high range will emit remaining traversers after the low range
+begins.
 
 [gremlin-groovy,modern]
 ----
 g.V().range(0,3)
 g.V().range(1,3)
+g.V().range(1, -1)
 g.V().repeat(both()).times(1000000).emit().range(6,10)
 ----
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fbcb044d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
index 29412b8..222fdab 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
@@ -1647,7 +1647,7 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
      * of {@code low} do not pass through and those that exceed the value of {@code high} will end the iteration.
      *
      * @param low  the number at which to start allowing objects through the stream
-     * @param high the number at which to end the stream
+     * @param high the number at which to end the stream - use {@code -1} to emit all remaining objects
      * @return the traversal with an appended {@link RangeGlobalStep}
      * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#range-step" target="_blank">Reference Documentation - Range Step</a>
      * @since 3.0.0-incubating
@@ -1664,7 +1664,7 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
      *
      * @param scope the scope of how to apply the {@code range}
      * @param low   the number at which to start allowing objects through the stream
-     * @param high  the number at which to end the stream
+     * @param high  the number at which to end the stream - use {@code -1} to emit all remaining objects
      * @return the traversal with an appended {@link RangeGlobalStep} or {@link RangeLocalStep} depending on {@code scope}
      * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#range-step" target="_blank">Reference Documentation - Range Step</a>
      * @since 3.0.0-incubating


[11/21] tinkerpop git commit: TINKERPOP-1860 Added tests for valueMap(true) variations

Posted by dk...@apache.org.
TINKERPOP-1860 Added tests for valueMap(true) variations

Note that with GraphSON 2.0 we get back string representations of T.id and T.label. That may change for GraphSON 3.0 on the 3.3.x line of code.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/caede9c8
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/caede9c8
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/caede9c8

Branch: refs/heads/TINKERPOP-1447
Commit: caede9c8ca5cad07b947a53b38a9cc145500f6bf
Parents: fbcb044
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Dec 29 08:02:55 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jan 8 09:21:40 2018 -0500

----------------------------------------------------------------------
 .../step/map/GroovyValueMapTest.groovy          | 10 +++
 .../src/main/jython/radish/feature_steps.py     |  8 +-
 gremlin-test/features/map/ValueMap.feature      | 32 +++++++
 .../traversal/step/map/ValueMapTest.java        | 95 ++++++++++++++++++++
 4 files changed, 144 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/caede9c8/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyValueMapTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyValueMapTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyValueMapTest.groovy
index c3c20fa..046f4ef 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyValueMapTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyValueMapTest.groovy
@@ -34,11 +34,21 @@ public abstract class GroovyValueMapTest {
         }
 
         @Override
+        public Traversal<Vertex, Map<String, Object>> get_g_V_valueMapXtrueX() {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.valueMap(true)")
+        }
+
+        @Override
         public Traversal<Vertex, Map<String, List>> get_g_V_valueMapXname_ageX() {
             new ScriptTraversal<>(g, "gremlin-groovy", "g.V.valueMap('name', 'age')")
         }
 
         @Override
+        public Traversal<Vertex, Map<String, Object>> get_g_V_valueMapXtrue_name_ageX() {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.valueMap(true, 'name', 'age')")
+        }
+
+        @Override
         public Traversal<Vertex, Map<String, List<String>>> get_g_VX1X_outXcreatedX_valueMap(final Object v1Id) {
             new ScriptTraversal<>(g, "gremlin-groovy", "g.V(v1Id).out('created').valueMap", "v1Id", v1Id)
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/caede9c8/gremlin-python/src/main/jython/radish/feature_steps.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/feature_steps.py b/gremlin-python/src/main/jython/radish/feature_steps.py
index 452eaa4..3de641e 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -33,6 +33,8 @@ regex_in = re.compile(r"([(.,\s])in\(")
 regex_is = re.compile(r"([(.,\s])is\(")
 regex_not = re.compile(r"([(.,\s])not\(")
 regex_or = re.compile(r"([(.,\s])or\(")
+regex_true = re.compile(r"(true)")
+regex_false = re.compile(r"(false)")
 
 
 ignores = [
@@ -157,6 +159,8 @@ def _convert(val, ctx):
         return Path([set([])], path_objects)
     elif isinstance(val, str) and re.match("^c\[.*\]$", val):         # parse lambda/closure
         return lambda: (val[2:-1], "gremlin-groovy")
+    elif isinstance(val, str) and re.match("^t\[.*\]$", val):         # parse instance of T enum
+        return T[val[2:-1]]
     else:
         return val
 
@@ -209,7 +213,9 @@ def _translate(traversal):
     replaced = regex_is.sub(r"\1is_(", replaced)
     replaced = regex_not.sub(r"\1not_(", replaced)
     replaced = regex_or.sub(r"\1or_(", replaced)
-    return regex_in.sub(r"\1in_(", replaced)
+    replaced = regex_in.sub(r"\1in_(", replaced)
+    replaced = regex_true.sub(r"True", replaced)
+    return regex_false.sub(r"False", replaced)
 
 
 def _make_traversal(g, traversal_string, params):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/caede9c8/gremlin-test/features/map/ValueMap.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/ValueMap.feature b/gremlin-test/features/map/ValueMap.feature
index 2390512..0860b15 100644
--- a/gremlin-test/features/map/ValueMap.feature
+++ b/gremlin-test/features/map/ValueMap.feature
@@ -33,6 +33,22 @@ Feature: Step - valueMap()
       | m[{"name": ["lop"], "lang": ["java"]}] |
       | m[{"name": ["ripple"], "lang": ["java"]}] |
 
+  Scenario: g_V_valueMapXtrueX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().valueMap(true)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | m[{"id": "v[marko].id", "label": "person", "name": ["marko"], "age": [29]}] |
+      | m[{"id": "v[josh].id", "label": "person", "name": ["josh"], "age": [32]}] |
+      | m[{"id": "v[peter].id", "label": "person", "name": ["peter"], "age": [35]}] |
+      | m[{"id": "v[vadas].id", "label": "person", "name": ["vadas"], "age": [27]}] |
+      | m[{"id": "v[lop].id", "label": "software", "name": ["lop"], "lang": ["java"]}] |
+      | m[{"id": "v[ripple].id", "label": "software", "name": ["ripple"], "lang": ["java"]}] |
+
   Scenario: g_V_valueMapXname_ageX
     Given the modern graph
     And the traversal of
@@ -49,6 +65,22 @@ Feature: Step - valueMap()
       | m[{"name": ["lop"]}] |
       | m[{"name": ["ripple"]}] |
 
+  Scenario: g_V_valueMapXtrue_name_ageX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().valueMap(true, "name", "age")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | m[{"id": "v[marko].id", "label": "person", "name": ["marko"], "age": [29]}] |
+      | m[{"id": "v[josh].id", "label": "person", "name": ["josh"], "age": [32]}] |
+      | m[{"id": "v[peter].id", "label": "person", "name": ["peter"], "age": [35]}] |
+      | m[{"id": "v[vadas].id", "label": "person", "name": ["vadas"], "age": [27]}] |
+      | m[{"id": "v[lop].id", "label": "software", "name": ["lop"]}] |
+      | m[{"id": "v[ripple].id", "label": "software", "name": ["ripple"]}] |
+
   Scenario: g_VX1X_outXcreatedX_valueMap
     Given the modern graph
     And using the parameter v1Id defined as "v[marko].id"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/caede9c8/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ValueMapTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ValueMapTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ValueMapTest.java
index 0935945..d1f08ce 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ValueMapTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ValueMapTest.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
+import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -31,6 +32,7 @@ import java.util.List;
 import java.util.Map;
 
 import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
+import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.*;
 
 /**
@@ -42,8 +44,12 @@ public abstract class ValueMapTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Map<String, List>> get_g_V_valueMap();
 
+    public abstract Traversal<Vertex, Map<String, Object>> get_g_V_valueMapXtrueX();
+
     public abstract Traversal<Vertex, Map<String, List>> get_g_V_valueMapXname_ageX();
 
+    public abstract Traversal<Vertex, Map<String, Object>> get_g_V_valueMapXtrue_name_ageX();
+
     public abstract Traversal<Vertex, Map<String, List<String>>> get_g_VX1X_outXcreatedX_valueMap(final Object v1Id);
 
     @Test
@@ -78,6 +84,43 @@ public abstract class ValueMapTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
+    public void g_V_valueMapXtrueX() {
+        final Traversal<Vertex, Map<String, Object>> traversal = get_g_V_valueMapXtrueX();
+        printTraversalForm(traversal);
+        int counter = 0;
+        while (traversal.hasNext()) {
+            counter++;
+            final Map<String, Object> values = traversal.next();
+            final String name = (String) ((List) values.get("name")).get(0);
+            assertEquals(4, values.size());
+            assertThat(values.containsKey(T.id), is(true));
+            if (name.equals("marko")) {
+                assertEquals(29, ((List) values.get("age")).get(0));
+                assertEquals("person", values.get(T.label));
+            } else if (name.equals("josh")) {
+                assertEquals(32, ((List) values.get("age")).get(0));
+                assertEquals("person", values.get(T.label));
+            } else if (name.equals("peter")) {
+                assertEquals(35, ((List) values.get("age")).get(0));
+                assertEquals("person", values.get(T.label));
+            } else if (name.equals("vadas")) {
+                assertEquals(27, ((List) values.get("age")).get(0));
+                assertEquals("person", values.get(T.label));
+            } else if (name.equals("lop")) {
+                assertEquals("java", ((List) values.get("lang")).get(0));
+                assertEquals("software", values.get(T.label));
+            } else if (name.equals("ripple")) {
+                assertEquals("java", ((List) values.get("lang")).get(0));
+                assertEquals("software", values.get(T.label));
+            } else {
+                throw new IllegalStateException("It is not possible to reach here: " + values);
+            }
+        }
+        assertEquals(6, counter);
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
     public void g_V_valueMapXname_ageX() {
         final Traversal<Vertex, Map<String, List>> traversal = get_g_V_valueMapXname_ageX();
         printTraversalForm(traversal);
@@ -113,6 +156,48 @@ public abstract class ValueMapTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
+    public void g_V_valueMapXtrue_name_ageX() {
+        final Traversal<Vertex, Map<String, Object>> traversal = get_g_V_valueMapXtrue_name_ageX();
+        printTraversalForm(traversal);
+        int counter = 0;
+        while (traversal.hasNext()) {
+            counter++;
+            final Map<String, Object> values = traversal.next();
+            final String name = (String) ((List) values.get("name")).get(0);
+            assertThat(values.containsKey(T.id), is(true));
+            if (name.equals("marko")) {
+                assertEquals(4, values.size());
+                assertEquals(29, ((List) values.get("age")).get(0));
+                assertEquals("person", values.get(T.label));
+            } else if (name.equals("josh")) {
+                assertEquals(4, values.size());
+                assertEquals(32, ((List) values.get("age")).get(0));
+                assertEquals("person", values.get(T.label));
+            } else if (name.equals("peter")) {
+                assertEquals(4, values.size());
+                assertEquals(35, ((List) values.get("age")).get(0));
+                assertEquals("person", values.get(T.label));
+            } else if (name.equals("vadas")) {
+                assertEquals(4, values.size());
+                assertEquals(27, ((List) values.get("age")).get(0));
+                assertEquals("person", values.get(T.label));
+            } else if (name.equals("lop")) {
+                assertEquals(3, values.size());
+                assertNull(values.get("lang"));
+                assertEquals("software", values.get(T.label));
+            } else if (name.equals("ripple")) {
+                assertEquals(3, values.size());
+                assertNull(values.get("lang"));
+                assertEquals("software", values.get(T.label));
+            } else {
+                throw new IllegalStateException("It is not possible to reach here: " + values);
+            }
+        }
+        assertEquals(6, counter);
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
     public void g_VX1X_outXcreatedX_valueMap() {
         final Traversal<Vertex, Map<String, List<String>>> traversal = get_g_VX1X_outXcreatedX_valueMap(convertToVertexId("marko"));
         printTraversalForm(traversal);
@@ -132,11 +217,21 @@ public abstract class ValueMapTest extends AbstractGremlinProcessTest {
         }
 
         @Override
+        public Traversal<Vertex, Map<String, Object>> get_g_V_valueMapXtrueX() {
+            return g.V().valueMap(true);
+        }
+
+        @Override
         public Traversal<Vertex, Map<String, List>> get_g_V_valueMapXname_ageX() {
             return g.V().valueMap("name", "age");
         }
 
         @Override
+        public Traversal<Vertex, Map<String, Object>> get_g_V_valueMapXtrue_name_ageX() {
+            return g.V().valueMap(true, "name", "age");
+        }
+
+        @Override
         public Traversal<Vertex, Map<String, List<String>>> get_g_VX1X_outXcreatedX_valueMap(final Object v1Id) {
             return g.V(v1Id).out("created").valueMap();
         }


[10/21] tinkerpop git commit: TINKERPOP-1863 Delaying the setting of requestId till the RequestMessage instantiation time

Posted by dk...@apache.org.
TINKERPOP-1863 Delaying the setting of requestId till the RequestMessage instantiation time

Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7e80bccb
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7e80bccb
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7e80bccb

Branch: refs/heads/TINKERPOP-1447
Commit: 7e80bccb4c0195a510bb20be4d5da65629ee2a7f
Parents: fbcb044
Author: Eugene Chung <bl...@gmail.com>
Authored: Sat Jan 6 07:46:42 2018 +0900
Committer: GitHub <no...@github.com>
Committed: Sat Jan 6 07:46:42 2018 +0900

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/driver/message/RequestMessage.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7e80bccb/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/RequestMessage.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/RequestMessage.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/RequestMessage.java
index 7a2ad3d..e836568 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/RequestMessage.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/message/RequestMessage.java
@@ -112,7 +112,7 @@ public final class RequestMessage {
      */
     public static final class Builder {
         public static final String OP_PROCESSOR_NAME = "";
-        private UUID requestId = UUID.randomUUID();
+        private UUID requestId;
         private String op;
         private String processor = OP_PROCESSOR_NAME;
         private Map<String, Object> args = new HashMap<>();
@@ -155,7 +155,7 @@ public final class RequestMessage {
          * Create the request message given the settings provided to the {@link Builder}.
          */
         public RequestMessage create() {
-            return new RequestMessage(requestId, op, processor, args);
+            return new RequestMessage(requestId == null ? UUID.randomUUID() : requestId, op, processor, args);
         }
     }
 


[05/21] tinkerpop git commit: Fix invisible comments - CTR

Posted by dk...@apache.org.
Fix invisible comments - CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/85592bf9
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/85592bf9
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/85592bf9

Branch: refs/heads/TINKERPOP-1447
Commit: 85592bf9c93b5eafb62368538f2178ce9aef55fb
Parents: 9511dac
Author: Robert Dale <ro...@gmail.com>
Authored: Sun Dec 31 10:20:33 2017 -0500
Committer: Robert Dale <ro...@gmail.com>
Committed: Sun Dec 31 10:20:33 2017 -0500

----------------------------------------------------------------------
 docs/postprocessor/processor.awk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/85592bf9/docs/postprocessor/processor.awk
----------------------------------------------------------------------
diff --git a/docs/postprocessor/processor.awk b/docs/postprocessor/processor.awk
index e640273..18ada47 100644
--- a/docs/postprocessor/processor.awk
+++ b/docs/postprocessor/processor.awk
@@ -28,7 +28,7 @@ BEGIN {
 
 /<\/style>/ {
   if (!styled) {
-    print ".invisible {position: absolute; left: 9999px}"
+    print ".invisible {color: rgba(0,0,0,0); font-size: 0;}"
     styled=1
   }
 }