You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/03/12 16:20:35 UTC

incubator-tinkerpop git commit: docs building with new TraversalContext model.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 4fda334ea -> b4e342d63


docs building with new TraversalContext model.


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

Branch: refs/heads/master
Commit: b4e342d6384af7f2661b25a8c4056a3693f59a90
Parents: 4fda334
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Mar 12 09:20:21 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Mar 12 09:20:32 2015 -0600

----------------------------------------------------------------------
 docs/preprocessor/processor.groovy     |   6 +-
 docs/src/gremlin-applications.asciidoc |   2 +-
 docs/src/implementations.asciidoc      |  12 +-
 docs/src/intro.asciidoc                |  28 +--
 docs/src/the-graph.asciidoc            | 274 ++++++----------------------
 docs/src/the-graphcomputer.asciidoc    |  42 +++--
 docs/src/the-traversal.asciidoc        |  33 ++--
 7 files changed, 109 insertions(+), 288 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b4e342d6/docs/preprocessor/processor.groovy
----------------------------------------------------------------------
diff --git a/docs/preprocessor/processor.groovy b/docs/preprocessor/processor.groovy
index 21caec1..dc7de92 100644
--- a/docs/preprocessor/processor.groovy
+++ b/docs/preprocessor/processor.groovy
@@ -110,10 +110,12 @@ new File(this.args[0]).withReader { reader ->
         } else {
             if (line.startsWith("[gremlin-")) {
                 def parts = line.split(/,/, 2)
-                def graph = parts.size() == 2 ? parts[1].capitalize().replaceAll(/\s*\]\s*$/, "") : ""
+                def graphString = parts.size() == 2 ? parts[1].capitalize().replaceAll(/\s*\]\s*$/, "") : ""
                 def lang = parts[0].split(/-/, 2)[1].replaceAll(/\s*\]\s*$/, "")
-                def g = graph.isEmpty() ? TinkerGraph.open() : TinkerFactory."create${graph}"()
+                def graph = graphString.isEmpty() ? TinkerGraph.open() : TinkerFactory."create${graphString}"()
+                def g = graph.traversal(standard)
                 engine = ScriptEngineCache.get(lang)
+                engine.put("graph",graph)
                 engine.put("g", g)
                 engine.put("marko", g.V().has("name", "marko").tryNext().orElse(null))
                 reader.readLine()

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b4e342d6/docs/src/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/gremlin-applications.asciidoc b/docs/src/gremlin-applications.asciidoc
index c4b4be8..c1753e5 100644
--- a/docs/src/gremlin-applications.asciidoc
+++ b/docs/src/gremlin-applications.asciidoc
@@ -93,7 +93,7 @@ The "toy" graph provides a way to get started with Gremlin quickly.
 
 [gremlin-groovy]
 ----
-g = TinkerFactory.createModern()
+g = TinkerFactory.createModern().traversal(standard)
 g.V()
 g.V().values('name')
 g.V().has('name','marko').out('knows').values('name')

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b4e342d6/docs/src/implementations.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/implementations.asciidoc b/docs/src/implementations.asciidoc
index ddc7a63..aee3cd4 100644
--- a/docs/src/implementations.asciidoc
+++ b/docs/src/implementations.asciidoc
@@ -406,12 +406,14 @@ The runtimes for a vertex lookup by property is provided below for both no-index
 
 [gremlin-groovy]
 ----
-g = TinkerGraph.open()
-g.io().readGraphML('data/grateful-dead.xml')
+graph = TinkerGraph.open()
+g = graph.traversal(standard)
+graph.io().readGraphML('data/grateful-dead.xml')
 clock(1000) {g.V().has('name','Garcia').next()} <1>
-g = TinkerGraph.open()
-g.createIndex('name',Vertex.class)
-g.io().readGraphML('data/grateful-dead.xml')
+graph = TinkerGraph.open()
+g = graph.traversal(standard)
+graph.createIndex('name',Vertex.class)
+graph.io().readGraphML('data/grateful-dead.xml')
 clock(1000){g.V().has('name','Garcia').next()} <2>
 ----
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b4e342d6/docs/src/intro.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/intro.asciidoc b/docs/src/intro.asciidoc
index 9fe85ff..c40fde1 100644
--- a/docs/src/intro.asciidoc
+++ b/docs/src/intro.asciidoc
@@ -207,7 +207,7 @@ $ bin/gremlin.sh
          \,,,/
          (o o)
 -----oOOo-(3)-oOOo-----
-gremlin> g = TinkerFactory.createModern()
+gremlin> graph = TinkerFactory.createModern()
 ==>tinkergraph[vertices:6 edges:6]
 gremlin> g.V().has('name','marko').out('knows').values('name')
 ==>vadas
@@ -219,8 +219,8 @@ Or, if the marko-vertex is already realized with a direct reference pointer (i.e
 [gremlin-groovy,modern]
 ----
 marko = g.V().has('name','marko').next()
-marko.out('knows') <1>
-marko.out('knows').values('name') <2>
+g.V(marko).out('knows') <1>
+g.V(marko).out('knows').values('name') <2>
 ----
 
 <1> Set the variable `marko` to the the vertex in the graph `g` named "marko".
@@ -230,24 +230,6 @@ marko.out('knows').values('name') <2>
 .The Name of The People That Marko Knows
 image::tinkerpop-classic-ex1.png[width=500]
 
-It is possible to represent any `map()`, `filter()`, or `sideEffect()` step using `flatMap()`. Map can return an iterator with a single object in it. Filter can return an iterator with a single object in it or no object at all. Side-effect can return an iterator containing the incoming object, but also update some other area of memory. Thus, ignoring `branch()`, `flatMap()` is the most general construct -- "turn the incoming object into an iterator of objects."
-
-[gremlin-groovy,modern]
-----
-g.V().filter {it.get().value('name') == 'marko'}.
-      flatMap {it.get().out('knows')}.
-      map {it.get().value('name')}
-----
-
-Finally, as a strictly academic exercise, the traversal can be written completely using flatMap.
-
-[gremlin-groovy,modern]
-----
-g.V().flatMap {it.get().value('name') == 'marko' ? [it.get()].iterator() : [].iterator()}.
-      flatMap {it.get().out('knows')}.
-      flatMap {[it.get().value('name')].iterator()}
-----
-
 NOTE: Gremlin-Java is much more aligned with Gremlin-Groovy in TinkerPop3 than it ever was before. In TinkerPop0 through TinkerPop2, Gremlin-Java was extremely verbose due to the simulation of lambdas via anonymous inner classes.  
 
 The Traverser
@@ -261,7 +243,7 @@ In TinkerPop3, the objects propagating through the traversal are wrapped in a `T
 
 [gremlin-groovy,modern]
 ----
-marko.out('knows').values('name').path()
+g.V(marko).out('knows').values('name').path()
 ----
 
 CAUTION: Path calculation is costly in terms of space as an array of previously seen objects is stored in each path of the respective traverser. Thus, traversal optimizers analyze the traversal to determine if path metadata is accessed. If not, then path calculations are turned off.
@@ -270,7 +252,7 @@ Another example is the `repeat()`-step which takes into account the number of ti
 
 [gremlin-groovy,modern]
 ----
-marko.repeat(out()).times(2).values('name')
+g.V(marko).repeat(out()).times(2).values('name')
 ----
 
 NOTE: In TinkerPop2, the `repeat()`-step was called `loop()`. Repeat has been generalized to support both do-while and while-do semantics which is explained in <<repeat-step,Repeat Step>>.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b4e342d6/docs/src/the-graph.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/the-graph.asciidoc b/docs/src/the-graph.asciidoc
index b380125..6e393a7 100644
--- a/docs/src/the-graph.asciidoc
+++ b/docs/src/the-graph.asciidoc
@@ -32,9 +32,9 @@ The following example in the Gremlin Console shows how to print all the features
 
 [source,groovy]
 ----
-gremlin> g = TinkerGraph.open()
+gremlin> graph = TinkerGraph.open()
 ==>tinkergraph[vertices:0 edges:0]
-gremlin> g.features()
+gremlin> graph.features()
 ==>FEATURES
 > GraphFeatures
 >-- Persistence: false
@@ -52,8 +52,8 @@ A common pattern for using features is to check their support prior to performin
 
 [gremlin-groovy]
 ----
-g.features().graph().supportsTransactions()
-g.features().graph().supportsTransactions() ? g.tx().commit() : "no tx"
+graph.features().graph().supportsTransactions()
+graph.features().graph().supportsTransactions() ? g.tx().commit() : "no tx"
 ----
 
 TIP: To ensure vendor agnostic code, always check feature support prior to usage of a particular function.  In that way, the application can behave gracefully in case a particular implementation is provided at runtime that does not support a function being accessed.
@@ -152,12 +152,9 @@ g.V().has('name','gremlin').inE('uses').
       order().by('skill',incr).as('a').
       outV().as('b').
       select().by('skill').by('name') // rank the users of gremlin by their skill level
-g.variables() // access the global graph variables
-g.variables().get('creator')
-g.variables().get('creator').get()
-g.V().has('name',g.variables().get('creator').get()).
-      properties('location').as('a').valueMap().as('b').
-      select('a','b').by(value).by() // get the creator's vertex and for each location, get the associated properties
+graph.variables() // access the global graph variables
+graph.variables().get('creator')
+graph.variables().get('creator').get()
 ----
 
 Graph Variables
@@ -173,15 +170,15 @@ An example of graph variables in use is presented below in Gremlin-Groovy:
 
 [gremlin-groovy]
 ----
-g = TinkerGraph.open()
-g.variables()
-g.variables().set('systemAdmins',['stephen','peter','pavel'])
-g.variables().set('systemUsers',['matthias','marko','josh'])
-g.variables().keys()
-g.variables().get('systemUsers')
-g.variables().get('systemUsers').get()
-g.variables().remove('systemAdmins')
-g.variables().keys()
+graph = TinkerGraph.open()
+graph.variables()
+graph.variables().set('systemAdmins',['stephen','peter','pavel'])
+graph.variables().set('systemUsers',['matthias','marko','josh'])
+graph.variables().keys()
+graph.variables().get('systemUsers')
+graph.variables().get('systemUsers').get()
+graph.variables().remove('systemAdmins')
+graph.variables().keys()
 ----
 
 [[transactions]]
@@ -212,32 +209,32 @@ Once there is an understanding for how transactions are configured, most of the
 
 [source,groovy]
 ----
-gremlin> g = Neo4jGraph.open('/tmp/neo4j')
+gremlin> graph = Neo4jGraph.open('/tmp/neo4j')
 ==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]
-gremlin> g.features()
+gremlin> graph.features()
 ==>FEATURES
 > GraphFeatures
 >-- Transactions: true  <1>
 >-- Computer: false
 >-- Persistence: true
 ...
-gremlin> g.tx().onReadWrite(Transaction.READ_WRITE_BEHAVIOR.AUTO) <2>
+gremlin> graph.tx().onReadWrite(Transaction.READ_WRITE_BEHAVIOR.AUTO) <2>
 ==>org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph$Neo4jTransaction@1c067c0d
-gremlin> g.addVertex("name","stephen")  <3>
+gremlin> graph.addVertex("name","stephen")  <3>
 ==>v[0]
-gremlin> g.tx().commit() <4>
+gremlin> graph.tx().commit() <4>
 ==>null
-gremlin> g.tx().onReadWrite(Transaction.READ_WRITE_BEHAVIOR.MANUAL) <5>
+gremlin> graph.tx().onReadWrite(Transaction.READ_WRITE_BEHAVIOR.MANUAL) <5>
 ==>org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph$Neo4jTransaction@1c067c0d
-gremlin> g.tx().isOpen()
+gremlin> graph.tx().isOpen()
 ==>false
-gremlin> g.addVertex("name","marko") <6>
+gremlin> graph.addVertex("name","marko") <6>
 Open a transaction before attempting to read/write the transaction
-gremlin> g.tx().open() <7>
+gremlin> graph.tx().open() <7>
 ==>null
-gremlin> g.addVertex("name","marko") <8>
+gremlin> graph.addVertex("name","marko") <8>
 ==>v[1]
-gremlin> g.tx().commit()
+gremlin> graph.tx().commit()
 ==>null
 ----
 
@@ -254,9 +251,9 @@ The `Transaction` object also exposes a method for executing automatic transacti
 
 [source,groovy]
 ----
-gremlin> g.tx().submit {it.addVertex("name","josh")}.retry(10)
+gremlin> graph.tx().submit {it.addVertex("name","josh")}.retry(10)
 ==>v[2]
-gremlin> g.tx().submit {it.addVertex("name","daniel")}.exponentialBackoff(10)
+gremlin> graph.tx().submit {it.addVertex("name","daniel")}.exponentialBackoff(10)
 ==>v[3]
 ----
 
@@ -387,8 +384,8 @@ The following code shows how to write a `Graph` instance to file called `tinkerp
 
 [source,java]
 ----
-final Graph g = TinkerFactory.createModern();
-g.io().writeGraphML("tinkerpop-modern.xml");
+final Graph graph = TinkerFactory.createModern();
+graph.io().writeGraphML("tinkerpop-modern.xml");
 final Graph newGraph = TinkerGraph.open();
 newGraph.io().readGraphML("tinkerpop-modern.xml");
 ----
@@ -397,9 +394,9 @@ If a custom configuration is required, then have the `Graph` generate a `GraphRe
 
 [source,java]
 ----
-final Graph g = TinkerFactory.createModern();
+final Graph graph = TinkerFactory.createModern();
 try (final OutputStream os = new FileOutputStream("tinkerpop-modern.xml")) {
-    g.io().graphMLWriter().normalize(true).create().writeGraph(os);
+    graph.io().graphMLWriter().normalize(true).create().writeGraph(os);
 }
 
 final Graph newGraph = TinkerGraph.open();
@@ -420,8 +417,8 @@ GraphSON supports all of the `GraphReader` and `GraphWriter` interface methods a
 
 [source,java]
 ----
-final Graph g = TinkerFactory.createModern();
-g.io().writeGraphSON("tinkerpop-modern.json");
+final Graph graph = TinkerFactory.createModern();
+graph.io().writeGraphSON("tinkerpop-modern.json");
 
 final Graph newGraph = TinkerGraph.open();
 newGraph.io().readGraphSON("tinkerpop-modern.json");
@@ -431,10 +428,10 @@ If a custom configuration is required, then have the `Graph` generate a `GraphRe
 
 [source,java]
 ----
-final Graph g = TinkerFactory.createModern();
+final Graph graph = TinkerFactory.createModern();
 try (final OutputStream os = new FileOutputStream("tinkerpop-modern.json")) {
-    final GraphSONMapper mapper = g.io().graphSONMapper().normalize(true).create()
-    g.io().graphSONWriter().mapper(mapper).create().writeGraph(os, g)
+    final GraphSONMapper mapper = graph.io().graphSONMapper().normalize(true).create()
+    graph.io().graphSONWriter().mapper(mapper).create().writeGraph(os, g)
 }
 
 final Graph newGraph = TinkerGraph.open();
@@ -447,11 +444,11 @@ One of the important configuration options of the `GraphSONReader` and `GraphSON
 
 [source,groovy]
 ----
-gremlin> g = TinkerFactory.createModern()
+gremlin> graph = TinkerFactory.createModern()
 ==>tinkergraph[vertices:6 edges:6]
 gremlin> f = new FileOutputStream("vertex-1.json")
 ==>java.io.FileOutputStream@3bbf9027
-gremlin> g.io().graphSONWriter().create().writeVertex(f, g.V(1).next(), BOTH)
+gremlin> graph.io().graphSONWriter().create().writeVertex(f, g.V(1).next(), BOTH)
 ==>null
 gremlin> f.close()
 ==>null
@@ -535,13 +532,13 @@ With a minor change to the construction of the `GraphSONWriter` the lossy nature
 
 [source,groovy]
 ----
-gremlin> g = TinkerFactory.createModern()
+gremlin> graph = TinkerFactory.createModern()
 ==>tinkergraph[vertices:6 edges:6]
 gremlin> f = new FileOutputStream("vertex-1.json")
 ==>java.io.FileOutputStream@3bbf9027
-gremlin> mapper = g.io().graphSONMapper().embedTypes(true).create()
+gremlin> mapper = graph.io().graphSONMapper().embedTypes(true).create()
 ==>org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper@2ce45a7b
-gremlin> g.io().graphSONWriter().mapper(mapper).create().writeVertex(f, g.V(1).next(), BOTH)
+gremlin> graph.io().graphSONWriter().mapper(mapper).create().writeVertex(f, g.V(1).next(), BOTH)
 ==>null
 gremlin> f.close()
 ==>null
@@ -668,8 +665,8 @@ Kryo supports all of the `GraphReader` and `GraphWriter` interface methods and c
 
 [source,java]
 ----
-final Graph g = TinkerFactory.createModern();
-g.io().writeGryo("tinkerpop-modern.kryo");
+final Graph graph = TinkerFactory.createModern();
+graph.io().writeGryo("tinkerpop-modern.kryo");
 
 final Graph newGraph = TinkerGraph.open();
 newGraph.io().readGryo("tinkerpop-modern.kryo")'
@@ -679,9 +676,9 @@ If a custom configuration is required, then have the `Graph` generate a `GraphRe
 
 [source,java]
 ----
-final Graph g = TinkerFactory.createModern();
+final Graph graph = TinkerFactory.createModern();
 try (final OutputStream os = new FileOutputStream("tinkerpop-modern.kryo")) {
-    g.io().gryoWriter().create().writeGraph(os);
+    graph.io().gryoWriter().create().writeGraph(os);
 }
 
 final Graph newGraph = TinkerGraph.open();
@@ -705,9 +702,9 @@ The following represents an example migration of the "classic" toy graph.  In th
 ----
 gremlin> Gremlin.version()
 ==>2.5.z
-gremlin> g = TinkerGraphFactory.createTinkerGraph()
+gremlin> graph = TinkerGraphFactory.createTinkerGraph()
 ==>tinkergraph[vertices:6 edges:6]
-gremlin> GraphSONWriter.outputGraph(g,'/tmp/tp2.json',GraphSONMode.EXTENDED)
+gremlin> GraphSONWriter.outputGraph(graph,'/tmp/tp2.json',GraphSONMode.EXTENDED)
 ==>null
 ----
 
@@ -717,12 +714,13 @@ The above console session uses the `gremlin-groovy` distribution from TinkerPop2
 ----
 gremlin> Gremlin.version()
 ==>x.y.z
-gremlin> g = TinkerGraph.open()
+gremlin> graph = TinkerGraph.open()
 ==>tinkergraph[vertices:0 edges:0]
 gremlin> r = LegacyGraphSONReader.build().create()
 ==>org.apache.tinkerpop.gremlin.structure.io.graphson.LegacyGraphSONReader@64337702
-gremlin> r.readGraph(new FileInputStream('/tmp/tp2.json'),g)
+gremlin> r.readGraph(new FileInputStream('/tmp/tp2.json'),graph)
 ==>null
+gremlin> g = graph.traversal(standard)
 gremlin> g.E()
 ==>e[11][4-created->3]
 ==>e[12][6-created->3]
@@ -732,174 +730,6 @@ gremlin> g.E()
 ==>e[10][4-created->5]
 ----
 
-The above console session uses the TinkerPop3 Gremlin Console.  It creates a new `TinkerGraph` which the TinkerPop2 GraphSON will be loaded into and uses the `LegacyGraphSONReader` to import the `tp2.json` file.
-
-[[graphstrategy]]
-GraphStrategy
--------------
-
-A `GraphStrategy` provides a way to expand, inspect or otherwise alter the behavior of a `Graph` implementation.  A graph strategy injects arbitrary functions into the `Graph` API, so that when a method call is made, the strategy functions can manipulate the default behavior of the underlying `Graph`.  TinkerPop3 is packaged with the following strategies:
-
-* `IdentityStrategy` - a "do nothing" `GraphStrategy` that executes the function as it is passed into the strategy
-* `IdStrategy` - enables support for custom element identifiers for those graphs which don't otherwise support them
-* `PartitionStrategy` - enables support for logical graph partitioning where the `Graph` can be blinded to different parts of the total graph
-* `ReadOnlyStrategy` - prevents writing to the `Graph`
-* `SequenceStrategy` - apply multiple `GraphStrategy` implementations in sequenced ordered to a single `Graph` instance
-* `SubgraphStrategy` - create a logical subgraph which selectively includes vertices and edges of a `Graph` according to provided criteria
-
-NOTE: TinkerPop2 had the notion of "Graph Wrappers" which decorated standard `Graph` implementations with additional features.  A `GraphStrategy` is generally analogous to that capability.
-
-To use a `GraphStrategy` instance, use the `Graph.strategy()` method to instantiate the `StrategyGraph` as follows:
-
-[gremlin-groovy]
-----
-g = TinkerFactory.createModern()
-sg = g.strategy(IdentityStrategy.instance())
-sg.getBaseGraph()
-----
-
-The above code specifies the creation of a `TinkerGraph` with the use of `IdentityStrategy`.  Note that the `strategy` method returns a `StrategyGraph`, which implements the `Graph` interface. It can be used in the same manner as `TinkerGraph` or any other implementation.  At any point, the `GraphStrategy` can be bypassed by getting the underlying `TinkerGraph`.
-
-IdStrategy
-~~~~~~~~~~
-
-`IdStrategy` which affords complete control over element identifiers. Some `Graph` implementations, such as `TinkerGraph`, allow specification of custom identifiers when creating elements:
-
-[gremlin-groovy]
-----
-g = TinkerGraph.open()
-v = g.addVertex(id,"42a")
-g.V("42a")
-----
-
-Other `Graph` implementations, however, generate element identifiers automatically and cannot be assigned:
-
-[source,groovy]
-gremlin> g = Neo4jGraph.open('/tmp/neo4j')
-==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]
-gremlin> v = g.addVertex(id, "42a")
-Vertex does not support user supplied identifiers
-Display stack trace? [yN]
-
-Given the nature of identifier assignment, this means that identifiers are generally not conserved when moving data between graph instances and implementations, to XML and back again, etc. So for applications which need it, there is `IdStrategy`. Using vertex and edge indices under the hood, `IdStrategy` enables custom identifiers irrespective of whether or not the underlying `Graph` implementation allows them.
-
-[source,groovy]
-gremlin> g = Neo4jGraph.open('/tmp/neo4j')
-==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]
-gremlin> sg = g.strategy(IdStrategy.build("idKey").create())
-==>idstrategy[neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]]
-gremlin> sg.addVertex(id, "42a").id()
-==>42a
-gremlin> sg.addVertex().id()
-==>527d44d2-9a3a-4c15-89b6-021e3d613884
-
-When a non-null identifier is passed to `IdGraph.addVertex` or `IdGraph.addEdge`, that value will be used to uniquely identify the element. When the `id` is not provided, `IdGraph` will generate an identifier on its own.
-
-IMPORTANT: The key that is used to store the assigned identifier should be indexed in the underlying graph database.  If it is not indexed, then lookups for the elements that use these identifiers will perform a linear scan.
-
-PartitionStrategy
-~~~~~~~~~~~~~~~~~
-
-`PartitionStrategy` is a `SubgraphStrategy` which creates logical subgraphs through the use of designated properties.  When each element is written to the `Graph`, it is marked with a property value indicating the current write-partition.  As elements are read from the graph, they are matched against the current set of read-partitions.  The read-partitions thereby define the union of a set of vertices and edges. For example:
-
-[gremlin-groovy]
-----
-g = TinkerGraph.open()
-strategy = PartitionStrategy.build().partitionKey("com.example.partition").startPartition("A").create()
-sg = g.strategy(strategy)
-
-// Add vertices and edges first in one partition, then another:
-
-v1 = sg.addVertex("name", "one")
-v2 = sg.addVertex("name", "two")
-v1.addEdge("knows", v2)
-strategy.setWritePartition("B")
-v3 = sg.addVertex("name", "three")
-v1.addEdge("knows", v3)
-
-// Define sets of partitions which provide access to different subgraphs, or slices of the data:
-
-"in A: " + sg.V().count().next() + ", " + sg.E().count().next()
-strategy.addReadPartition("B")
-"in A+B: " + sg.V().count().next() + ", " + sg.E().count().next()
-strategy.clearReadPartitions()
-strategy.addReadPartition("B")
-"in B: " + sg.V().count().next() + ", " + sg.E().count().next()
-----
-
-Note that there are no edges in the set B, as the only edge added to partition B is incident on a vertex of A.
-
-ReadOnlyStrategy
-~~~~~~~~~~~~~~~~
-
-`ReadOnlyStrategy` prevents write operations that would otherwise mutate the `Graph`.
-
-[source,groovy]
-gremlin> g = TinkerGraph.open()
-==>tinkergraph[vertices:0 edges:0]
-gremlin> sg = g.strategy(ReadOnlyStrategy.instance())
-==>readonlystrategy[tinkergraph[vertices:0 edges:0]]
-gremlin> sg.addVertex("name","stephen")
-Graph uses class org.apache.tinkerpop.gremlin.structure.strategy.ReadOnlyStrategy and is therefore unmodifiable
-Display stack trace? [yN]
-
-SequenceStrategy
-~~~~~~~~~~~~~~~~
-
-`SequenceStrategy` provides a way to string together a set of `GraphStrategy` implementations, such that they are executed in order from first to last.  The `Graph.strategy()` method provides a straightforward way to invisibly use `SequenceStrategy`:
-
-[gremlin-groovy]
-----
-sg = g.strategy(ReadOnlyStrategy.instance(), PartitionStrategy.build().partitionKey('com.example.partition').startPartition('A').create())
-----
-
-The above code demonstrates a `Graph` that uses a `SequenceStrategy` composed of `ReadOnlyStrategy` and `PartitionStrategy`.  When the `SequenceStrategy` is invoked, it will first apply the `ReadOnlyStrategy` and then apply the `PartitionStrategy`.  It is important to consider the ordering of the `GraphStrategy` objects when choosing to use `SequenceStrategy` as it makes no attempts to determine if strategies will be in conflict with one another.  Be aware of the nature of the strategies and ensure that applying them in the order assigned will produce the desirable outcome.
-
-SubgraphStrategy
-~~~~~~~~~~~~~~~~
-
-A general-purpose `SubgraphStrategy` is created by defining a "vertex criterion" and an "edge criterion" as Java 8 `Predicates` and applying them to a `Graph`.  All vertices present in the base `Graph` which pass the vertex criterion will be present in the `StrategyGraph`.  All edges present in the base `Graph` which pass the edge criterion *and* whose in- and out-vertices both pass the vertex criterion will be present in the `StrategyGraph`.
-
-NOTE: edges are either entirely visible, or entirely invisible to a subgraph.  You will never find an edge which cannot be traversed due to a missing in- or out-vertex.
-
-For example, in Gremlin-Java:
-
-[source,java]
-----
-Graph g = TinkerFactory.createModern();
-
-Predicate<Vertex> vertexCriterion = vertex -> true;
-Predicate<Edge> edgeCriterion = edge -> (int) edge.id() >= 8 && (int) edge.id() <= 10;
-
-GraphStrategy strategy = SubgraphStrategy.build().vertexPredicate(vertexCriterion).edgePredicate(edgeCriterion).create();
-StrategyGraph sg = g.strategy(strategy);
-
-// all vertices are here
-System.out.println("" + sg.V().count().next() + " of " + g.V().count().next() + " vertices");
-
-// only the given edges are included
-System.out.println("" + sg.E().count().next() + " of " + g.E().count().next() + " edges");
-----
-
-The same example is presented below but using Gremlin-Groovy.
-
-[source,groovy]
-----
-g = TinkerFactory.createModern()
-
-vertexCriterion = { true }
-edgeCriterion = { it.id() >= 8 && it.id() <= 10 }
-
-strategy = SubgraphStrategy.build().vertexPredicate(vertexCriterion).edgePredicate(edgeCriterion).create()
-sg = g.strategy(strategy)
-
-// all vertices are here
-sg.V().count().next() + " of " + g.V().count().next() + " vertices"
-
-// only the given edges are included
-sg.E().count().next() + " of " + g.E().count().next() + " edges"
-----
-
 Namespace Conventions
 ---------------------
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b4e342d6/docs/src/the-graphcomputer.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/the-graphcomputer.asciidoc b/docs/src/the-graphcomputer.asciidoc
index 14f4466..a7ad962 100644
--- a/docs/src/the-graphcomputer.asciidoc
+++ b/docs/src/the-graphcomputer.asciidoc
@@ -39,12 +39,12 @@ image::graphcomputer.png[width=500]
 
 The example below demonstrates how to submit a VertexProgram to a graph's GraphComputer. `GraphComputer.submit()` yields a `Future<ComputerResult>`. The `ComputerResult` has the resultant computed graph which can be a full copy of the original graph (see <<hadoop-gremlin,Hadoop-Gremlin>>) or a view over the original graph (see <<tinkergraph,TinkerGraph>>). The ComputerResult also provides access to computational side-effects called `Memory` (which includes, for example, runtime, number of iterations, results of MapReduce jobs, and VertexProgram-specific memory manipulations).
 
-[gremlin-groovy]
+[gremlin-groovy,modern]
 ----
-g = TinkerFactory.createModern()
-result = g.compute().program(PageRankVertexProgram.build().create()).submit().get()
-result.graph().V().valueMap('name',PageRankVertexProgram.PAGE_RANK)
+result = graph.compute().program(PageRankVertexProgram.build().create()).submit().get()
 result.memory().runtime
+g = result.graph().traversal(standard)
+g.V().valueMap('name',PageRankVertexProgram.PAGE_RANK)
 ----
 
 NOTE: This model of "vertex-centric graph computing" was made popular by Google's link:http://googleresearch.blogspot.com/2009/06/large-scale-graph-computing-at-google.html[Pregel] graph engine. In the open source world, this model is found in OLAP graph computing systems such as link:https://giraph.apache.org/[Giraph], link:https://hama.apache.org/[Hama], and link:http://faunus.thinkaurelius.com[Faunus]. TinkerPop3 extends the popularized model with integrated post-processing <<mapreduce,MapReduce>> jobs over the vertex set.
@@ -77,20 +77,20 @@ The `MapReduce` extension to GraphComputer is made explicit when examining the <
 
 [gremlin-groovy,modern]
 ----
-g = TinkerFactory.createModern()
-result = g.compute().program(PeerPressureVertexProgram.build().create()).mapReduce(ClusterPopulationMapReduce.build().create()).submit().get()
+graph = TinkerFactory.createModern()
+result = graph.compute().program(PeerPressureVertexProgram.build().create()).mapReduce(ClusterPopulationMapReduce.build().create()).submit().get()
 result.memory().get('clusterPopulation')
-result.graph().V().values(PeerPressureVertexProgram.CLUSTER).groupCount().next()
-result.graph().V().valueMap()
-result.graph().V().valueMap(true,PeerPressureVertexProgram.CLUSTER)
+g = result.graph().traversal(standard)
+g.V().values(PeerPressureVertexProgram.CLUSTER).groupCount().next()
+g.V().valueMap()
+g.V().valueMap(true,PeerPressureVertexProgram.CLUSTER)
 ----
 
 If there are numerous statistics desired, then its possible to register as many MapReduce jobs as needed. For instance, the `ClusterCountMapReduce` determines how many unique clusters were created by the peer pressure algorithm. Below both `ClusterCountMapReduce` and `ClusterPopulationMapReduce` are computed over the resultant graph.
 
-[gremlin-groovy]
+[gremlin-groovy,modern]
 ----
-g = TinkerFactory.createModern()
-result = g.compute().program(PeerPressureVertexProgram.build().create()).
+result = graph.compute().program(PeerPressureVertexProgram.build().create()).
            mapReduce(ClusterPopulationMapReduce.build().create()).
            mapReduce(ClusterCountMapReduce.build().create()).submit().get()
 result.memory().clusterPopulation
@@ -118,11 +118,12 @@ image:lambda-vertex-program.png[width=200,float=left] `LambdaVertexProgram` is t
 
 [gremlin-groovy,modern]
 ----
-result = g.compute().program(LambdaVertexProgram.build().
+result = graph.compute().program(LambdaVertexProgram.build().
            execute("a.property(single, 'counter', c.isInitialIteration() ? 0 : ++a.value('counter'))").
            terminate('a.iteration > 9').
            elementComputeKeys('counter').create()).submit().get()
-result.graph().V().values('counter')
+g = result.graph().traversal(standard)
+g.V().values('counter')
 ----
 
 NOTE: If a single string is provided to the LambdaVertexProgram's builder methods, then it is assumed to be a Gremlin-Groovy script. It is possible to use other Gremlin `ScriptEngine` implementations (e.g. Gremlin-Scala, Gremlin-JavaScript, etc.) by ensuring 1.) the script engine is registered in the `META-INF/services` of the application and 2.) it is declared as such `build().execute('gremlin-scala','a.property(single, …')`.
@@ -130,11 +131,12 @@ NOTE: If a single string is provided to the LambdaVertexProgram's builder method
 The same example is presented below in Java8 using native lambda syntax.
 
 [source,java]
-ComputerResult results = g.compute().program(LambdaVertexProgram.build().
+ComputerResult result = graph.compute().program(LambdaVertexProgram.build().
                         execute((vertex, messenger, memory) -> vertex.<Integer>property(single, "counter", memory.isInitialIteration() ? 0 : vertex.<Integer>value("counter") + 1)).
                         terminate(memory -> memory.getIteration() > 9).
                         elementComputeKeys("counter").create()).submit().get();
-results.graph().V().values("counter").forEach(System.out::println);
+GraphTraversalContext g = result.graph().traversal(standard);
+g.V().values("counter").forEach(System.out::println);
 // 10
 // 10
 // 10
@@ -148,7 +150,7 @@ Finally, there also exists `LambdaMapReduce` to compliment `LambdaVertexProgram`
 
 [gremlin-groovy,modern]
 ----
-result = g.compute().
+result = graph.compute().
            program(LambdaVertexProgram.build().
                execute("a.property(single, 'counter', c.isInitialIteration() ? 0 : ++a.value('counter'))").
                terminate('a.iteration > 9').
@@ -302,11 +304,11 @@ image:traversal-vertex-program.png[width=250,float=left] The `TraversalVertexPro
 
 NOTE: This model of graph traversal in a BSP system was first implemented by the link:http://faunus.thinkaurelius.com[Faunus] graph analytics engine and originally described in link:http://markorodriguez.com/2011/04/19/local-and-distributed-traversal-engines/[Local and Distributed Traversal Engines].
 
-[gremlin-groovy]
+[gremlin-groovy,modern]
 ----
-g = TinkerFactory.createModern()
+g = graph.traversal(standard)
 g.V().both().hasLabel('person').values('age').groupCount().next() // OLTP
-g.engine(computer)
+g = graph.traversal(computer)
 g.V().both().hasLabel('person').values('age').groupCount().next() // OLAP
 ----
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b4e342d6/docs/src/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/the-traversal.asciidoc b/docs/src/the-traversal.asciidoc
index d7da760..c2857b0 100644
--- a/docs/src/the-traversal.asciidoc
+++ b/docs/src/the-traversal.asciidoc
@@ -631,7 +631,8 @@ MatchStep brings functionality similar to link:http://en.wikipedia.org/wiki/SPAR
 
 [gremlin-groovy]
 ----
-g.io().readGraphML('data/grateful-dead.xml')
+graph.io().readGraphML('data/grateful-dead.xml')
+g = graph.traversal(standard)
 g.V().match('a',
         __.as('a').has('name', 'Garcia'),
         __.as('a').in('writtenBy').as('b'),
@@ -1177,7 +1178,8 @@ Extracting a portion of a graph from a larger one for analysis, visualization or
 
 [gremlin-groovy,modern]
 ----
-sg = g.E().hasLabel('knows').subgraph('sg').cap('sg').next() <1>
+subGraph = g.E().hasLabel('knows').subgraph('subGraph').cap('subGraph').next() <1>
+sg = subGraph.traversal(standard)
 sg.E() <2>
 ----
 
@@ -1188,7 +1190,8 @@ A more common subgraphing use case is to get all of the graph structure surround
 
 [gremlin-groovy,modern]
 ----
-sg = g.V(3).repeat(__.inE().subgraph('sg').outV()).times(3).cap('sg').next()  <1>
+subGraph = g.V(3).repeat(__.inE().subgraph('subGraph').outV()).times(3).cap('subGraph').next()  <1>
+sg = subGraph.traversal(standard)
 sg.E()
 ----
 
@@ -1200,8 +1203,8 @@ There can be multiple `subgraph()` calls within the same traversal. Each operati
 ----
 t = g.V().outE('knows').subgraph('knowsG').inV().outE('created').subgraph('createdG').
           inV().inE('created').subgraph('createdG').iterate()
-t.sideEffects.get('knowsG').E()
-t.sideEffects.get('createdG').E()
+t.sideEffects.get('knowsG').traversal(standard).E()
+t.sideEffects.get('createdG').traversal(standard).E()
 ----
 
 IMPORTANT: The `subgraph()`-step only writes to graphs that support user supplied ids for its elements. Moreover, if no graph is specified via `withSideEffect()`, then <<tinkergraph-gremlin,TinkerGraph>> is assumed.
@@ -1415,7 +1418,7 @@ In many situations where a lambda could be used, either a corresponding step exi
 ----
 g.V().out().out().path().by {it.value('name')}.
                          by {it.value('name')}.
-                         by {it.in('created').values('name').fold().next()} <1>
+                         by {g.V(it).in('created').values('name').fold().next()} <1>
 g.V().out().out().path().by('name').
                          by('name').
                          by(__.in('created').values('name').fold()) <2>
@@ -1580,13 +1583,13 @@ image:gremlin-quill.png[width=200,float=right] The super interface of GraphTrave
  }
 ----
 
-This traversal definition can now be used as follows.
-
-[gremlin-groovy,modern]
-----
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory.SocialTraversal
-g.of(SocialTraversal).people("marko").knows().name()
-----
-
-By extending `Traversal`, users can create a DSL that is respective of the semantics of their data. Instead of querying in terms of vertices/edges/properties, they can query in terms of, for example, people, their friends, and their names.
+//This traversal definition can now be used as follows.
+//
+//[gremlin-groovy,modern]
+//----
+////import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory.SocialTraversal
+////g.of(SocialTraversal).people("marko").knows().name()
+//----
+//
+//By extending `Traversal`, users can create a DSL that is respective of the semantics of their data. Instead of querying in terms of vertices/edges/properties, they can query in terms of, for example, people, their friends, and their names.