tweak to test for GremlinServer's sake. Tweaked the docs around Optional Step 
to have the same look and feel as the other step docs.


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

Branch: refs/heads/master
Commit: 4fb9a8e6526b415e3d26ee094fcc9f5f3f36898b
Parents: 40971c9
Author: Marko A. Rodriguez <okramma...@gmail.com>
Authored: Mon Oct 31 12:10:16 2016 -0600
Committer: Marko A. Rodriguez <okramma...@gmail.com>
Committed: Mon Oct 31 12:10:16 2016 -0600

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc                   | 9 ++++-----
 .../gremlin/process/traversal/step/branch/OptionalTest.java | 3 +--
 2 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4fb9a8e6/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc 
b/docs/src/reference/the-traversal.asciidoc
index c5c30a3..a77d017 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -1146,12 +1146,11 @@ Option Step
 
 An option to a <<branch-step,`branch()`>> or <<choose-step,`choose()`>>
 
-
 [[optional-step]]
 Optional Step
 ~~~~~~~~~~~~~
 
-The `optional()`-step (*map*) returns the result of the specified traversal if 
it yields a result else it returns the calling
+The `optional()`-step (*branch/flatMap*) returns the result of the specified 
traversal if it yields a result else it returns the calling
 element, i.e. the `identity()`.
 
 [gremlin-groovy,modern]
@@ -1160,14 +1159,14 @@ g.V(2).optional(out('knows')) <1>
 g.V(2).optional(__.in('knows')) <2>
 ----
 
-<1> vadas does not have an `out` "know" edge so vadas is returned.
-<2> vadas does have an `in` "knows" edge so marko is returned.
+<1> vadas does not have an outgoing knows-edge so vadas is returned.
+<2> vadas does have an incoming knows-edge so marko is returned.
 
 `optional` is particularly useful for lifting entire graphs when used in 
conjunction with `path` or `tree`.
 
 [gremlin-groovy,modern]
 ----
-g.V().hasLabel('person').optional(out("knows").optional(out("created"))).path()
 <1>
+g.V().hasLabel('person').optional(out('knows').optional(out('created'))).path()
 <1>
 ----
 
 <1> Returns the paths of everybody followed by who they know followed by what 
they created.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4fb9a8e6/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/OptionalTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/OptionalTest.java
 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/OptionalTest.java
index cf252f1..bc2ce53 100644
--- 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/OptionalTest.java
+++ 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/OptionalTest.java
@@ -26,7 +26,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -134,7 +133,7 @@ public abstract class OptionalTest extends 
AbstractGremlinProcessTest {
         final Traversal<Vertex, String> traversal = 
get_g_VX1X_optionalXaddVXdogXX_label(convertToVertexId(this.graph, "marko"));
         printTraversalForm(traversal);
         checkResults(Collections.singletonList("dog"), traversal);
-        assertEquals(7, IteratorUtils.count(graph.vertices()));
+        assertEquals(7L, g.V().count().next().longValue());
     }
 
     public static class Traversals extends OptionalTest {

Reply via email to