You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/01/26 18:44:26 UTC

incubator-tinkerpop git commit: Minor tweaks to the console tutorial.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 4851f1ff8 -> cf9f95785


Minor tweaks to the console tutorial.


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

Branch: refs/heads/master
Commit: cf9f95785e6519787c2b317d347a27432e47eacf
Parents: 4851f1f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jan 26 12:43:56 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jan 26 12:43:56 2016 -0500

----------------------------------------------------------------------
 .../tutorials/advanced-console/index.asciidoc   | 182 +++++++++++--------
 1 file changed, 105 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/cf9f9578/docs/src/tutorials/advanced-console/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/tutorials/advanced-console/index.asciidoc b/docs/src/tutorials/advanced-console/index.asciidoc
index adb9e41..f7db305 100644
--- a/docs/src/tutorials/advanced-console/index.asciidoc
+++ b/docs/src/tutorials/advanced-console/index.asciidoc
@@ -20,13 +20,13 @@ image::apache-tinkerpop-logo.png[width=500]
 The Gremlin Console
 ===================
 
-In link:http://tinkerpop.apache.org/docs/x.y.z/tutorials/#_the_first_five_minutes["The First Five Minutes"]
+In link:http://tinkerpop.apache.org/docs/x.y.z/tutorials/getting-started/#_the_first_five_minutes["The First Five Minutes"]
 of the link:http://tinkerpop.apache.org[Apache TinkerPop] tutorial on how to
 link:http://tinkerpop.apache.org/docs/x.y.z/tutorials/getting-started/[get started] wth TinkerPop and graphs, the
-importance of the link:http://tinkerpop.apache.org/docs/x.y.z/#gremlin-console[Gremlin Console] was introduced. This
+importance of the link:http://tinkerpop.apache.org/docs/x.y.z/reference/#gremlin-console[Gremlin Console] was introduced. This
 tutorial further explores the usage of the console in the daily work of Gremlin developers delving more deeply
 into the details of its operations and expanding upon the basic usage guide in the
-link:http://tinkerpop.apache.org/docs/x.y.z/#gremlin-console[reference documentation].
+link:http://tinkerpop.apache.org/docs/x.y.z/reference[reference documentation].
 
 image::gremlin-dashboard.png[width="600",align="center"]
 
@@ -35,19 +35,20 @@ in general. Please be sure to read the link:http://tinkerpop.apache.org/docs/x.y
 tutorial prior to proceeding further with this one.
 
 The Gremlin Console serves a variety of use cases that can meet the needs of different types of Gremlin users. This
-tutorial explores the features of the Gremlin Console, through a number of these different use cases to hopefully
+tutorial explores the features of the Gremlin Console through a number of these different use cases to hopefully
 inspire you to new levels of usage. While a use case may not fit your needs, you may well find it worthwhile to
 read, as it is possible that a "feature" will be discussed that may be useful to you.
 
-The following points summarize the key features discussed in each of the use cases:
+The following points summarize the key features discussed of each use case:
 
 * <<learning-tool,A Learning Tool>>
 ** Introducing the <<toy-graphs,toy graphs>>
 ** Finding <<help,help>> for commands
 * <<application-devs,Application Developers>>
+** <<static-imports,Static importing>> of common methods
 ** <<result-iteration,Result iteration>>
 * <<ad-hoc, Ad-hoc Analysis>>
-** <<import-command,Importing classes>>
+** <<import-command,Importing new classes>>
 ** <<install-command, Installing new dependencies>>
 ** Deciding when to use the <<def-usage,def>> keyword
 
@@ -55,27 +56,35 @@ The following points summarize the key features discussed in each of the use cas
 Use Case: A Learning Tool
 -------------------------
 
-image:gremlin-grad.png[float=left,width=185] __You are a new user of Apache TinkerPop and perhaps new to graphs as well.  You're trying to get familiar with how
-Gremlin works and how it might fit into your project.  You want some "quick wins" with Gremlin and aim to conceptually
-prove that the TinkerPop stack is a good direction to go.__
+image:gremlin-grad.png[float=left,width=185] __You are a new user of Apache TinkerPop and perhaps new to graphs as well.
+You're trying to get familiar with how Gremlin works and how it might fit into your project.  You want some "quick
+wins" with Gremlin and aim to conceptually prove that the TinkerPop stack is a good direction to go.__
 
 It cannot be emphasized enough just how important the Gremlin Console is to new users. The interactive nature of a
 link:http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop[REPL] makes it possible to quickly try some
-Gremlin code and get some notion of success or failure without the longer process of build tools, IDEs, compilation,
-and application execution. The faster that you can iterate through versions of your Gremlin code, the faster you can
-advance your knowledge.
+Gremlin code and get some notion of success or failure without the longer process of build tools (e.g.
+link:https://maven.apache.org/[Maven]), link:https://en.wikipedia.org/wiki/Integrated_development_environment[IDEs],
+compilation, and application execution. The faster that you can iterate through versions of your Gremlin code, the
+faster you can advance your knowledge.
 
 As a new user, your best way to learn is to try Gremlin with a graph already packaged with the console:
 link:http://tinkerpop.apache.org/docs/x.y.z/reference/#tinkergraph-gremlin[TinkerGraph]. TinkerGraph is an in-memory
-graph that is easy to use and does not have a lot of configuration options to be concerned with. You can create an
-empty TinkerGraph as follows:
+graph database that is easy to use and does not have a lot of configuration options to be concerned with. You can
+create an empty TinkerGraph as follows:
 
 [gremlin-groovy]
 ----
-graph = TinkerGraph.open()
-g = graph.traversal()
+graph = TinkerGraph.open()   <1>
+g = graph.traversal()        <2>
 ----
 
+<1> Creates the `Graph` instance that is the API to the
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#_the_graph_structure[structure] of the graph.
+<2> Creates the `TraversalSource` which is the API for
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#_the_graph_process[processing] or traversing that `Graph`.
+
+IMPORTANT: TinkerPop recommends creating the `TraversalSource` once and re-using it as necessary in your application.
+
 [[toy-graphs]]
 Now that you have an empty TinkerGraph instance, you could load a sample of your data and get started with some
 traversals.  Of course, you might also try one of the "toy" graphs (i.e. graphs with sample data) that TinkerPop
@@ -87,9 +96,9 @@ for all TinkerPop examples and test cases.
 * `createModern()` - The TinkerPop 3.x representation of the "classic" graph, where the main difference is that vertex
 labels are defined and the "weight" edge property is a `double` rather than a `float`
 (link:http://tinkerpop.apache.org/docs/x.y.z/images/tinkerpop-modern.png[diagram]).
-* `createTheCrew` - A graph that demonstrates usage of the new structural features of TinkerPop 3.x (as compared to
-2.x) such as link:http://tinkerpop.apache.org/docs/x.y.z/#vertex-properties[vertex properties and multi-properties]
-(link:http://tinkerpop.apache.org/docs/x.y.zimages/the-crew-graph.png[diagram]).
+* `createTheCrew()` - A graph that demonstrates usage of the new structural features of TinkerPop 3.x (as compared to
+2.x) such as link:http://tinkerpop.apache.org/docs/x.y.z/reference/#vertex-properties[vertex properties and multi-properties]
+(link:http://tinkerpop.apache.org/docs/x.y.z/images/the-crew-graph.png[diagram]).
 
 [gremlin-groovy]
 ----
@@ -118,15 +127,15 @@ TIP: If you find yourself in a position where you need to ask a question on the
 link:http://groups.google.com/group/gremlin-users[Gremlin Users mailing list] about a traversal that you are having
 trouble with in your application, try to convert the gist of it to one of the toy graphs.  Taking this step will make it
 easier for advanced Gremlin users to help you, which should lead to a faster response time for your problem. In
-addition, there is the added benefit that the mailing list post will likely be more relevant to other users as it is not
-written solely in the context of your domain.
+addition, there is the added benefit that the mailing list post will likely be more relevant to other users, as it is
+not written solely in the context of your domain.
 
 [[help]]
 As you get familiar with the console, it is good to know what some of the basic commands are. A "command" is not
 "Gremlin code", but something interpreted by the console to have special meaning in terms of configuring how the
 console works or performing a particular function outside of code itself.  These commands are itemized in the
-link:http://tinkerpop.apache.org/docs/x.y.z/#_console_commands[reference documentation], but they also be accessed
-within the console itself with the `:help` command.
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#_console_commands[reference documentation], but they can also
+be accessed within the console itself with the `:help` command.
 
 [gremlin-groovy]
 ----
@@ -145,7 +154,7 @@ addition to the ones provided by TinkerPop. You can also request help on a speci
 The Gremlin Console can also provide you with code help via auto-complete functionality. Use the `<TAB>` key to
 trigger a search of possible method names that might complete what you've typed to that point.
 
-As you learn more about Gremlin you will find many code examples in the documentation and most all will be executable
+As you learn more about Gremlin, you will find many code examples in the documentation and most all will be executable
 in the console. Trying these examples for yourself and modifying their execution slightly to see how output changes is
 a good way to go about your Gremlin education.
 
@@ -157,11 +166,11 @@ image:gremlin-working-on-tinkerpop.png[width=350,float=right] __You are an appli
 will be central to your application architecture. You need to develop a series of services that will execute queries
 against a graph database in support of the front-end of the software.__
 
-Most application developers use an link:https://en.wikipedia.org/wiki/Integrated_development_environment[IDE], such
-as link:https://en.wikipedia.org/wiki/IntelliJ_IDEA[Intellij], to help with their software development efforts. The
-IDE provides shortcuts and conveniences that make an otherwise complex engineering job more productive. When
-developing applications for TinkerPop, the Gremlin Console should accompany the IDE as a productivity tool. In other
-words, when you open your IDE, open the Gremlin Console next to it.
+Most application developers use an IDE, such as link:https://en.wikipedia.org/wiki/IntelliJ_IDEA[Intellij], to help
+with their software development efforts. The IDE provides shortcuts and conveniences that make complex engineering jobs
+more productive. When developing applications for TinkerPop, the Gremlin Console should accompany the IDE as an
+additional tool to enhance that productivity. In other words, when you open your IDE, open the Gremlin Console next
+to it.
 
 You will find that as you write Gremlin for your code base in your IDE, you will inevitably reach a point of
 sufficient complexity in your traversals where you will need to:
@@ -169,14 +178,15 @@ sufficient complexity in your traversals where you will need to:
 * Quickly test the traversal over real data to determine if it is correct.
 * Test or debug pieces of the traversal in isolation.
 * Experiment with different ways of expressing the same traversal.
-* Examine the performance of a traversal through link:http://tinkerpop.apache.org/docs/x.y.z/#profile-step[profile()]
-step or by other link:http://tinkerpop.apache.org/docs/x.y.z/#benchmarking-and-profiling[profiling and benchmarking]
+* Examine the performance of a traversal through link:http://tinkerpop.apache.org/docs/x.y.z/reference/#profile-step[profile()]
+step or by other link:http://tinkerpop.apache.org/docs/x.y.z/reference/#benchmarking-and-profiling[profiling and benchmarking]
 methods.
 
 Consider an example where you are developing an application that uses TinkerGraph and the data from the "modern"
 toy graph. You want to encapsulate some logic for a graph traversal that finds a "person" vertex, iterates outgoing
 edges and groups the adjacent vertices as "value maps".
 
+[[static-imports]]
 As you have read the TinkerPop documentation and have been experimenting with Gremlin for a while, you head to your
 IDE with your open project in it and write a simple class like this:
 
@@ -186,22 +196,29 @@ package com.my.company;
 
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import static org.apache.tinkerpop.gremlin.structure.T.*;
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*;
 
 import java.util.List;
 import java.util.Map;
 
 public final class Traversals {
-  public static Map<String,List<Vertex>> groupAround(GraphTraversalSource g, long id) {
-    return g.V(id).outE().group().by(label).by(inV()).next()
+  public static Map<String,List<Vertex>> groupAround(GraphTraversalSource g, long vertexId) {
+    return g.V(vertexId).outE().group().by(label).by(inV()).next()
   }
 }
 ----
 
-In the "modern" graph, calling `groupAround` with "1" as the `id` argument, should return a `Map` with two keys:
+NOTE: TinkerPop code samples typically use link:https://docs.oracle.com/javase/8/docs/technotes/guides/language/static-import.html[static importing],
+which allows for a more fluid code style. If the static import above were removed in favor of a standard import of
+the `__` and `T` classes, the traversal would read as follows: `g.V(id).outE().group().by(T.label).by(__.inV()).next()`.
+The console automatically performs the static imports for these methods, so they do not need to be imported again
+in that environment.
+
+In the "modern" graph, calling `groupAround` with "1" as the `vertexId` argument, should return a `Map` with two keys:
 "knows" and "created", where the "knows" key should have vertices "2" and "4" and the "created" key should have
 vertex "3". As you are a good developer, you know to write a unit test to validate this outcome.  You write your
-test, compile your application, and execute your test only to find it failing on the "knows" key which only has one
+test, compile your application, and execute your test only to find it failing on the "knows" key, which only has one
 vertex associated to it instead of two.
 
 [[result-iteration]]
@@ -226,9 +243,8 @@ g.V(1).outE().group().by(label).by(inV()).next()
 
 In this case, the line of execution does not return a `Traversal`.  It returns the first item in the `Traversal` with
 the call to `next()`.  This first item is a `Map`.  When the console detects that it is a `Map`, it iterates the
-`entries()` and prints each to the screen.
-
-It is possible to "prevent" auto-iteration which is useful when you want to work with a `Traversal` as a variable.
+`entrySet()` and prints each `Map.Entry` to the screen. It is possible to "prevent" auto-iteration, which is useful
+when you want to work with a `Traversal` as a variable. You can do this with a clever use of a semi-colon:
 
 [gremlin-groovy,modern]
 ----
@@ -245,7 +261,8 @@ containing the appropriate number of vertices in the context of iteration. In th
 `by()` modulator takes `inV()` as an argument (an anonymous `Traversal` spawned from the `__` class whose methods are
 statically imported to the console). This `by()` tells Gremlin what aspect of the current group of edges should be
 stored in the list associated with that group.  By specifying `inV()` you are saying that you want to store the
-in-vertices of the edges for a group.
+link:http://tinkerpop.apache.org/docs/x.y.z/tutorials/getting-started/#_the_next_fifteen_minutes[in-vertices] of the
+edges for a group.
 
 WARNING: While convenient, statically imported methods can be confusing for new users, especially those who are
 translating their code between the console (which is Groovy-based) and a Java IDE. Take care with the use of the
@@ -271,14 +288,15 @@ package com.my.company;
 
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import static org.apache.tinkerpop.gremlin.structure.T.*;
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*;
 
 import java.util.List;
 import java.util.Map;
 
 public final class Traversals {
-  public static Map<String,List<Vertex>> groupAround(GraphTraversalSource g, long id) {
-    return g.V(id).outE().group().by(label).by(inV().fold()).next()
+  public static Map<String,List<Vertex>> groupAround(GraphTraversalSource g, long vertexId) {
+    return g.V(vertexId).outE().group().by(label).by(inV().fold()).next()
   }
 }
 ----
@@ -293,7 +311,7 @@ g.V().has('name','marko').count()
 ----
 
 As you can see, the first traversal removes vertices with the "name" field of "marko" and the second traversal verifies
-that there are no vertices named "marko" after the first is executed.  After seeing success like that in the console
+that there are no vertices named "marko" after the first is executed.  After seeing success like that in the console,
 it is all too tempting to copy and paste that line of code to a Java class like:
 
 [source,java]
@@ -301,11 +319,10 @@ it is all too tempting to copy and paste that line of code to a Java class like:
 package com.my.company;
 
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*;
 
 public final class Traversals {
   public static void removeByName(GraphTraversalSource g, String name) {
-    g.V().has('name', name).drop();
+    g.V().has("name", name).drop();
   }
 }
 ----
@@ -320,18 +337,17 @@ of the console you must add `iterate()` as follows:
 package com.my.company;
 
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*;
 
 public final class Traversals {
   public static void removeByName(GraphTraversalSource g, String name) {
-    g.V().has('name', name).drop().iterate();
+    g.V().has("name", name).drop().iterate();
   }
 }
 ----
 
-The call to `iterate()` will do what the console does automatically and executes the `Traversal` instance and steps
+The call to `iterate()` will do what the console does automatically, executing the `Traversal` instance and stepping
 through the results.  You will generally use `iterate()` to generate side-effects (e.g. drop vertices from the
-database) and it has its usage in the console as well.  If you have an especially long result set for which
+database), though it has its usage in the console as well.  If you have an especially long result set for which
 side-effects will be generated, you can simply call `iterate()` on the traversal and avoid a long stream of output to
 the console.
 
@@ -345,7 +361,7 @@ Use Case: Ad-hoc Analysis
 -------------------------
 
 __You are doing some general analysis on a graph with Gremlin and decide that you'd like to store those results in
-Cassandra for additional analysis with other tools.__
+link:http://cassandra.apache.org/[Apache Cassandra] for additional analysis with other tools.__
 
 image:gremlin-explorer-old-photo.png[float=right,width=350] The Gremlin Console is an indispensable tool for working
 with graph data, but it is also well suited for working with other types of data as well. Its ability to process data
@@ -366,9 +382,9 @@ g.V().hasLabel('person').valueMap()
 ----
 
 You can see from the output above that there are four "person" vertices and each has a "name" property and a "location"
-property.  The "location" is actually a link:http://tinkerpop.apache.org/docs/x.y.z/#vertex-properties[multi-property],
+property.  The "location" is actually a link:http://tinkerpop.apache.org/docs/x.y.z/reference/#vertex-properties[multi-property],
 where "location" does not have one value, but several. If you look a bit closer you can also see that each "location"
-has link:http://tinkerpop.apache.org/docs/x.y.z/#vertex-properties[meta-properties] as well:
+has link:http://tinkerpop.apache.org/docs/x.y.z/reference/#vertex-properties[meta-properties] as well:
 
 [gremlin-groovy,theCrew]
 ----
@@ -378,7 +394,7 @@ g.V().hasLabel('person').as('person').
 ----
 
 You are pleased.  You like that you have the basic data present to achieve your goal, but you see a couple of problems.
-First, just given a quick glance at the data, you can see that the data doesn't uniformly start at a particular time.
+First, given a quick glance at the data, you can see that the data doesn't uniformly start at a particular time.
 You were hoping to see data presented in such a way that each "person" had data starting and ending in the same years.
 The second problem you can see is that the data really isn't in a format that you need. Ideally, you would like to
 have something that had rows and columns that was easily dumped to CSV for use in other tools. You currently have the
@@ -396,14 +412,16 @@ firstYear = g.V().hasLabel('person').
                   max().next()
 ----
 
-You store that result in a variable called "firstYear" as you will likely need that later to help filter results in the
+You store that result in a variable called "firstYear", as you will likely need that later to help filter results in the
 traversal that ultimately gets the data.  It is often helpful to store results from traversals if you intend to work
 with that data later and the traversal itself is expensive to execute. It is only important to keep in mind that you
 will be limited by the memory available to the console.
 
-TIP: The `-Xmx` setting for Gremlin Console can be changed in `bin/gremlin.sh`. It is likely best to append them to
-the initialization of the `JAVA_OPTIONS` variable in that script.  If you choose to override `JAVA_OPTIONS`, be sure
-to examine the default settings in `bin/gremlin.sh` to include them as they should not be omitted in your override.
+TIP: You can change the amount of memory allotted to the console by altering its `-Xmx` setting in `bin/gremlin.sh`.
+This setting controls the maximum size of the JVM memory allocation pool. To set this value to 1024 megabytes, you
+would set this value as follows: `-Xmx1024m`. It is likely best to append this setting to the initialization of the
+`JAVA_OPTIONS` variable in that script.  If you choose to override `JAVA_OPTIONS`, be sure to examine the default
+settings in `bin/gremlin.sh` to include them as they should not be omitted in your override.
 
 In an attempt to test things out, you take a naive approach at the traversal with your filter for "firstYear" applied:
 
@@ -440,11 +458,12 @@ l.collect{
 You had to apply a bit of brute force, but now you have the rows and columns you wanted, with the data normalized and
 flattened in such a way that each year since "2004" is represented all the way up to 2016.
 
-image:gremlin-asciiart.png[width=225,float=right] Unfortunately, you are unsatisfied. The added Groovy processing of "l" feels "wrong" despite it producing the correct
-output.  It has that unfortunate hack for dealing with the possibility that the "endTime" property contains a "null"
-value, thus hard-coding the future "2017" year into the it.  You also recall that the Gremlin language has advanced
-considerably in TinkerPop 3.x and that it is usually possible to eliminate closures and other direct processing
-with Groovy. With those issues in mind, you look to enhance your work.
+image:gremlin-asciiart.png[width=225,float=right] Unfortunately, you are unsatisfied. The added Groovy processing of
+"l" feels "wrong" despite it producing the correct output.  It has that unfortunate hack for dealing with the
+possibility that the "endTime" property contains a "null" value, thus hard-coding the "2017" year into the it (you
+want the years through 2016).  You also recall that the Gremlin language has advanced considerably in TinkerPop 3.x
+and that it is usually possible to eliminate closures and other direct processing with Groovy. With those issues in
+mind, you look to enhance your work.
 
 [[import-command]]
 A first step would be to get rid of the hard-coded "2017". You decide to get the current year programmatically by
@@ -458,7 +477,7 @@ import java.time.Year
 Year.now()
 ----
 
-You can now use `Year` with the link:http://tinkerpop.apache.org/docs/x.y.z/#constant-step[constant()] step,
+You can now use `Year` with the link:http://tinkerpop.apache.org/docs/x.y.z/reference/#constant-step[constant()] step,
 to produce the set of years to have for each person up to the current year:
 
 [gremlin-groovy,theCrew]
@@ -504,11 +523,11 @@ other libraries into the console with the `:install` command. With `:install`, y
 coordinates (i.e. group, artifact, and version) of a library to have it automatically downloaded from a Maven
 repository and placed into the console classpath. If you have read through the reference documentation, you would find
 a number of examples of `:install` usage to bring in unbundled TinkerPop libraries, like
-link:http://tinkerpop.apache.org/docs/x.y.z/#neo4j-gremlin[neo4j-gremlin] or
-link:http://tinkerpop.apache.org/docs/x.y.z/#hadoop-gremlin[hadoop-gremlin].
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#neo4j-gremlin[neo4j-gremlin] or
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#hadoop-gremlin[hadoop-gremlin].
 
 IMPORTANT: Before you use the `:install` command, please be sure to read the reference documentation on
-link:http://tinkerpop.apache.org/docs/x.y.z/#gremlin-applications[Grape configuration]. If you do not have proper
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#gremlin-applications[Grape configuration]. If you do not have proper
 settings in place, it is likely that the `:install` command will fail by way of download errors.
 
 TIP: You can also manually "install" dependencies to the console by copying them into the Gremlin Console classpath.
@@ -537,8 +556,8 @@ been copied to the classpath. The remaining lines of code demonstrate how to ins
 connect to a running Cassandra instance. link:http://docs.datastax.com/en/cql/3.1/cql/cql_reference/cqlReferenceTOC.html[CQL]
 statements are then issued to create the keyspace and table to hold the data.
 
-Now that you have a `Session` established with a table to store the data in, you can use the
-link:http://tinkerpop.apache.org/docs/x.y.z/#lambda-steps[sideEffect()] step to stream the data to Cassandra:
+Now that you have a `Session` established with a table to store the data in, you can iterate through the `Traversal`
+and stream the data to Cassandra:
 
 [source,groovy]
 ----
@@ -548,14 +567,13 @@ gremlin>       select("person").coalesce(properties("location").filter(values("s
 gremlin>                                                        order().by("startTime").limit(1),
 gremlin>                                 properties("location").hasNot("endTime")).value().as("location").
 gremlin>       select("person","year","location").by("name").by().by().
-gremlin>       sideEffect{
-gremlin>         def row = it.get()
+gremlin>       forEachRemaining{
 gremlin>         def statement = insertInto("locations").
-gremlin>                         value("name", row.person).
-gremlin>                         value("location", row.location).
-gremlin>                         value("year", row.year)
+gremlin>                         value("name", it.person).
+gremlin>                         value("location", it.location).
+gremlin>                         value("year", it.year)
 gremlin>         session.execute(statement)
-gremlin>       }.iterate()
+gremlin>       }
 gremlin> session.execute(select().all().from("locations"))
 ==>Row[daniel, 2004, kaiserslautern]
 ==>Row[daniel, 2005, kaiserslautern]
@@ -570,10 +588,20 @@ gremlin> session.execute(select().all().from("locations"))
 ----
 
 [[def-usage]]
-TIP: The `sideEffect()` takes the `Traverser` referred to as "it" (the default naming in Groovy for the argument in a
-closure), and assigns the object it is holding to a variable called "row". Note the use of `def` in this case. In the
-console, the use of `def` inside a closure scopes that variable to the closure.  Without `def` the "row" variable would
-be accessible globally (i.e. at the `gremlin>` prompt).
+Iteration is performed by the call to `forEachRemaining()`. The closure supplied to that method is applied to each "row"
+in the `Traversal`.  Note the use of `def` in that closure to declare the "statement" variable. In the console, the
+use of `def` inside a closure scopes that variable to the closure.  Without `def` the "row" variable would
+be accessible globally (i.e. at the `gremlin>` prompt). The use of `def` at the console prompt for variable definition
+is unecessary and will result in error:
+
+[source,groovy]
+----
+gremlin> def x = 10
+==>10
+gremlin> x
+No such property: x for class: groovysh_evaluate
+Display stack trace? [yN] n
+----
 
 TIP: If you find that you always work with a particular library, consider starting the console with an initialization
 script that prepares your environment for you. An "initialization script" is just a Groovy script that contains the