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 2016/08/18 23:42:07 UTC

tinkerpop git commit: tweaked the docs on Gremlin-Python and added information to @spmallettes withRemote() section on Bindings.

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1278 9a2d90fcb -> 7cd83bb55


tweaked the docs on Gremlin-Python and added information to @spmallettes withRemote() section on Bindings.


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

Branch: refs/heads/TINKERPOP-1278
Commit: 7cd83bb550186e0dbf07b0961e9ba3e80f12e030
Parents: 9a2d90f
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Aug 18 17:42:04 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Aug 18 17:42:04 2016 -0600

----------------------------------------------------------------------
 .../src/reference/gremlin-applications.asciidoc | 21 +++++++++++++++++++-
 docs/src/reference/gremlin-variants.asciidoc    | 16 +++++++--------
 2 files changed, 28 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7cd83bb5/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index 8fb102d..41a2cdc 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -876,7 +876,6 @@ then re-use it.
 
 [gremlin-groovy]
 ----
-import org.apache.tinkerpop.gremlin.structure.util.empty.*
 cluster = Cluster.open('conf/remote-objects.yaml')
 graph = EmptyGraph.instance()
 g = graph.traversal().withRemote(DriverRemoteConnection.using(cluster, "g"))
@@ -891,6 +890,26 @@ IMPORTANT: `RemoteGraph` uses the `TraversalOpProcessor` in Gremlin Server which
 retrieval of side-effects (if the `Traversal` produces any). That cache can be configured (e.g. controlling eviction
 times and sizing) can be done in the Gremlin Server configuration file as described <<traversalopprocessor, here>>.
 
+Finally, Gremlin `Bytecode` supports the encoding of bindings which allow GremlinServer to cache traversals that will
+be reused over and over again save that some parameterization may change. Thus, instead of translating, compiling, and
+then executing each submitted bytecode, it is possible to simply execute. To express bindings in Gremlin-Java and
+Gremlin-Groovy, use the `withBindings()` traversal source method.
+
+[gremlin-groovy]
+----
+cluster = Cluster.open('conf/remote-objects.yaml')
+b = new Bindings()
+g = EmptyGraph.instance().traversal().withBindings(b).withRemote(DriverRemoteConnection.using(cluster, "g"))
+g.V(b.of('id',1)).out('created').values('name')
+g.V(b.of('id',4)).out('created').values('name')
+g.V(b.of('id',4)).out('created').values('name').getBytecode()
+g.V(b.of('id',4)).out('created').values('name').getBytecode().getBindings()
+cluster.close()
+----
+
+Both traversals are abstractly defined as `g.V(id).out('created').values('name')` and thus, the first submission
+can be cached for faster evaluation on the next submission.
+
 Configuring
 ~~~~~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7cd83bb5/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index cd50088..73541d6 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -169,8 +169,8 @@ That is, without the `__.`-prefix.
 g.V().repeat(out()).times(2).name.fold().toList()
 ----
 
-RemoteConnection Bindings
-~~~~~~~~~~~~~~~~~~~~~~~~~
+Bindings
+~~~~~~~~
 
 When a traversal bytecode is sent over a `RemoteConnection` (e.g. GremlinServer), it will be translated, compiled, and then executed.
 If the same traversal is sent again, translation and compilation can be skipped as the previously compiled version should be cached.
@@ -191,12 +191,12 @@ in statically typed languages where bindings need to have the same typing as the
 The Lambda Solution
 ~~~~~~~~~~~~~~~~~~~
 
-Supporting link:https://en.wikipedia.org/wiki/Anonymous_function[anonymous functions] across languages is extremely difficult.
-In Gremlin-Python, a link:https://docs.python.org/2/reference/expressions.html#lambda[Python lambda]
-should be represented as a zero-arg callable that returns a string representation of a lambda.
-The default lambda language is `gremlin-python` and can be changed via `gremlin_python.statics.default_lambda_language.`
-When the lambda is represented in `Bytecode` its language is encoded such that the remote connection host can infer
-which translator and ultimate execution engine to use.
+Supporting link:https://en.wikipedia.org/wiki/Anonymous_function[anonymous functions] across languages is difficult as
+most language do not support lambda introspection and thus, code analysis. In Gremlin-Python,
+a link:https://docs.python.org/2/reference/expressions.html#lambda[Python lambda] should be represented as a zero-arg callable
+that returns a string representation of a lambda. The default lambda language is `gremlin-python` and can be changed via
+`gremlin_python.statics.default_lambda_language`. When the lambda is represented in `Bytecode` its language is encoded
+such that the remote connection host can infer which translator and ultimate execution engine to use.
 
 [gremlin-python,modern]
 ----