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/15 12:37:49 UTC

[tinkerpop] branch master updated (f3d8939 -> 411dcf0)

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git.


    from f3d8939  Merge branch '3.4-dev'
     new 1871a05  Use UUID in test for session name in javascript CTR
     new b8c750e  Polished up session documentation across GLVs CTR
     new f3d58c3  Merge branch '3.3-dev' into 3.4-dev
     new 411dcf0  Merge branch '3.4-dev'

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGELOG.asciidoc                                    |  3 +--
 docs/src/reference/gremlin-variants.asciidoc          |  9 +++++++++
 docs/src/upgrade/release-3.3.x.asciidoc               | 19 ++++++++++---------
 .../main/javascript/gremlin-javascript/test/helper.js |  4 +++-
 4 files changed, 23 insertions(+), 12 deletions(-)


[tinkerpop] 02/04: Polished up session documentation across GLVs CTR

Posted by sp...@apache.org.
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 b8c750e779f8239bfff11b781b22759763bbc905
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Wed Apr 15 08:25:26 2020 -0400

    Polished up session documentation across GLVs CTR
---
 CHANGELOG.asciidoc                           |  3 +-
 docs/src/reference/gremlin-variants.asciidoc | 56 +++++++++++++++++++++++++---
 docs/src/upgrade/release-3.3.x.asciidoc      | 19 +++++-----
 3 files changed, 61 insertions(+), 17 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ee75805..bb8b274 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -24,7 +24,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 === TinkerPop 3.3.11 (Release Date: NOT OFFICIALLY RELEASED YET)
 
 * Added `trustStoreType` such that keystore and truststore can be of different types in the Java driver.
-* Added session support to gremlin-javascript.
+* Added session support to all GLVs: Javascript, .NET and Python.
 * Fixed bug in Gremlin Server shutdown if failures occurred during `GraphManager` initialization.
 * Modified Gremlin Server to close the session when the channel itself is closed.
 * Fixed bug in `Order` where comparisons of `enum` types wouldn't compare with `String` values.
@@ -33,7 +33,6 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Bumped to Jackson 2.9.10.3.
 * Remove invalid service descriptors from gremlin-shaded.
 * Fixed bug in Python and .NET traversal `clone()` where deep copies of bytecode were not occurring.
-* Added session support to gremlin-python
 
 [[release-3-3-10]]
 === TinkerPop 3.3.10 (Release Date: February 3, 2020)
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index 0aea657..69988bd 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -327,14 +327,34 @@ is detected during deserialization, the `Set` is coerced to a `List` so that tra
 results within a collection across different languages. If a `Set` is needed then convert `List` results
 to `Set` manually.
 
+=== Submit Gremlin Scripts
+
+Additionally, you can also send parametrized Gremlin scripts to the server as strings:
+
+[source,python]
+----
+client = Client('ws://localhost:8182/gremlin', 'g')
+client.submit('x + x', {'x': 2}).all().result()
+----
+
+It is also possible to initialize the `Client` to use <<sessions,sessions>>:
+
+[source,python]
+----
+client = Client('ws://localhost:8182/gremlin', 'g', session=str(uuid.uuid4()))
+----
+
+With this configuration, the state of variables within scripts are preserved between requests.
+
 [[gremlin-DotNet]]
 == Gremlin.Net
 
-image:gremlin-dotnet-logo.png[width=371,float=right] Apache TinkerPop's Gremlin.Net implements Gremlin within the C# language. It targets .NET Standard and can
-therefore be used on different operating systems and with different .NET frameworks, such as .NET Framework
-and link:https://www.microsoft.com/net/core[.NET Core]. Since the C# syntax is very similar to that of Java, it should be very easy to switch between
-Gremlin-Java and Gremlin.Net. The only major syntactical difference is that all method names in Gremlin.Net
-use PascalCase as opposed to camelCase in Gremlin-Java in order to comply with .NET conventions.
+image:gremlin-dotnet-logo.png[width=371,float=right] Apache TinkerPop's Gremlin.Net implements Gremlin within the C#
+language. It targets .NET Standard and can therefore be used on different operating systems and with different .NET
+frameworks, such as .NET Framework and link:https://www.microsoft.com/net/core[.NET Core]. Since the C# syntax is very
+similar to that of Java, it should be very easy to switch between Gremlin-Java and Gremlin.Net. The only major
+syntactical difference is that all method names in Gremlin.Net use PascalCase as opposed to camelCase in Gremlin-Java
+in order to comply with .NET conventions.
 
 [source,powershell]
 nuget install Gremlin.Net
@@ -515,6 +535,31 @@ TIP: When running into situations where Groovy cannot properly discern a method
 instance created, it will help to fully define the closure in the lambda expression - so rather than
 `Lambda.Groovy("it.get().value('name'))`, prefer `Lambda.Groovy("x -> x.get().value('name'))`.
 
+=== Submit Gremlin Scripts
+
+Additionally, you can also send parametrized Gremlin scripts to the server as strings:
+
+[source,csharp]
+----
+var gremlinServer = new GremlinServer("localhost", 8182);
+using (var gremlinClient = new GremlinClient(gremlinServer))
+{
+    var bindings = new Dictionary<string, object> {{"a", a}, {"b", b}};
+    var response =
+        await gremlinClient.SubmitWithSingleResultAsync<int>("a + b", bindings);
+}
+----
+
+It is also possible to initialize the `Client` to use <<sessions,sessions>>:
+
+[source,csharp]
+----
+var gremlinServer = new GremlinServer("localhost", 8182);
+var client = new GremlinClient(gremlinServer, sessionId: Guid.NewGuid().ToString()))
+----
+
+With this configuration, the state of variables within scripts are preserved between requests.
+
 [[gremlin-javascript]]
 == Gremlin-JavaScript
 
@@ -576,7 +621,6 @@ asynchronous by default, this terminal methods return a `Promise`.
 link:https://github.com/tc39/proposal-async-iteration[async iterator proposal].
 * `Traversal.iterate()`: Returns a `Promise` without a value.
 
-
 For example:
 
 [source,javascript]
diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc
index 0e9549c..52ee98b 100644
--- a/docs/src/upgrade/release-3.3.x.asciidoc
+++ b/docs/src/upgrade/release-3.3.x.asciidoc
@@ -29,21 +29,22 @@ Please see the link:https://github.com/apache/tinkerpop/blob/3.3.11/CHANGELOG.as
 
 === Upgrading for Users
 
-==== gremlin-python Sessions
-
-The `sessions` feature is enabled in gremlin-python.
-
-[source, python]
-client = Client('ws://localhost:8182/gremlin', 'g', session=str(uuid.uuid4()))
-
-==== gremlin-javascript Sessions
+==== GLV Sessions
 
 While TinkerPop doesn't recommend the use of sessions for most use cases, it does remain a feature that is available
 and exposed on the server. As such, providing support in all Gremlin Language Variants for this feature is useful in
 ensuring a consistent implementation for all programming languages.
 
 [source,javascript]
-const client = new gremlin.driver.Client('ws://localhost:8182/gremlin', { traversalSource: 'g', 'session': 'unique-string-id' });
+const client = new Client('ws://localhost:8182/gremlin', { traversalSource: 'g', 'session': 'unique-string-id' });
+
+[source, python]
+client = Client('ws://localhost:8182/gremlin', 'g', session=str(uuid.uuid4()))
+
+[source, csharp]
+var gremlinServer = new GremlinServer("localhost", 8182);
+var client = new GremlinClient(gremlinServer, sessionId: Guid.NewGuid().ToString()))
+
 ==== Deprecate maxWaitForSessionClose
 
 The `maxWaitForSessionClose` setting for the Java driver has been deprecated and in some sense replaced by the


[tinkerpop] 01/04: Use UUID in test for session name in javascript CTR

Posted by sp...@apache.org.
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 1871a0577497de6b813d1e45f7719fbd87a5db2a
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Wed Apr 15 07:53:15 2020 -0400

    Use UUID in test for session name in javascript CTR
---
 .../src/main/javascript/gremlin-javascript/test/helper.js             | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 72708c0..fb01b2d 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -22,6 +22,7 @@
  */
 'use strict';
 
+const utils = require('../lib/utils');
 const DriverRemoteConnection = require('../lib/driver/driver-remote-connection');
 const Client = require('../lib/driver/client');
 const PlainTextSaslAuthenticator = require('../lib/driver/auth/plain-text-sasl-authenticator');
@@ -48,5 +49,6 @@ exports.getClient = function getClient(traversalSource) {
 };
 
 exports.getSessionClient = function getSessionClient(traversalSource) {
-  return new Client(serverUrl, { 'traversalSource': traversalSource, 'session': 'unique-string-id'});
+  const sessionId = utils.getUuid();
+  return new Client(serverUrl, { 'traversalSource': traversalSource, 'session': sessionId.toString() });
 };


[tinkerpop] 04/04: Merge branch '3.4-dev'

Posted by sp...@apache.org.
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 411dcf068d7243d18d1591a52ea3c0cf84158413
Merge: f3d8939 f3d58c3
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Wed Apr 15 08:37:27 2020 -0400

    Merge branch '3.4-dev'

 CHANGELOG.asciidoc                                    |  3 +--
 docs/src/reference/gremlin-variants.asciidoc          |  9 +++++++++
 docs/src/upgrade/release-3.3.x.asciidoc               | 19 ++++++++++---------
 .../main/javascript/gremlin-javascript/test/helper.js |  4 +++-
 4 files changed, 23 insertions(+), 12 deletions(-)



[tinkerpop] 03/04: Merge branch '3.3-dev' into 3.4-dev

Posted by sp...@apache.org.
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 f3d58c3db9741ac575ccaf63edcd19f76d5d6cf0
Merge: 324500e b8c750e
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Wed Apr 15 08:37:20 2020 -0400

    Merge branch '3.3-dev' into 3.4-dev

 CHANGELOG.asciidoc                                    |  3 +--
 docs/src/reference/gremlin-variants.asciidoc          |  9 +++++++++
 docs/src/upgrade/release-3.3.x.asciidoc               | 19 ++++++++++---------
 .../main/javascript/gremlin-javascript/test/helper.js |  4 +++-
 4 files changed, 23 insertions(+), 12 deletions(-)

diff --cc docs/src/reference/gremlin-variants.asciidoc
index 33e6c6f,69988bd..9a01d6c
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@@ -718,22 -243,21 +718,23 @@@ That is, without the `+__+`-prefix
  g.V().repeat(out()).times(2).name.fold().toList()
  ----
  
 -=== Bindings
 +=== Configuration
  
 -When a traversal bytecode is sent over a `RemoteConnection` (e.g. Gremlin Server), 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. Many traversals are unique up to some parameterization. For instance,
 -`g.V(1).out('created').name` is considered different from `g.V(4).out('created').name'` as they have different script
 -"string" representations. However, `g.V(x).out('created').name` with bindings of `{x : 1}` and `{x : 4}` are considered
 -the same. If a traversal is going to be executed repeatedly, but with different parameters, then bindings should be
 -used. In Gremlin-Python, bindings are 2-tuples and used as follows.
 +The following table describes the various configuration options for the Gremlin-Python Driver. They
 +can be passed to the `Client` or `DriverRemoteConnection` instance as keyword arguments:
  
 -[gremlin-python,modern]
 -----
 -g.V(('id',1)).out('created').name.toList()
 -g.V(('id',4)).out('created').name.toList()
 -----
 +[width="100%",cols="3,10,^2",options="header"]
 +|=========================================================
 +|Key |Description |Default
 +|protocol_factory |A callable that returns an instance of `AbstractBaseProtocol`. |`gremlin_python.driver.protocol.GremlinServerWSProtocol`
 +|transport_factory |A callable that returns an instance of `AbstractBaseTransport`. |`gremlin_python.driver.tornado.transport.TornadoTransport`
 +|pool_size |The number of connections used by the pool. |4
 +|max_workers |Maximum number of worker threads. |Number of CPUs * 5
 +|message_serializer |The message serializer implementation.|`gremlin_python.driver.serializer.GraphSONMessageSerializer`
 +|password |The password to submit on requests that require authentication. |""
 +|username |The username to submit on requests that require authentication. |""
++|session | A unique string-based identifier (typically a UUID) to enable a <<sessions,session-based connection>>. This is not a valid configuration for `DriverRemoteConnection`. |None
 +|=========================================================
  
  === Traversal Strategies
  
@@@ -1151,71 -541,24 +1152,79 @@@ Gremlin scripts are sent to the server 
  
  [source,csharp]
  ----
 -var gremlinServer = new GremlinServer("localhost", 8182);
 -using (var gremlinClient = new GremlinClient(gremlinServer))
 -{
 -    var bindings = new Dictionary<string, object> {{"a", a}, {"b", b}};
 -    var response =
 -        await gremlinClient.SubmitWithSingleResultAsync<int>("a + b", bindings);
 -}
 +include::../../../gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Reference/GremlinVariantsTests.cs[tags=submittingScripts]
 +----
 +
 +If the remote system has authentication and SSL enabled, then the `GremlinServer` object can be configured as follows:
 +
 +[source,csharp]
 +----
 +include::../../../gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Reference/GremlinVariantsTests.cs[tags=submittingScriptsWithAuthentication]
  ----
  
+ It is also possible to initialize the `Client` to use <<sessions,sessions>>:
+ 
+ [source,csharp]
+ ----
+ var gremlinServer = new GremlinServer("localhost", 8182);
+ var client = new GremlinClient(gremlinServer, sessionId: Guid.NewGuid().ToString()))
+ ----
+ 
 -With this configuration, the state of variables within scripts are preserved between requests.
 +[[gremlin-net-dsl]]
 +=== Domain Specific Languages
 +
 +Developing a <<dsl,Domain Specific Language>> (DSL) for .Net is most easily implemented using
 +link:https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods[Extension Methods]
 +as they don't require direct extension of classes in the TinkerPop hierarchy. Extension Method classes simply need to
 +be constructed for the `GraphTraversal` and the `GraphTraversalSource`. Unfortunately, anonymous traversals (spawned
 +from `+__+`) can't use the Extension Method approach as they do not work for static classes and static classes can't be
 +extended. The only option is to re-implement the methods of `+__+` as a wrapper in the anonymous traversal for the DSL
 +or to simply create a static class for the DSL and use the two anonymous traversals creators independently. The
 +following example uses the latter approach as it saves a lot of boilerplate code with the minor annoyance of having a
 +second static class to deal with when writing traversals rather than just calling `+__+` for everything.
 +
 +[source,csharp]
 +----
 +include::../../../gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Reference/GremlinVariantsDsl.cs[tags=dsl]
 +----
 +
 +Note the creation of `__Social` as the Social DSL's "extension" to the available ways in which to spawn anonymous
 +traversals. The use of the double underscore prefix in the name is just a convention to consider using and is not a
 +requirement. To use the DSL, bring it into scope with the `using` directive:
 +
 +[source,csharp]
 +----
 +include::../../../gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Reference/GremlinVariantsDslTests.cs[tags=dslUsing]
 +----
 +
 +and then it can be called from the application as follows:
 +
 +[source,csharp]
 +----
 +include::../../../gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Reference/GremlinVariantsDslTests.cs[tags=dslExamples]
 +----
 +
 +anchor:gremlin-dotnet-template[]
 +[[dotnet-application-examples]]
 +=== Application Examples
 +
 +This link:https://docs.microsoft.com/dotnet/core/tools/custom-templates[dotnet template] helps getting started with
 +<<gremlin-dotnet,Gremlin.Net>>. It creates a new C# console project that shows how to connect to a
 +<<gremlin-server,Gremlin Server>> with Gremlin.Net.
 +
 +You can install the template with the dotnet CLI tool:
 +[source,shell]
 +dotnet new -i Gremlin.Net.Template
 +
 +After the template is installed, a new project based on this template can be installed:
 +
 +[source,shell]
 +dotnet new gremlin
 +
 +Specify the output directory for the new project which will then also be used as the name of the created project:
 +
 +[source,shell]
 +dotnet new gremlin -o MyFirstGremlinProject
  
  [[gremlin-javascript]]
  == Gremlin-JavaScript