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 2020/04/23 17:41:47 UTC
[tinkerpop] 01/04: TINKERPOP-2354 Improve documentation around "g"
creation CTR
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit d62edb05e37117034a1d2e1841433d4d02ab0537
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu Apr 23 13:38:43 2020 -0400
TINKERPOP-2354 Improve documentation around "g" creation CTR
---
docs/src/reference/intro.asciidoc | 2 +-
docs/src/tutorials/getting-started/index.asciidoc | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/docs/src/reference/intro.asciidoc b/docs/src/reference/intro.asciidoc
index b2474c1..1d0c19c 100644
--- a/docs/src/reference/intro.asciidoc
+++ b/docs/src/reference/intro.asciidoc
@@ -163,7 +163,7 @@ gremlin> g.V().has('name','marko').out('knows').values('name') // <3>
----
<1> Open the toy graph and reference it by the variable `graph`.
-<2> Create a graph traversal source from the graph using the standard, OLTP traversal engine.
+<2> Create a graph traversal source from the graph using the standard, OLTP traversal engine. This object should be created once and then re-used.
<3> Spawn a traversal off the traversal source that determines the names of the people that the marko-vertex knows.
.The Name of The People That Marko Knows
diff --git a/docs/src/tutorials/getting-started/index.asciidoc b/docs/src/tutorials/getting-started/index.asciidoc
index 16377d6..66697da 100644
--- a/docs/src/tutorials/getting-started/index.asciidoc
+++ b/docs/src/tutorials/getting-started/index.asciidoc
@@ -145,6 +145,8 @@ g.V(1).out('knows').has('age', gt(30)).values('name') <7>
(similar to `inE().outV()` and `in()` for incoming edges).
<7> Get the names of the people vertex "1" knows who are over the age of 30.
+TIP: The variable `g`, the `TraversalSource`, only needs to be instantiated once and should then be re-used.
+
IMPORTANT: A `Traversal` is essentially an `Iterator` so if you have code like `x = g.V()`, the `x` does not contain
the results of the `g.V()` query. Rather, that statement assigns an `Iterator` value to `x`. To get your results,
you would then need to iterate through `x`. This understanding is *important* because in the context of the console