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/06/18 15:22:23 UTC
[09/50] tinkerpop git commit: Removed references to Structure API
from "user docs"
Removed references to Structure API from "user docs"
Restricted such references to Provider documentation CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6feff186
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6feff186
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6feff186
Branch: refs/heads/TINKERPOP-1643
Commit: 6feff186984c6b1d71ba9dc6c9ace5e59e2d09e4
Parents: 9830a3f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue May 29 12:50:59 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue May 29 12:50:59 2018 -0400
----------------------------------------------------------------------
docs/src/dev/provider/index.asciidoc | 80 ++++++++++
.../src/reference/gremlin-applications.asciidoc | 5 +-
.../reference/implementations-neo4j.asciidoc | 10 +-
docs/src/reference/intro.asciidoc | 148 ++-----------------
docs/src/reference/the-graph.asciidoc | 40 ++---
.../tutorials/getting-started/index.asciidoc | 27 ++--
6 files changed, 140 insertions(+), 170 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6feff186/docs/src/dev/provider/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/provider/index.asciidoc b/docs/src/dev/provider/index.asciidoc
index 5bc4d9e..dddcb18 100644
--- a/docs/src/dev/provider/index.asciidoc
+++ b/docs/src/dev/provider/index.asciidoc
@@ -46,6 +46,86 @@ provided by TinkerPop (e.g. Gremlin Console, Gremlin Server, etc.) and 3rd-party
Gremlin-JS, etc.) will integrate properly. Finally, please feel free to use the logo on the left to promote your
TinkerPop3 implementation.
+[[graph-structure-api]]
+=== Graph Structure API
+
+The graph structure API of TinkerPop3 provides the interfaces necessary to create a TinkerPop enabled system and
+exposes the basic components of a property graph to include `Graph`, `Vertex`, `Edge`, `VertexProperty` and `Property`.
+The structure API can be used directly as follows:
+
+[source,java]
+Graph graph = TinkerGraph.open(); <1>
+Vertex marko = graph.addVertex(T.label, "person", T.id, 1, "name", "marko", "age", 29); <2>
+Vertex vadas = graph.addVertex(T.label, "person", T.id, 2, "name", "vadas", "age", 27);
+Vertex lop = graph.addVertex(T.label, "software", T.id, 3, "name", "lop", "lang", "java");
+Vertex josh = graph.addVertex(T.label, "person", T.id, 4, "name", "josh", "age", 32);
+Vertex ripple = graph.addVertex(T.label, "software", T.id, 5, "name", "ripple", "lang", "java");
+Vertex peter = graph.addVertex(T.label, "person", T.id, 6, "name", "peter", "age", 35);
+marko.addEdge("knows", vadas, T.id, 7, "weight", 0.5f); <3>
+marko.addEdge("knows", josh, T.id, 8, "weight", 1.0f);
+marko.addEdge("created", lop, T.id, 9, "weight", 0.4f);
+josh.addEdge("created", ripple, T.id, 10, "weight", 1.0f);
+josh.addEdge("created", lop, T.id, 11, "weight", 0.4f);
+peter.addEdge("created", lop, T.id, 12, "weight", 0.2f);
+
+<1> Create a new in-memory `TinkerGraph` and assign it to the variable `graph`.
+<2> Create a vertex along with a set of key/value pairs with `T.label` being the vertex label and `T.id` being the vertex id.
+<3> Create an edge along with a set of key/value pairs with the edge label being specified as the first argument.
+
+In the above code all the vertices are created first and then their respective edges. There are two "accessor tokens":
+`T.id` and `T.label`. When any of these, along with a set of other key value pairs is provided to
+`Graph.addVertex(Object...)` or `Vertex.addEdge(String,Vertex,Object...)`, the respective element is created along
+with the provided key/value pair properties appended to it.
+
+Below is a sequence of basic graph mutation operations represented in Java 8. One of the major differences between
+TinkerPop2 and TinkerPop3 is that in TinkerPop3, the Java convention of using setters and getters has been abandoned
+in favor of a syntax that is more aligned with the syntax of Gremlin-Groovy in TinkerPop2. Given that Gremlin-Java8
+and Gremlin-Groovy are nearly identical due to the inclusion of Java 8 lambdas, a big effort was made to ensure that
+both languages are as similar as possible.
+
+image:basic-mutation.png[width=240,float=right]
+[source,java]
+----
+// create a new graph
+Graph graph = TinkerGraph.open();
+// add a software vertex with a name property
+Vertex gremlin = graph.addVertex(T.label, "software",
+ "name", "gremlin"); <1>
+// only one vertex should exist
+assert(IteratorUtils.count(graph.vertices()) == 1)
+// no edges should exist as none have been created
+assert(IteratorUtils.count(graph.edges()) == 0)
+// add a new property
+gremlin.property("created",2009) <2>
+// add a new software vertex to the graph
+Vertex blueprints = graph.addVertex(T.label, "software",
+ "name", "blueprints"); <3>
+// connect gremlin to blueprints via a dependsOn-edge
+gremlin.addEdge("dependsOn",blueprints); <4>
+// now there are two vertices and one edge
+assert(IteratorUtils.count(graph.vertices()) == 2)
+assert(IteratorUtils.count(graph.edges()) == 1)
+// add a property to blueprints
+blueprints.property("created",2010) <5>
+// remove that property
+blueprints.property("created").remove() <6>
+// connect gremlin to blueprints via encapsulates
+gremlin.addEdge("encapsulates",blueprints) <7>
+assert(IteratorUtils.count(graph.vertices()) == 2)
+assert(IteratorUtils.count(graph.edges()) == 2)
+// removing a vertex removes all its incident edges as well
+blueprints.remove() <8>
+gremlin.remove() <9>
+// the graph is now empty
+assert(IteratorUtils.count(graph.vertices()) == 0)
+assert(IteratorUtils.count(graph.edges()) == 0)
+// tada!
+----
+
+The above code samples are just examples of how the structure API can be used to access a graph. Those APIs are then
+used internally by the process API (i.e. Gremlin) to access any graph that implements those structure API interfaces
+to execute queries. Typically, the structure API methods are not used directly by end-users.
+
=== Implementing Gremlin-Core
The classes that a graph system provider should focus on implementing are itemized below. It is a good idea to study
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6feff186/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index 1a68ad8..522bcfd 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -506,8 +506,9 @@ as "objects":
m = result[0].object <4>
m.sort {it.value}
script = """
- matthias = graph.addVertex('name','matthias')
- matthias.addEdge('co-creator',g.V().has('name','marko').next())
+ g.addV('person',).property('name','matthias').as('matthias').
+ V().has('person','name','marko').as('marko').
+ addE('co-creator').from('matthias').to('marko')
"""
:> @script <5>
:> g.V().has('name','matthias').out('co-creator').values('name')
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6feff186/docs/src/reference/implementations-neo4j.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/implementations-neo4j.asciidoc b/docs/src/reference/implementations-neo4j.asciidoc
index be7371f..1f4cc6b 100644
--- a/docs/src/reference/implementations-neo4j.asciidoc
+++ b/docs/src/reference/implementations-neo4j.asciidoc
@@ -75,11 +75,11 @@ The Gremlin-Console session below demonstrates Neo4j indices. For more informati
[gremlin-groovy]
----
graph = Neo4jGraph.open('/tmp/neo4j')
+g = graph.traversal()
graph.cypher("CREATE INDEX ON :person(name)")
graph.tx().commit() <1>
-graph.addVertex(label,'person','name','marko')
-graph.addVertex(label,'dog','name','puppy')
-g = graph.traversal()
+g.addV('person').property('name','marko')
+g.addV('dog').property('name','puppy')
g.V().hasLabel('person').has('name','marko').values('name')
graph.close()
----
@@ -190,7 +190,8 @@ An example use case is presented below.
[gremlin-groovy]
----
graph = Neo4jGraph.open('/tmp/neo4j')
-vertex = (Neo4jVertex) graph.addVertex('human::animal') <1>
+g = graph.traversal()
+vertex = (Neo4jVertex) g.addV('human::animal').next() <1>
vertex.label() <2>
vertex.labels() <3>
vertex.addLabel('organism') <4>
@@ -201,7 +202,6 @@ vertex.addLabel('organism') <6>
vertex.labels()
vertex.removeLabel('human') <7>
vertex.label()
-g = graph.traversal()
g.V().has(label,'organism') <8>
g.V().has(label,of('organism')) <9>
g.V().has(label,of('organism')).has(label,of('animal'))
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6feff186/docs/src/reference/intro.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/intro.asciidoc b/docs/src/reference/intro.asciidoc
index 0f226ec..890034d 100644
--- a/docs/src/reference/intro.asciidoc
+++ b/docs/src/reference/intro.asciidoc
@@ -31,14 +31,17 @@ dots) and edges (arcs, lines). When modeling a graph in a computer and applying
the generic mathematically-oriented, binary graph is extended to support both labels and key/value properties. This
structure is known as a property graph. More formally, it is a directed, binary, attributed multi-graph. An example
property graph is diagrammed below. This graph example will be used extensively throughout the documentation and is
-called "TinkerPop Classic" as it is the original demo graph distributed with TinkerPop0 back in 2009 (i.e. the good
-ol' days -- it was the best of times and it was the worst of times).
+called "TinkerPop Modern" as it is a modern variation of the original demo graph distributed with TinkerPop0 back
+in 2009 (i.e. the good ol' days -- it was the best of times and it was the worst of times).
TIP: The TinkerPop graph is available with <<tinkergraph-gremlin,TinkerGraph>> via `TinkerFactory.createModern()`.
TinkerGraph is the reference implementation of TinkerPop3 and is used in nearly all the examples in this documentation.
Note that there also exists the classic `TinkerFactory.createClassic()` which is the graph used in TinkerPop2 and does
not include vertex labels.
+TIP: All of the toy graphs available in TinkerPop are described in
+link:http://tinkerpop.apache.org/docs/x.y.z/tutorials/the-gremlin-console/#toy-graphs[The Gremlin Console] tutorial.
+
[[tinkerpop-modern]]
.TinkerPop Modern
image::tinkerpop-modern.png[width=500]
@@ -49,6 +52,12 @@ data model defined by a vertex/edge/property link:http://en.wikipedia.org/wiki/N
of the graph is the means by which the structure is analyzed. The typical form of graph processing is called a
link:http://en.wikipedia.org/wiki/Graph_traversal[traversal].
+Generally speaking, the structure or "graph" API is meant for link:http://tinkerpop.apache.org/providers.html[graph providers]
+who are implementing the TinkerPop interfaces and the process or "traversal" API (i.e. Gremlin) is meant for end-users
+who are utilizing a graph system from a graph provider. While the components of the process API are itemized below,
+they are described in greater detail in the link:http://tinkerpop.apache.org/docs/x.y.z/tutorials/gremlins-anatomy/[Gremlin's Anatomy]
+tutorial.
+
.Primary components of the TinkerPop3 *structure* API
* `Graph`: maintains a set of vertices and edges, and access to database functions such as transactions.
* `Element`: maintains a collection of properties and a string label denoting the element type.
@@ -88,136 +97,11 @@ providers, then the standard Java naming convention is followed (e.g. `getNextSt
image:gremlin-standing.png[width=125,float=left] A graph's structure is the topology formed by the explicit references
between its vertices, edges, and properties. A vertex has incident edges. A vertex is adjacent to another vertex if
they share an incident edge. A property is attached to an element and an element has a set of properties. A property
-is a key/value pair, where the key is always a character `String`. The graph structure API of TinkerPop3 provides the
-methods necessary to create such a structure. The TinkerPop graph previously diagrammed can be created with the
-following Java 8 code. Note that this graph is available as an in-memory TinkerGraph using
-`TinkerFactory.createClassic()`.
-
-[source,java]
-Graph graph = TinkerGraph.open(); <1>
-Vertex marko = graph.addVertex(T.label, "person", T.id, 1, "name", "marko", "age", 29); <2>
-Vertex vadas = graph.addVertex(T.label, "person", T.id, 2, "name", "vadas", "age", 27);
-Vertex lop = graph.addVertex(T.label, "software", T.id, 3, "name", "lop", "lang", "java");
-Vertex josh = graph.addVertex(T.label, "person", T.id, 4, "name", "josh", "age", 32);
-Vertex ripple = graph.addVertex(T.label, "software", T.id, 5, "name", "ripple", "lang", "java");
-Vertex peter = graph.addVertex(T.label, "person", T.id, 6, "name", "peter", "age", 35);
-marko.addEdge("knows", vadas, T.id, 7, "weight", 0.5f); <3>
-marko.addEdge("knows", josh, T.id, 8, "weight", 1.0f);
-marko.addEdge("created", lop, T.id, 9, "weight", 0.4f);
-josh.addEdge("created", ripple, T.id, 10, "weight", 1.0f);
-josh.addEdge("created", lop, T.id, 11, "weight", 0.4f);
-peter.addEdge("created", lop, T.id, 12, "weight", 0.2f);
-
-<1> Create a new in-memory `TinkerGraph` and assign it to the variable `graph`.
-<2> Create a vertex along with a set of key/value pairs with `T.label` being the vertex label and `T.id` being the vertex id.
-<3> Create an edge along with a set of key/value pairs with the edge label being specified as the first argument.
-
-In the above code all the vertices are created first and then their respective edges. There are two "accessor tokens":
-`T.id` and `T.label`. When any of these, along with a set of other key value pairs is provided to
-`Graph.addVertex(Object...)` or `Vertex.addEdge(String,Vertex,Object...)`, the respective element is created along
-with the provided key/value pair properties appended to it.
-
-WARNING: Many graph systems do not allow the user to specify an element ID and in such cases, an exception is thrown.
-
-NOTE: In TinkerPop3, vertices are allowed a single immutable string label (similar to an edge label). This
-functionality did not exist in TinkerPop2. Element ids are still immutable in TinkerPop3 as they were in TinkerPop2.
-
-=== Mutating the Graph
-
-Below is a sequence of basic graph mutation operations represented in Java 8. One of the major differences between
-TinkerPop2 and TinkerPop3 is that in TinkerPop3, the Java convention of using setters and getters has been abandoned
-in favor of a syntax that is more aligned with the syntax of Gremlin-Groovy in TinkerPop2. Given that Gremlin-Java8
-and Gremlin-Groovy are nearly identical due to the inclusion of Java 8 lambdas, a big effort was made to ensure that
-both languages are as similar as possible.
-
-WARNING: In the code examples presented throughout this documentation, either Gremlin-Java8 or Gremlin-Groovy is used.
-It is possible to determine which derivative of Gremlin is being used by mousing over the code block. The word "JAVA"
-or "GROOVY" will appear in the top right corner of the code block.
-
-image:basic-mutation.png[width=240,float=right]
-[source,java]
-// create a new graph
-Graph graph = TinkerGraph.open();
-// add a software vertex with a name property
-Vertex gremlin = graph.addVertex(T.label, "software",
- "name", "gremlin"); <1>
-// only one vertex should exist
-assert(IteratorUtils.count(graph.vertices()) == 1)
-// no edges should exist as none have been created
-assert(IteratorUtils.count(graph.edges()) == 0)
-// add a new property
-gremlin.property("created",2009) <2>
-// add a new software vertex to the graph
-Vertex blueprints = graph.addVertex(T.label, "software",
- "name", "blueprints"); <3>
-// connect gremlin to blueprints via a dependsOn-edge
-gremlin.addEdge("dependsOn",blueprints); <4>
-// now there are two vertices and one edge
-assert(IteratorUtils.count(graph.vertices()) == 2)
-assert(IteratorUtils.count(graph.edges()) == 1)
-// add a property to blueprints
-blueprints.property("created",2010) <5>
-// remove that property
-blueprints.property("created").remove() <6>
-// connect gremlin to blueprints via encapsulates
-gremlin.addEdge("encapsulates",blueprints) <7>
-assert(IteratorUtils.count(graph.vertices()) == 2)
-assert(IteratorUtils.count(graph.edges()) == 2)
-// removing a vertex removes all its incident edges as well
-blueprints.remove() <8>
-gremlin.remove() <9>
-// the graph is now empty
-assert(IteratorUtils.count(graph.vertices()) == 0)
-assert(IteratorUtils.count(graph.edges()) == 0)
-// tada!
-
-IMPORTANT: image:groovy-logo.png[width=175,float=left] Gremlin-Groovy leverages the
-link:http://www.groovy-lang.org/[Groovy 2.x language] to express Gremlin traversals. One of the major benefits of
-Groovy is the inclusion of a runtime console that makes it easy for developers to practice with the Gremlin language
-and for production users to connect to their graph and execute traversals in an interactive manner. Moreover,
-Gremlin-Groovy provides various syntax simplifications.
-
-TIP: image:gremlin-sugar.png[width=100,float=left] For those wishing to use the Gremlin2 syntax, please see
-<<sugar-plugin,SugarPlugin>>. This plugin provides syntactic sugar at, typically, a runtime cost. It can be loaded
-programmatically via `SugarLoader.load()`. Once loaded, it is possible to do `g.V.out.name` instead of
-`g.V().out().values('name')` as well as a host of other conveniences.
-
-Here is the same code, but using Gremlin-Groovy in the <<gremlin-console,Gremlin Console>>.
-
-[source,groovy]
-----
-$ bin/gremlin.sh
-
- \,,,/
- (o o)
------oOOo-(3)-oOOo-----
-gremlin> graph = TinkerGraph.open()
-==>tinkergraph[vertices:0 edges:0]
-gremlin> gremlin = graph.addVertex(label,'software','name','gremlin')
-==>v[0]
-gremlin> gremlin.property('created',2009)
-==>vp[created->2009]
-gremlin> blueprints = graph.addVertex(label,'software','name','blueprints')
-==>v[3]
-gremlin> gremlin.addEdge('dependsOn',blueprints)
-==>e[5][0-dependsOn->3]
-gremlin> blueprints.property('created',2010)
-==>vp[created->2010]
-gremlin> blueprints.property('created').remove()
-==>null <1>
-gremlin> gremlin.addEdge('encapsulates',blueprints)
-==>e[7][0-encapsulates->3]
-gremlin> blueprints.remove()
-==>null
-gremlin> gremlin.remove()
-==>null
-----
-
-<1> A `==>null` output is usually from a `void` method call and simply indicates that there was no problem with the
-invocation. If there were a problem, an error would be output or an exception would be thrown.
-
-IMPORTANT: TinkerGraph is not a transactional graph. For more information on transaction handling (for those graph
-systems that support them) see the section dedicated to <<transactions,transactions>>.
+is a key/value pair, where the key is always a character `String`. Conceptual knowledge of how a graph is composed is
+essential to end-users working with graphs, however, as mentioned earlier, the structure API is not the appropriate
+way for users to think when building applications with TinkerPop. The structure API is reserved for usage by graph
+providers. Those interested in implementing the structure API to make their graph system TinkerPop enabled can learn
+more about it in the link:http://tinkerpop.apache.org/docs/x.y.z/dev/provider/[Graph Provider] documentation.
[[the-graph-process]]
== The Graph Process
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6feff186/docs/src/reference/the-graph.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graph.asciidoc b/docs/src/reference/the-graph.asciidoc
index 1855249..9ac83e4 100644
--- a/docs/src/reference/the-graph.asciidoc
+++ b/docs/src/reference/the-graph.asciidoc
@@ -238,6 +238,8 @@ not support transactions.
----
gremlin> graph = Neo4jGraph.open('/tmp/neo4j')
==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]
+gremlin> g = graph.traversal()
+==>graphtraversalsource[neo4jgraph[community single [/tmp/neo4j]], standard]
gremlin> graph.features()
==>FEATURES
> GraphFeatures
@@ -245,23 +247,23 @@ gremlin> graph.features()
>-- Computer: false
>-- Persistence: true
...
-gremlin> graph.tx().onReadWrite(Transaction.READ_WRITE_BEHAVIOR.AUTO) <2>
+gremlin> g.tx().onReadWrite(Transaction.READ_WRITE_BEHAVIOR.AUTO) <2>
==>org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph$Neo4jTransaction@1c067c0d
-gremlin> graph.addVertex("name","stephen") <3>
+gremlin> g.addV("person").("name","stephen") <3>
==>v[0]
-gremlin> graph.tx().commit() <4>
+gremlin> g.tx().commit() <4>
==>null
-gremlin> graph.tx().onReadWrite(Transaction.READ_WRITE_BEHAVIOR.MANUAL) <5>
+gremlin> g.tx().onReadWrite(Transaction.READ_WRITE_BEHAVIOR.MANUAL) <5>
==>org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph$Neo4jTransaction@1c067c0d
-gremlin> graph.tx().isOpen()
+gremlin> g.tx().isOpen()
==>false
-gremlin> graph.addVertex("name","marko") <6>
+gremlin> g.addV("person").("name","marko") <6>
Open a transaction before attempting to read/write the transaction
-gremlin> graph.tx().open() <7>
+gremlin> g.tx().open() <7>
==>null
-gremlin> graph.addVertex("name","marko") <8>
+gremlin> g.addV("person").("name","marko") <8>
==>v[1]
-gremlin> graph.tx().commit()
+gremlin> g.tx().commit()
==>null
----
@@ -286,14 +288,15 @@ is bound to the current thread of execution. Consider the following example to d
[source,java]
----
-graph.addVertex("name","stephen");
+GraphTraversalSource g = graph.traversal();
+g.addV("person").("name","stephen").iterate();
Thread t1 = new Thread(() -> {
- graph.addVertex("name","josh");
+ g.addV("person").("name","josh").iterate();
});
Thread t2 = new Thread(() -> {
- graph.addVertex("name","marko");
+ g.addV("person").("name","marko").iterate();
});
t1.start()
@@ -302,14 +305,14 @@ t2.start()
t1.join()
t2.join()
-graph.tx().commit();
+g.tx().commit();
----
The above code shows three vertices added to `graph` in three different threads: the current thread, `t1` and
`t2`. One might expect that by the time this body of code finished executing, that there would be three vertices
persisted to the `Graph`. However, given the `ThreadLocal` nature of transactions, there really were three separate
transactions created in that body of code (i.e. one for each thread of execution) and the only one committed was the
-first call to `addVertex` in the primary thread of execution. The other two calls to that method within `t1` and `t2`
+first call to `addV()` in the primary thread of execution. The other two calls to that method within `t1` and `t2`
were never committed and thus orphaned.
A `Graph` that `supportsThreadedTransactions` is one that allows for a `Graph` to operate outside of that constraint,
@@ -319,14 +322,15 @@ different threads operating within the same transaction, the above code could be
[source,java]
----
Graph threaded = graph.tx().createThreadedTx();
-threaded.addVertex("name","stephen");
+GraphTraversalSource g = graph.traversal();
+g.addV("person").("name","stephen").iterate();
Thread t1 = new Thread(() -> {
- threaded.addVertex("name","josh");
+ threaded.addV("person").("name","josh").iterate();
});
Thread t2 = new Thread(() -> {
- threaded.addVertex("name","marko");
+ threaded.addV("person").("name","marko").iterate();
});
t1.start()
@@ -335,7 +339,7 @@ t2.start()
t1.join()
t2.join()
-threaded.tx().commit();
+g.tx().commit();
----
In the above case, the call to `graph.tx().createThreadedTx()` creates a new `Graph` instance that is unbound from the
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6feff186/docs/src/tutorials/getting-started/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/tutorials/getting-started/index.asciidoc b/docs/src/tutorials/getting-started/index.asciidoc
index 4d882ef..11e2533 100644
--- a/docs/src/tutorials/getting-started/index.asciidoc
+++ b/docs/src/tutorials/getting-started/index.asciidoc
@@ -199,24 +199,26 @@ as an example. First, you need to create this graph:
[gremlin-groovy]
----
graph = TinkerGraph.open()
-v1 = graph.addVertex(id, 1, label, "person", "name", "marko", "age", 29)
-v2 = graph.addVertex(id, 3, label, "software", "name", "lop", "lang", "java")
-v1.addEdge("created", v2, id, 9, "weight", 0.4)
+g = graph.traversal()
+g.addV("person").property(id, 1).property("name", "marko").property("age", 29).as('v1').
+ addV("software").property(id, 3).property("name", "lop").property("lang", "java").as('v2').
+ addE("created").property(id, 9).property("weight", 0.4).from('v1').to('v2')
----
-There are a number of important things to consider in the above code. First, recall that `id` and `label` are
-"reserved" for special usage in TinkerPop and are members of the enum, `T`. Those "keys" supplied to the creation
-method are link:https://docs.oracle.com/javase/8/docs/technotes/guides/language/static-import.html[statically imported]
-to the console, which allows you to access them without having to specify their owning enum. Think of it as a
+There are a number of important things to consider in the above code. First, recall that `id` is "reserved" for
+special usage in TinkerPop and is a members of the enum, `T`. The `T` enum has other important structural values like
+`label` as well. Note that the Gremlin Console link:https://docs.oracle.com/javase/8/docs/technotes/guides/language/static-import.html[statically imports]
+the enum values of `T`, which allows you to access them without having to specify their owning enum. Think of it as a
shorthand form that enables a more fluid code style. You would normally refer to them as `T.id` and `T.label`. Without
that static importing you would instead have to write:
[gremlin-groovy]
----
graph = TinkerGraph.open()
-v1 = graph.addVertex(T.id, 1, T.label, "person", "name", "marko", "age", 29)
-v2 = graph.addVertex(T.id, 3, T.label, "software", "name", "lop", "lang", "java")
-v1.addEdge("created", v2, id, 9, "weight", 0.4)
+g = graph.traversal()
+g.addV("person").property(T.id, 1).property("name", "marko").property("age", 29).as('v1').
+ addV("software").property(T.id, 3).property("name", "lop").property("lang", "java").as('v2').
+ addE("created").property(T.id, 9).property("weight", 0.4).from('v1').to('v2')
----
NOTE: The fully qualified name for `T` is `org.apache.tinkerpop.gremlin.structure.T`. Another important static import
@@ -226,9 +228,8 @@ for the creation of link:http://tinkerpop.apache.org/docs/x.y.z/reference/#graph
Second, don't forget that you are working with TinkerGraph which allows for identifier assignment. That is _not_ the
case with most graph databases.
-Finally, the label for an `Edge` is required and is thus part of the method signature of `addEdge()`. It is the first
-parameter supplied, followed by the `Vertex` to which `v1` should be connected. Therefore, this usage of `addEdge` is
-creating an edge that goes _out_ of `v1` and into `v2` with a label of "created".
+Finally, the `as()` steps label the value held at a particular step so that you can reference back to it later in the
+traversal. In this case, that allows you to reference both vertices as "v1" and "v2" during edge creation.
=== Graph Traversal - Staying Simple