This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch TINKERPOP-2002 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit fc8eb40f6b410a5e39f939b57d2f91a933d23485 Author: Stephen Mallette <sp...@genoprime.com> AuthorDate: Tue Nov 13 10:50:46 2018 -0500 TINKERPOP-2002 Add "connect" image --- docs/src/reference/gremlin-applications.asciidoc | 18 ++++--- docs/src/reference/gremlin-variants.asciidoc | 59 +++++++++++++++++------ docs/static/images/rexster-connect.png | Bin 0 -> 142358 bytes 3 files changed, 54 insertions(+), 23 deletions(-) diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc index b27490e..83424c7 100644 --- a/docs/src/reference/gremlin-applications.asciidoc +++ b/docs/src/reference/gremlin-applications.asciidoc @@ -520,12 +520,13 @@ executing. It is up to the script to properly commit or rollback transactions i [[connecting-via-drivers]] === Connecting via Drivers -TinkerPop offers client-side drivers for the Gremlin Server websocket subprotocol in a variety of languages: +image:rexster-connect.png[width=400,float=right] TinkerPop offers client-side drivers for the Gremlin Server websocket +sub-protocol in a variety of languages: -* C# -* Java -* Javascript -* Python +* <<gremlin-dotnet,C#>> +* <<gremlin-java,Java>> +* <<gremlin-javascript,Javascript>> +* <<gremlin-python,Python>> These drivers provide methods to send Gremlin based requests and get back traversal results as a response. The requests may be script-based or bytecode-based. As discussed earlier in the <<connecting-gremlin-server,introduction>> the @@ -600,7 +601,7 @@ list = g.V().has("person","name","marko").out("knows").toList() The advantage of bytecode over scripts should be apparent from the above examples. Scripts are just strings that are embedded in code (in the above examples, the strings are Groovy-based) whereas bytecode based requests are themselves code written in the native language of use. Obviously, the advantage of the Gremlin being actual code is that there -are checks (e.g. compile-time, intellisense and other IDE support, language level checks, etc.) that help validate the +are checks (e.g. compile-time, auto-complete and other IDE support, language level checks, etc.) that help validate the Gremlin during the development process. TinkerPop makes an effort to ensure a high-level of consistency among the drivers and their features, but there are @@ -1088,7 +1089,8 @@ mechanisms are accessible, see the table below. 1.3+v|Gremlin-Java/ Gremlin-Console |PLAIN SASL (username/password) |3.0.0-incubating |Pluggable SASL |3.0.0-incubating -|GSSAPI SASL (Kerberos) |3.3.0 +|GSSAPI SASL (Kerberos) |3.3.0 +|Gremlin.NET |PLAIN SASL |3.3.0 |Gremlin-Python |PLAIN SASL |3.2.2 |Gremlin.Net |PLAIN SASL |3.2.7 |Gremlin-Javascript |PLAIN SASL |3.3.0 @@ -1171,7 +1173,7 @@ $ bin/gremlin-server.sh conf/gremlin-server-secure.yaml [INFO] GremlinServer$1 - Channel started at port 8182. ---- -As SSL is enabled on the server it must also be enabled on the client when connecting. To connect to +When SSL is enabled on the server, it must also be enabled on the client when connecting. To connect to Gremlin Server with the <<gremlin-java,`gremlin-driver`>>, set the `credentials`, `enableSsl`, and `trustStore` when constructing the `Cluster`. diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc index 0321050..a19222a 100644 --- a/docs/src/reference/gremlin-variants.asciidoc +++ b/docs/src/reference/gremlin-variants.asciidoc @@ -100,9 +100,10 @@ connection methods described in the <<connecting-gremlin,Connecting Gremlin>> Se === Connecting -The pattern for connecting is described in <<connecting-gremlin,Connecting Gremlin>> and it basically distills down to -creating a `GraphTraversalSource`. For <<connecting-embedded,embedded>> mode, this involves first creating a `Graph` -and then spawning the `GraphTraversalSource`: +image:rexster-connect.png[width=400,float=left] The pattern for connecting is described in +<<connecting-gremlin,Connecting Gremlin>> and it basically distills down to creating a `GraphTraversalSource`. +For <<connecting-embedded,embedded>> mode, this involves first creating a `Graph` and then spawning the +`GraphTraversalSource`: [source,java] ---- @@ -350,7 +351,7 @@ for legacy reasons and corner use cases which are still not completely addressed consider using bytecode-based requests instead when possible. image:gremlin-java.png[width=175,float=left] TinkerPop comes equipped with a reference client for Java-based -applications. It is referred to as Gremlin Driver, which enables applications to send requests to Gremlin Server +applications. It is referred to as `gremlin-driver`, which enables applications to send requests to Gremlin Server and get back results. Gremlin scripts are sent to the server from a `Client` instance. A `Client` is created as follows: @@ -615,9 +616,10 @@ pip install gremlinpython === Connecting -The pattern for connecting is described in <<connecting-gremlin,Connecting Gremlin>> and it basically distills down to -creating a `GraphTraversalSource`. A `GraphTraversalSource` is created from the anonymous `traversal()` method where -the "g" provided to the `DriverRemoteConnection` corresponds to the name of a `GraphTraversalSource` on the remote end. +image:rexster-connect.png[width=400,float=left] The pattern for connecting is described in +<<connecting-gremlin,Connecting Gremlin>> and it basically distills down to creating a `GraphTraversalSource`. A +`GraphTraversalSource` is created from the anonymous `traversal()` method where the "g" provided to the +`DriverRemoteConnection` corresponds to the name of a `GraphTraversalSource` on the remote end. [source,python] g = traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g')) @@ -947,6 +949,7 @@ to `Set` manually. * Gremlin is capable of returning `Dictionary` results that use non-hashable keys (e.g. Dictionary as a key) and Python does not support that at a language level. Gremlin that returns such results will need to be re-written to avoid that. +[[gremlin-dotnet]] [[gremlin-DotNet]] == Gremlin.Net @@ -962,10 +965,10 @@ nuget install Gremlin.Net === Connecting -The pattern for connecting is described in <<connecting-gremlin,Connecting Gremlin>> and it basically distills down to -creating a `GraphTraversalSource`. A `GraphTraversalSource` is created from the `AnonymousTraversalSource.traversal()` -method where the "g" provided to the `DriverRemoteConnection` corresponds to the name of a `GraphTraversalSource` on -the remote end. +image:rexster-connect.png[width=400,float=left] The pattern for connecting is described in +<<connecting-gremlin,Connecting Gremlin>> and it basically distills down to creating a `GraphTraversalSource`. A +`GraphTraversalSource` is created from the `AnonymousTraversalSource.traversal()` method where the "g" provided to +the `DriverRemoteConnection` corresponds to the name of a `GraphTraversalSource` on the remote end. [source,csharp] ---- @@ -1066,6 +1069,32 @@ g.V().Out().Map<int>(Lambda.Python("lambda x: len(x.get().value('name'))")).Sum< The `ILambda` interface returned by these two methods inherits interfaces like `IFunction` and `IPredicate` that mirror their Java counterparts which makes it possible to use lambdas with Gremlin.Net for the same steps as in Gremlin-Java. +=== Submitting Scripts + +WARNING: TinkerPop does not recommend submitting script-based requests and generally continues to support this feature +for legacy reasons and corner use cases which are still not completely addressed by the Gremlin language. Please +consider using bytecode-based requests instead when possible. + +Gremlin scripts are sent to the server from a `IGremlinClient` instance. A `IGremlinClient` is created as follows: + +[source,csharp] +---- +var gremlinServer = new GremlinServer("localhost", 8182); +using (var gremlinClient = new GremlinClient(gremlinServer)) +{ + var response = await gremlinClient.SubmitWithSingleResultAsync<string>("g.V().has('person','name','marko')"); +} +---- + +If the remote system has authentication and SSL enabled, then the `GremlinServer` object can be configured as follows: + +[source,csharp] +---- +var username = "username"; +var password = "password"; +var gremlinServer = new GremlinServer(TestHost, TestPort, enableSsl: true username: username, password: password); +---- + === Domain Specific Languages Developing a <<dsl,Domain Specific Language>> (DSL) for .Net is most easily implemented using @@ -1194,10 +1223,10 @@ npm install gremlin === Connecting -The pattern for connecting is described in <<connecting-gremlin,Connecting Gremlin>> and it basically distills down to -creating a `GraphTraversalSource`. A `GraphTraversalSource` is created from the `AnonymousTraversalSource.traversal()` -method where the "g" provided to the `DriverRemoteConnection` corresponds to the name of a `GraphTraversalSource` on -the remote end. +image:rexster-connect.png[width=400,float=left] The pattern for connecting is described in +<<connecting-gremlin,Connecting Gremlin>> and it basically distills down to creating a `GraphTraversalSource`. +A `GraphTraversalSource` is created from the `AnonymousTraversalSource.traversal()` method where the "g" provided to +the `DriverRemoteConnection` corresponds to the name of a `GraphTraversalSource` on the remote end. [source,javascript] ---- diff --git a/docs/static/images/rexster-connect.png b/docs/static/images/rexster-connect.png new file mode 100644 index 0000000..d1f53b0 Binary files /dev/null and b/docs/static/images/rexster-connect.png differ