You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by GitBox <gi...@apache.org> on 2022/05/02 21:09:34 UTC

[GitHub] [tinkerpop] lyndonbauto opened a new pull request, #1639: Gremlin go ms6

lyndonbauto opened a new pull request, #1639:
URL: https://github.com/apache/tinkerpop/pull/1639

   This has the changes for Milestone 5 of the gremlin-go driver. I would like to thank @xiazcy, @simonz-bq, @L0Lmaker, @vkagamlyk, @divijvaidya, @spmallette, and @krlawrence for continued help they have all been putting into this.
   
   We have also added enhanced documentation and performance testing.
   
   We are planning to host a bug bash on May 4 [in discord](https://discord.gg/mQzHUyNP?event=966289876133761044), everyone, with or without prior Golang experience, is welcome to join.
   
   Pull request comments and all bugs introduced via the discord event will be addressed in this pull request unless otherwise stated.
   
   This pull request will remain open for at least two weeks, so the community has a chance to look at it and critique it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867334269


##########
docs/src/reference/gremlin-variants.asciidoc:
##########
@@ -1897,3 +1897,300 @@ pip install gremlinpython
 pip install aiohttp
 python example.py
 ----
+
+[[gremlin-go]]
+== Gremlin-Go
+
+image:gremlin-go.png[width=130,float=right] Apache TinkerPop's Gremlin-Go implements Gremlin within the link:https://go.dev/[Go] language and can therefore be used on different operating systems. Go's syntax has the similar constructs as Java including
+"dot notation" for function chaining (`a.b.c`) and round bracket function arguments (`a(b,c)`). Something unlike Java is that Gremlin-Go requires a 
+`gremlingo` prefix when using the namespace (`a(b())` vs `gremlingo.a(gremlingo.__.b())`). Anyone familiar with Gremlin-Java will be able to work
+with Gremlin-Go with relative ease. Moreover, there are a few added constructs to Gremlin-Go that make traversals a bit more
+succinct.
+
+To install the Gremlin-Go as a dependency for your project, run the following in the root directory of your project that contains your `go.mod` file:
+
+[source,bash]
+----
+go get github.com/apache/tinkerpop/gremlin-go/v3[optionally append @<version>, such as @v3.5.3]
+----
+
+[[gremlin-go-connecting]]
+=== 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_()`.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin")
+g := gremlingo.Traversal_().WithRemote(remote)
+----
+
+If you need to additional parameters to connection setup, you can pass in a configuration function.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin",
+  func(settings *DriverRemoteConnectionSettings) {
+    settings.TraversalSource = "gmodern"
+  })
+----
+
+Gremlin-go supports plain text authentication. It can be set in the connection function.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin",
+  func(settings *DriverRemoteConnectionSettings) {
+    settings.TlsConfig = &tls.Config{InsecureSkipVerify: true}
+    settings.AuthInfo = gremlingo.BasicAuthInfo("login", "password")
+  })
+----
+
+If you authenticate to a remote <<connecting-gremlin-server,Gremlin Server>> or
+<<connecting-rgp,Remote Gremlin Provider>>, this server normally has SSL activated and the websockets url will start
+with 'wss://'.
+
+Some connection options can also be set on individual requests made through the using `With()` step on the
+`TraversalSource`. For instance to set request timeout to 500 milliseconds:
+
+[source,go]
+----
+results, err := g.With("evaluationTimeout", 500).V().Out("knows").ToList()
+----
+
+The following options are allowed on a per-request basis in this fashion: `batchSize`, `requestId`, `userAgent` and
+`evaluationTimeout` (formerly `scriptEvaluationTimeout` which is also supported but now deprecated).
+
+anchor:go-imports[]
+[[gremlin-go-imports]]
+=== Common Imports
+
+There are a number of classes, functions and tokens that are typically used with Gremlin. The following import
+provide most of the typical functionality required to use Gremlin:
+
+[source,go]
+----
+import (
+	"github.com/apache/tinkerpop/gremlin-go/driver"
+)
+----
+
+These can be used analogously to how they are used in Gremlin-Java.
+
+[source,go]
+----
+results, err := g.V().HasLabel("person").Has("age", gremlingo.T__.Is(gremlingo.P.Gt(30))).Order().By("age", gremlingo.Desc).ToList()
+[v[6], v[4]]
+----
+
+anchor:go-configuration[]
+[[gremlin-go-configuration]]
+=== Configuration
+
+The following table describes the various configuration options for the Gremlin-go Driver. They
+can be passed to the `NewClient` or `NewDriverRemoteConnection` functions as configuration function arguments:
+
+[width="100%",cols="3,10,^2",options="header"]
+|=========================================================
+|Key |Description |Default
+|TraversalSource |Traversal source. |"g"
+|TransporterType |Transporter type. |Gorilla
+|LogVerbosity |Log verbosity.|gremlingo.INFO
+|Logger |Instance of logger. |log
+|Language |Language used for logging messages. |language.English
+|AuthInfo |Authentification info, can be build with BasicAuthInfo() or HeaderAuthInfo(). |empty
+|TlsConfig |TLS configuration. |empty
+|KeepAliveInterval |Keep connection alive interval. |5 seconds
+|WriteDeadline |Write deadline. |3 seconds
+|ConnectionTimeout | Timeout for establishing connection. |45 seconds
+|NewConnectionThreshold | Minimum amount of concurrent active traversals on a connection to trigger creation of a new connection. |4
+|MaximumConcurrentConnections | Maximum number of concurrent connections. |number of runtime processors
+|EnableCompression |Flag to enable compression. |false
+|ReadBufferSize |Specify I/O buffer sizes in bytes. If a buffer size is zero, then a useful default size is used |0
+|WriteBufferSize |Specify I/O buffer sizes in bytes. If a buffer size is zero, then a useful default size is used |0
+|Session |Session ID. |""
+|=========================================================
+
+[[gremlin-go-strategies]]
+=== Traversal Strategies
+
+In order to add and remove <<traversalstrategy,traversal strategies>> from a traversal source, Gremlin-Go has a
+`TraversalStrategy` interface along with a collection of functions that mirror the standard Gremlin-Java strategies.
+
+[source,go]
+----
+promise := g.WithStrategies(gremlingo.ReadOnlyStrategy()).AddV("person").Property("name", "foo").Iterate()
+----
+
+NOTE: Many of the `TraversalStrategy` classes in Gremlin-Go are proxies to the respective strategy on
+Apache TinkerPop's JVM-based Gremlin traversal machine. As such, their `apply(Traversal)` method does nothing. However,
+the strategy is encoded in the Gremlin-Go bytecode and transmitted to the Gremlin traversal machine for
+re-construction machine-side.
+
+[[gremlin-go-transactions]]
+=== Transactions
+
+To get a full understanding of this section, it would be good to start by reading the <<transactions,Transactions>>
+section of this documentation, which discusses transactions in the general context of TinkerPop itself. This section
+builds on that content by demonstrating the transactional syntax for Go.
+
+[source,go]
+----
+remote, err := NewDriverRemoteConnection("ws://localhost:8182/gremlin")
+g := gremlingo.Traversal_().WithRemote(remote)
+
+// Create a Transaction.
+tx := g.Tx()
+
+// Spawn a new GraphTraversalSource, binding all traversals established from it to tx.
+gtx, _ := tx.Begin()
+
+// Execute a traversal within the transaction.
+promise := g.AddV("person").Property("name", "Lyndon").Iterate()
+err := <-promise
+
+if err != nil {
+  // Rollback the transaction if an error occurs.
+  tx.rollback()
+} else {
+  // Commit the transaction. The transaction can no longer be used and cannot be re-used.
+  // A new transaction can be spawned through g.Tx().
+  tx.Commit()
+}
+----
+
+[[gremlin-go-lambda]]
+=== The Lambda Solution
+
+Supporting link:https://en.wikipedia.org/wiki/Anonymous_function[anonymous functions] across languages is difficult as
+most languages do not support lambda introspection and thus, code analysis. In Gremlin-Go, a Gremlin lambda should
+be represented as a zero-arg callable that returns a string representation of the lambda expected for use in the
+traversal. The lambda should be written as a `Gremlin-Groovy` string. 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.
+
+[source,go]
+----
+r, err := g.V().Out().Map(&gremlingo.Lambda{Script: "it.get().value('name').length()", Language: ""}).Sum().ToList()		
+----
+
+TIP: When running into situations where Groovy cannot properly discern a method signature based on the `Lambda`
+instance created, it will help to fully define the closure in the lambda expression - so rather than
+`Script: "it.get().value('name')", Language: "gremlin-groovy"`, prefer `Script: "x -> x.get().value('name')", Language: "gremlin-groovy"`.
+
+Finally, Gremlin `Bytecode` that includes lambdas requires that the traversal be processed by the
+`ScriptEngine`. To avoid continued recompilation costs, it supports the encoding of bindings, which allow a remote
+engine to 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.
+
+[source,go]
+----
+r, err := g.V((&gremlingo.Bindings{}).Of("x", 1)).Out("created").Map(&gremlingo.Lambda{Script: "it.get().value('name').length()", Language: ""}).Sum().ToList()
+// 3
+r, err := g.V((&gremlingo.Bindings{}).Of("x", 4)).Out("created").Map(&gremlingo.Lambda{Script: "it.get().value('name').length()", Language: ""}).Sum().ToList()
+// 9
+----
+
+WARNING: As explained throughout the documentation, when possible <<a-note-on-lambdas,avoid>> lambdas.
+
+[[gremlin-go-scripts]]
+=== Submitting Scripts
+
+The `Client` class implementation/interface is based on the Java Driver, with some restrictions. Most notably,
+Gremlin-go does not yet implement the `Cluster` class. Instead, `Client` is instantiated directly.
+Usage is as follows:
+
+[source,go]
+----
+import "github.com/apache/tinkerpop/gremlin-go/v3/driver" <1>
+client, err := gremlingo.NewClient("ws://localhost:8182/gremlin") <2>
+----
+
+<1> Import the Gremlin-Go module.
+<2> Opens a reference to `localhost` - note that there are various configuration options that can be passed
+to the `Client` object upon instantiation as keyword arguments.
+
+Once a `Client` instance is ready, it is possible to issue some Gremlin:
+
+[source,go] //todo: clarify replacement one with One

Review Comment:
   todo ??



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867336341


##########
gremlin-go/docker/generate-all.groovy:
##########
@@ -0,0 +1,79 @@
+/*

Review Comment:
   we've agreed that we're trying to establish a testing pattern here that we can extend to all GLVs, so i'll continue to ignore this duplication. just commenting here to continue to keep it forefront that we're working towards that goal and that test configuration copies is not going to be the approach taken.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867335230


##########
gremlin-go/Dockerfile:
##########
@@ -15,23 +15,34 @@
 # specific language governing permissions and limitations
 # under the License.
 
-ARG GREMLIN_SERVER_VERSION=${version:-3.5.4}
-FROM tinkerpop/gremlin-server:${GREMLIN_SERVER_VERSION}-SNAPSHOT
+ARG GREMLIN_SERVER_VERSION
+FROM tinkerpop/gremlin-server:${GREMLIN_SERVER_VERSION:-3.5.4-SNAPSHOT}
 
 USER root
 RUN mkdir -p /opt
 WORKDIR /opt
 COPY gremlin-server/src/test /opt/test/
+COPY gremlin-go/docker/generate-all.groovy /opt/test/scripts/
 COPY gremlin-go/docker/docker-entrypoint.sh gremlin-go/docker/*.yaml /opt/
 RUN chmod 755 /opt/docker-entrypoint.sh
 
-# Setting to 3.5.3 does gives error even when using outside of Docker.
-ENV NEO4J_VERSION=${version:-3.5.2}
+# Installing dos2unix to avoid errors in running the entrypoint script on Windows machines where their
+# carriage return is \r\n instead of the \n needed for linux/unix containers
+RUN apk update && apk add dos2unix
+RUN dos2unix /opt/docker-entrypoint.sh && apk del dos2unix
+
+ARG NEO4J_VERSION
 # Installs Neo4j libraries to this image so that we can test variants with transactions,
 # but only only port 45940 is configured with the neo4j graph as the neo4j-empty.properties
 # is statically pointing at a temp directory and that space can only be accessed by one
 # graph at a time.
-RUN /opt/gremlin-server/bin/gremlin-server.sh install org.apache.tinkerpop neo4j-gremlin $NEO4J_VERSION
+RUN /opt/gremlin-server/bin/gremlin-server.sh install org.apache.tinkerpop neo4j-gremlin ${NEO4J_VERSION:-3.5.4}

Review Comment:
   how does this work? 3.5.4 doesn't exist yet. it should be 3.5.4-SNAPSHOT (i.e. this should match whatever gremlin server is which should match whatever version gremlin-go is which should match whatever the root pom.xml is.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] lyndonbauto commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
lyndonbauto commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r869612700


##########
gremlin-go/docker/gremlin-server-integration-secure.yaml:
##########
@@ -20,6 +20,7 @@ port: 45941
 evaluationTimeout: 30000
 graphs: {
   graph: conf/tinkergraph-empty.properties,
+  test: conf/tinkergraph-empty.properties,

Review Comment:
   Cucumber and integration tests run in parallel, Cucumber was modifying the graph so we added an empty test graph to also use for testing in integration so that there wasn't race conditions causing intermittent failures with the parallel tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] xiazcy commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
xiazcy commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r869647350


##########
gremlin-go/Dockerfile:
##########
@@ -15,23 +15,34 @@
 # specific language governing permissions and limitations
 # under the License.
 
-ARG GREMLIN_SERVER_VERSION=${version:-3.5.4}
-FROM tinkerpop/gremlin-server:${GREMLIN_SERVER_VERSION}-SNAPSHOT
+ARG GREMLIN_SERVER_VERSION
+FROM tinkerpop/gremlin-server:${GREMLIN_SERVER_VERSION:-3.5.4-SNAPSHOT}
 
 USER root
 RUN mkdir -p /opt
 WORKDIR /opt
 COPY gremlin-server/src/test /opt/test/
+COPY gremlin-go/docker/generate-all.groovy /opt/test/scripts/
 COPY gremlin-go/docker/docker-entrypoint.sh gremlin-go/docker/*.yaml /opt/
 RUN chmod 755 /opt/docker-entrypoint.sh
 
-# Setting to 3.5.3 does gives error even when using outside of Docker.
-ENV NEO4J_VERSION=${version:-3.5.2}
+# Installing dos2unix to avoid errors in running the entrypoint script on Windows machines where their
+# carriage return is \r\n instead of the \n needed for linux/unix containers
+RUN apk update && apk add dos2unix
+RUN dos2unix /opt/docker-entrypoint.sh && apk del dos2unix
+
+ARG NEO4J_VERSION
 # Installs Neo4j libraries to this image so that we can test variants with transactions,
 # but only only port 45940 is configured with the neo4j graph as the neo4j-empty.properties
 # is statically pointing at a temp directory and that space can only be accessed by one
 # graph at a time.
-RUN /opt/gremlin-server/bin/gremlin-server.sh install org.apache.tinkerpop neo4j-gremlin $NEO4J_VERSION
+RUN /opt/gremlin-server/bin/gremlin-server.sh install org.apache.tinkerpop neo4j-gremlin ${NEO4J_VERSION:-3.5.4}

Review Comment:
   The -3.5.4 makes it default to 3.5.4, but can be changed via the "NEO4J_VERSION" build argument in docker-compose. I don't think there is a way to have the compose file dynamically parse the pom file, but I will make a run script to obtain the Gremlin server/Neo4j version and execute the docker-compose for now. Ultimately this will be resolved with the docker design works. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867332489


##########
.github/workflows/build-test.yml:
##########
@@ -227,6 +227,11 @@ jobs:
           docker-compose up --exit-code-from gremlin-go-integration-tests
           docker-compose down
 
+      - name: Upload to Codecov

Review Comment:
   was there ever any investigation into whether ASF infra involvement was required to make this work?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] lyndonbauto commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
lyndonbauto commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r869578109


##########
.github/workflows/build-test.yml:
##########
@@ -227,6 +227,11 @@ jobs:
           docker-compose up --exit-code-from gremlin-go-integration-tests
           docker-compose down
 
+      - name: Upload to Codecov

Review Comment:
   Yeah - we didn't have to make an account or do anything and it is totally free and easy for open source projects so we do not need ASF infra involvement.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867332911


##########
docs/src/reference/gremlin-variants.asciidoc:
##########
@@ -1897,3 +1897,300 @@ pip install gremlinpython
 pip install aiohttp
 python example.py
 ----
+
+[[gremlin-go]]
+== Gremlin-Go
+
+image:gremlin-go.png[width=130,float=right] Apache TinkerPop's Gremlin-Go implements Gremlin within the link:https://go.dev/[Go] language and can therefore be used on different operating systems. Go's syntax has the similar constructs as Java including
+"dot notation" for function chaining (`a.b.c`) and round bracket function arguments (`a(b,c)`). Something unlike Java is that Gremlin-Go requires a 
+`gremlingo` prefix when using the namespace (`a(b())` vs `gremlingo.a(gremlingo.__.b())`). Anyone familiar with Gremlin-Java will be able to work

Review Comment:
   `gremlingo.a(gremlingo.__.b())` is a bit misleading since the double-underscore isn't supported except by way of `var` initialization and then you wouldn't use the `gremlingo` prefix, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] vkagamlyk commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
vkagamlyk commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r869615484


##########
gremlin-go/README.md:
##########
@@ -22,58 +22,24 @@ for early testing purposes only.
 
 -->
 
-# Getting Started

Review Comment:
   README is also used as package documentation https://pkg.go.dev/github.com/lyndonbauto/tinkerpop/gremlin-go/v3@v3.5.3-rc15



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867333871


##########
docs/src/reference/gremlin-variants.asciidoc:
##########
@@ -1897,3 +1897,300 @@ pip install gremlinpython
 pip install aiohttp
 python example.py
 ----
+
+[[gremlin-go]]
+== Gremlin-Go
+
+image:gremlin-go.png[width=130,float=right] Apache TinkerPop's Gremlin-Go implements Gremlin within the link:https://go.dev/[Go] language and can therefore be used on different operating systems. Go's syntax has the similar constructs as Java including
+"dot notation" for function chaining (`a.b.c`) and round bracket function arguments (`a(b,c)`). Something unlike Java is that Gremlin-Go requires a 
+`gremlingo` prefix when using the namespace (`a(b())` vs `gremlingo.a(gremlingo.__.b())`). Anyone familiar with Gremlin-Java will be able to work
+with Gremlin-Go with relative ease. Moreover, there are a few added constructs to Gremlin-Go that make traversals a bit more
+succinct.
+
+To install the Gremlin-Go as a dependency for your project, run the following in the root directory of your project that contains your `go.mod` file:
+
+[source,bash]
+----
+go get github.com/apache/tinkerpop/gremlin-go/v3[optionally append @<version>, such as @v3.5.3]
+----
+
+[[gremlin-go-connecting]]
+=== 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_()`.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin")
+g := gremlingo.Traversal_().WithRemote(remote)
+----
+
+If you need to additional parameters to connection setup, you can pass in a configuration function.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin",
+  func(settings *DriverRemoteConnectionSettings) {
+    settings.TraversalSource = "gmodern"
+  })
+----
+
+Gremlin-go supports plain text authentication. It can be set in the connection function.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin",
+  func(settings *DriverRemoteConnectionSettings) {
+    settings.TlsConfig = &tls.Config{InsecureSkipVerify: true}
+    settings.AuthInfo = gremlingo.BasicAuthInfo("login", "password")
+  })
+----
+
+If you authenticate to a remote <<connecting-gremlin-server,Gremlin Server>> or
+<<connecting-rgp,Remote Gremlin Provider>>, this server normally has SSL activated and the websockets url will start
+with 'wss://'.
+
+Some connection options can also be set on individual requests made through the using `With()` step on the
+`TraversalSource`. For instance to set request timeout to 500 milliseconds:
+
+[source,go]
+----
+results, err := g.With("evaluationTimeout", 500).V().Out("knows").ToList()
+----
+
+The following options are allowed on a per-request basis in this fashion: `batchSize`, `requestId`, `userAgent` and
+`evaluationTimeout` (formerly `scriptEvaluationTimeout` which is also supported but now deprecated).
+
+anchor:go-imports[]
+[[gremlin-go-imports]]
+=== Common Imports

Review Comment:
   this section should discuss the pattern of aliasing (i.e. assigning to `var`/`const`) to get a more Gremlin like feel:
   
   ```go
   const Local = gremlingo.Local
   var Neq = gremlingo.P.Neq
   var __ = gremlingo.T__
   var In = __.In
   ```
   
   On the subject of naming, I think `T__` has been controversial for a while now but no one has come up with anything groundbreakingly better. The lesser of two evils is to just go with renaming `T__` to the full naming of `AnonymousTraversal` and then using the aliasing above to get it to be `__` like regular Gremlin. Furthermore, I think that enums like `Local` probably need their associated prefixes as in `Scope.Local`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867337004


##########
gremlin-go/driver/performance-tests/java-test/src/main/java/PerformanceTest.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// DO NOT USE - THIS WILL BE DELETED

Review Comment:
   We have a little `util` namespace in `gremlin-driver` where you could tuck this:
   
   https://github.com/apache/tinkerpop/tree/master/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util
   
   then you wouldn't need this random pom.xml.  i'd also add your comments here to the class as javadoc rather than just floating.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] lyndonbauto commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
lyndonbauto commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r869613237


##########
docs/src/reference/gremlin-variants.asciidoc:
##########
@@ -1897,3 +1897,300 @@ pip install gremlinpython
 pip install aiohttp
 python example.py
 ----
+
+[[gremlin-go]]
+== Gremlin-Go
+
+image:gremlin-go.png[width=130,float=right] Apache TinkerPop's Gremlin-Go implements Gremlin within the link:https://go.dev/[Go] language and can therefore be used on different operating systems. Go's syntax has the similar constructs as Java including
+"dot notation" for function chaining (`a.b.c`) and round bracket function arguments (`a(b,c)`). Something unlike Java is that Gremlin-Go requires a 
+`gremlingo` prefix when using the namespace (`a(b())` vs `gremlingo.a(gremlingo.__.b())`). Anyone familiar with Gremlin-Java will be able to work
+with Gremlin-Go with relative ease. Moreover, there are a few added constructs to Gremlin-Go that make traversals a bit more
+succinct.
+
+To install the Gremlin-Go as a dependency for your project, run the following in the root directory of your project that contains your `go.mod` file:
+
+[source,bash]
+----
+go get github.com/apache/tinkerpop/gremlin-go/v3[optionally append @<version>, such as @v3.5.3]
+----
+
+[[gremlin-go-connecting]]
+=== 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_()`.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin")
+g := gremlingo.Traversal_().WithRemote(remote)
+----
+
+If you need to additional parameters to connection setup, you can pass in a configuration function.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin",
+  func(settings *DriverRemoteConnectionSettings) {
+    settings.TraversalSource = "gmodern"
+  })
+----
+
+Gremlin-go supports plain text authentication. It can be set in the connection function.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin",
+  func(settings *DriverRemoteConnectionSettings) {
+    settings.TlsConfig = &tls.Config{InsecureSkipVerify: true}
+    settings.AuthInfo = gremlingo.BasicAuthInfo("login", "password")
+  })
+----
+
+If you authenticate to a remote <<connecting-gremlin-server,Gremlin Server>> or
+<<connecting-rgp,Remote Gremlin Provider>>, this server normally has SSL activated and the websockets url will start
+with 'wss://'.
+
+Some connection options can also be set on individual requests made through the using `With()` step on the
+`TraversalSource`. For instance to set request timeout to 500 milliseconds:
+
+[source,go]
+----
+results, err := g.With("evaluationTimeout", 500).V().Out("knows").ToList()
+----
+
+The following options are allowed on a per-request basis in this fashion: `batchSize`, `requestId`, `userAgent` and
+`evaluationTimeout` (formerly `scriptEvaluationTimeout` which is also supported but now deprecated).
+
+anchor:go-imports[]
+[[gremlin-go-imports]]
+=== Common Imports

Review Comment:
   Both of these things are going to be worked on separately from this ticket, thanks for raising this!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867335676


##########
gremlin-go/README.md:
##########
@@ -22,58 +22,24 @@ for early testing purposes only.
 
 -->
 
-# Getting Started

Review Comment:
   If we follow the pattern of the other README, we find they are fairly minimal and end user focused. Now that reference docs have been added for gremlin-go, I think it would be best to minimize the README contents to use end-user stuff, expand the reference/developer docs where necessary and then link to them from here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] lyndonbauto commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
lyndonbauto commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r869585674


##########
gremlin-go/docker-compose.yml:
##########
@@ -24,6 +24,8 @@ services:
     build:
       context: ../
       dockerfile: gremlin-go/Dockerfile
+      args:
+        NEO4J_VERSION: 3.5.3

Review Comment:
   We will resolve this with the docker stuff we are working on in parallel.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] lyndonbauto commented on pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
lyndonbauto commented on PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#issuecomment-1124234533

   All comments have been either addressed or have been acknowledged with plan to address at later date. 
   
   Future pull requests are going to be incremental against 3.5-dev instead of these bulk milestone based pull requests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] lyndonbauto merged pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
lyndonbauto merged PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867336452


##########
gremlin-go/docker/gremlin-server-integration-secure.yaml:
##########
@@ -20,6 +20,7 @@ port: 45941
 evaluationTimeout: 30000
 graphs: {
   graph: conf/tinkergraph-empty.properties,
+  test: conf/tinkergraph-empty.properties,

Review Comment:
   what is this additional "test" configuration for?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867334607


##########
docs/src/reference/gremlin-variants.asciidoc:
##########
@@ -1897,3 +1897,300 @@ pip install gremlinpython
 pip install aiohttp
 python example.py
 ----
+
+[[gremlin-go]]
+== Gremlin-Go
+
+image:gremlin-go.png[width=130,float=right] Apache TinkerPop's Gremlin-Go implements Gremlin within the link:https://go.dev/[Go] language and can therefore be used on different operating systems. Go's syntax has the similar constructs as Java including
+"dot notation" for function chaining (`a.b.c`) and round bracket function arguments (`a(b,c)`). Something unlike Java is that Gremlin-Go requires a 
+`gremlingo` prefix when using the namespace (`a(b())` vs `gremlingo.a(gremlingo.__.b())`). Anyone familiar with Gremlin-Java will be able to work
+with Gremlin-Go with relative ease. Moreover, there are a few added constructs to Gremlin-Go that make traversals a bit more
+succinct.
+
+To install the Gremlin-Go as a dependency for your project, run the following in the root directory of your project that contains your `go.mod` file:
+
+[source,bash]
+----
+go get github.com/apache/tinkerpop/gremlin-go/v3[optionally append @<version>, such as @v3.5.3]
+----
+
+[[gremlin-go-connecting]]
+=== 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_()`.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin")
+g := gremlingo.Traversal_().WithRemote(remote)
+----
+
+If you need to additional parameters to connection setup, you can pass in a configuration function.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin",
+  func(settings *DriverRemoteConnectionSettings) {
+    settings.TraversalSource = "gmodern"
+  })
+----
+
+Gremlin-go supports plain text authentication. It can be set in the connection function.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin",
+  func(settings *DriverRemoteConnectionSettings) {
+    settings.TlsConfig = &tls.Config{InsecureSkipVerify: true}
+    settings.AuthInfo = gremlingo.BasicAuthInfo("login", "password")
+  })
+----
+
+If you authenticate to a remote <<connecting-gremlin-server,Gremlin Server>> or
+<<connecting-rgp,Remote Gremlin Provider>>, this server normally has SSL activated and the websockets url will start
+with 'wss://'.
+
+Some connection options can also be set on individual requests made through the using `With()` step on the
+`TraversalSource`. For instance to set request timeout to 500 milliseconds:
+
+[source,go]
+----
+results, err := g.With("evaluationTimeout", 500).V().Out("knows").ToList()
+----
+
+The following options are allowed on a per-request basis in this fashion: `batchSize`, `requestId`, `userAgent` and
+`evaluationTimeout` (formerly `scriptEvaluationTimeout` which is also supported but now deprecated).
+
+anchor:go-imports[]
+[[gremlin-go-imports]]
+=== Common Imports
+
+There are a number of classes, functions and tokens that are typically used with Gremlin. The following import
+provide most of the typical functionality required to use Gremlin:
+
+[source,go]
+----
+import (
+	"github.com/apache/tinkerpop/gremlin-go/driver"
+)
+----
+
+These can be used analogously to how they are used in Gremlin-Java.
+
+[source,go]
+----
+results, err := g.V().HasLabel("person").Has("age", gremlingo.T__.Is(gremlingo.P.Gt(30))).Order().By("age", gremlingo.Desc).ToList()
+[v[6], v[4]]
+----
+
+anchor:go-configuration[]
+[[gremlin-go-configuration]]
+=== Configuration
+
+The following table describes the various configuration options for the Gremlin-go Driver. They
+can be passed to the `NewClient` or `NewDriverRemoteConnection` functions as configuration function arguments:
+
+[width="100%",cols="3,10,^2",options="header"]
+|=========================================================
+|Key |Description |Default
+|TraversalSource |Traversal source. |"g"
+|TransporterType |Transporter type. |Gorilla
+|LogVerbosity |Log verbosity.|gremlingo.INFO
+|Logger |Instance of logger. |log
+|Language |Language used for logging messages. |language.English
+|AuthInfo |Authentification info, can be build with BasicAuthInfo() or HeaderAuthInfo(). |empty
+|TlsConfig |TLS configuration. |empty
+|KeepAliveInterval |Keep connection alive interval. |5 seconds
+|WriteDeadline |Write deadline. |3 seconds
+|ConnectionTimeout | Timeout for establishing connection. |45 seconds
+|NewConnectionThreshold | Minimum amount of concurrent active traversals on a connection to trigger creation of a new connection. |4
+|MaximumConcurrentConnections | Maximum number of concurrent connections. |number of runtime processors
+|EnableCompression |Flag to enable compression. |false
+|ReadBufferSize |Specify I/O buffer sizes in bytes. If a buffer size is zero, then a useful default size is used |0
+|WriteBufferSize |Specify I/O buffer sizes in bytes. If a buffer size is zero, then a useful default size is used |0
+|Session |Session ID. |""
+|=========================================================
+
+[[gremlin-go-strategies]]
+=== Traversal Strategies
+
+In order to add and remove <<traversalstrategy,traversal strategies>> from a traversal source, Gremlin-Go has a
+`TraversalStrategy` interface along with a collection of functions that mirror the standard Gremlin-Java strategies.
+
+[source,go]
+----
+promise := g.WithStrategies(gremlingo.ReadOnlyStrategy()).AddV("person").Property("name", "foo").Iterate()
+----
+
+NOTE: Many of the `TraversalStrategy` classes in Gremlin-Go are proxies to the respective strategy on
+Apache TinkerPop's JVM-based Gremlin traversal machine. As such, their `apply(Traversal)` method does nothing. However,
+the strategy is encoded in the Gremlin-Go bytecode and transmitted to the Gremlin traversal machine for
+re-construction machine-side.
+
+[[gremlin-go-transactions]]
+=== Transactions
+
+To get a full understanding of this section, it would be good to start by reading the <<transactions,Transactions>>
+section of this documentation, which discusses transactions in the general context of TinkerPop itself. This section
+builds on that content by demonstrating the transactional syntax for Go.
+
+[source,go]
+----
+remote, err := NewDriverRemoteConnection("ws://localhost:8182/gremlin")
+g := gremlingo.Traversal_().WithRemote(remote)
+
+// Create a Transaction.
+tx := g.Tx()
+
+// Spawn a new GraphTraversalSource, binding all traversals established from it to tx.
+gtx, _ := tx.Begin()
+
+// Execute a traversal within the transaction.
+promise := g.AddV("person").Property("name", "Lyndon").Iterate()
+err := <-promise
+
+if err != nil {
+  // Rollback the transaction if an error occurs.
+  tx.rollback()
+} else {
+  // Commit the transaction. The transaction can no longer be used and cannot be re-used.
+  // A new transaction can be spawned through g.Tx().
+  tx.Commit()
+}
+----
+
+[[gremlin-go-lambda]]
+=== The Lambda Solution
+
+Supporting link:https://en.wikipedia.org/wiki/Anonymous_function[anonymous functions] across languages is difficult as
+most languages do not support lambda introspection and thus, code analysis. In Gremlin-Go, a Gremlin lambda should
+be represented as a zero-arg callable that returns a string representation of the lambda expected for use in the
+traversal. The lambda should be written as a `Gremlin-Groovy` string. 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.
+
+[source,go]
+----
+r, err := g.V().Out().Map(&gremlingo.Lambda{Script: "it.get().value('name').length()", Language: ""}).Sum().ToList()		
+----
+
+TIP: When running into situations where Groovy cannot properly discern a method signature based on the `Lambda`
+instance created, it will help to fully define the closure in the lambda expression - so rather than
+`Script: "it.get().value('name')", Language: "gremlin-groovy"`, prefer `Script: "x -> x.get().value('name')", Language: "gremlin-groovy"`.
+
+Finally, Gremlin `Bytecode` that includes lambdas requires that the traversal be processed by the
+`ScriptEngine`. To avoid continued recompilation costs, it supports the encoding of bindings, which allow a remote
+engine to 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.
+
+[source,go]
+----
+r, err := g.V((&gremlingo.Bindings{}).Of("x", 1)).Out("created").Map(&gremlingo.Lambda{Script: "it.get().value('name').length()", Language: ""}).Sum().ToList()
+// 3
+r, err := g.V((&gremlingo.Bindings{}).Of("x", 4)).Out("created").Map(&gremlingo.Lambda{Script: "it.get().value('name').length()", Language: ""}).Sum().ToList()
+// 9
+----
+
+WARNING: As explained throughout the documentation, when possible <<a-note-on-lambdas,avoid>> lambdas.
+
+[[gremlin-go-scripts]]
+=== Submitting Scripts
+
+The `Client` class implementation/interface is based on the Java Driver, with some restrictions. Most notably,
+Gremlin-go does not yet implement the `Cluster` class. Instead, `Client` is instantiated directly.
+Usage is as follows:
+
+[source,go]
+----
+import "github.com/apache/tinkerpop/gremlin-go/v3/driver" <1>
+client, err := gremlingo.NewClient("ws://localhost:8182/gremlin") <2>
+----
+
+<1> Import the Gremlin-Go module.
+<2> Opens a reference to `localhost` - note that there are various configuration options that can be passed
+to the `Client` object upon instantiation as keyword arguments.
+
+Once a `Client` instance is ready, it is possible to issue some Gremlin:
+
+[source,go] //todo: clarify replacement one with One
+----
+resultSet, err := client.Submit("g.V().count()") <1>
+result, err := resultSet.All() <2>
+fmt.Println(result[0].GetString()) <3>
+----
+
+<1> Submit a script that simply returns a Count of vertexes.  
+<2> Get results from resultSet. Block until the the script is evaluated and results are sent back by the server.
+<3> Use the result.
+
+==== Per Request Settings
+
+The `client.Submit()` functions accept a `bindings` which expects a map. The `bindings` provide a way to include options
+that are specific to the request made with the call to `Submit()`. A good use-case for this feature is to set a per-request
+override to the `evaluationTimeout` so that it only applies to the current request.
+
+[source,go]
+----
+resultSet, err := client.Submit("g.V().repeat(both()).times(100)", map[string]interface{}{"evaluationTimeout": 5000})
+----
+
+The following options are allowed on a per-request basis in this fashion: `batchSize`, `requestId`, `userAgent` and
+`evaluationTimeout` (formerly `scriptEvaluationTimeout` which is also supported but now deprecated).
+
+IMPORTANT: The preferred method for setting a per-request timeout for scripts is demonstrated above, but those familiar
+with bytecode may try `g.with("evaluationTimeout", 500)` within a script. Scripts with multiple traversals and multiple
+timeouts will be interpreted as a sum of all timeouts identified in the script for that request.
+
+[source,go]
+----
+resultSet, err := client.Submit("g.with('evaluationTimeout', 500).addV().iterate();"+
+  "g.addV().iterate();"+
+  "g.with('evaluationTimeout', 500).addV();", map[string]interface{}{"evaluationTimeout": 500})
+results, err := resultSet.All()
+----
+
+In the above example, defines a timeout of 500 milliseconds, but the script has three traversals with
+two internal settings for the timeout using `with()`. The request timeout used by the server will therefore be 1000
+milliseconds (overriding the 500 which itself was an override for whatever configuration was on the server).
+
+[[gremlin-go-differences]]
+=== Differences
+
+In situations where Go reserved words and global functions overlap with standard Gremlin steps and tokens, those
+bits of conflicting Gremlin get an underscore appended as a suffix. In addition, all function names start with a 
+capital letter in order to be public:
+
+*Steps* - <<and-step,And()>>, <<as-step,As()>>, <<filter-step,Filter()>>, <<from-step,From()>>, <<id-step,Id()>>,
+<<is-step,Is()>>, <<in-step,In()>>, <<max-step,Max()>>, <<min-step,Min()>>, <<not-step,Not()>>, <<or-step,Or()>>,
+<<range-step,Range()>>, <<sum-step,Sum()>>, <<with-step,With()>>
+
+*Tokens* - <<a-note-on-scopes,Scope.Global>>, <<a-note-on-scopes,Scope.Local>>
+
+*Statics* - <<__, T__>> // todo: impove 
+
+[[gremlin-go-limitations]]
+=== Limitations
+
+* There is no default `set` type in Go. Any set type code from server will be deserialized into slices with the list 
+type implementation. To input a set into Gremlin-Go, a custom struct which implements the `gremlingo.Set` interface 
+will be serialized as a set. `gremlingo.NewSimpleSet` is a basic implementation of a set that is provided by Gremlin-Go 
+that can be used to fulfill the `gremlingo.Set` interface if desired.
+* The `path` data type serialization is currently incomplete as labels are represented as list of lists instead of list 
+of sets. Fully functional Path serialization will be implemented when set is implemented in the next milestone. Path 
+can be successfully deserialized.
+* Traversal step functions currently take `string` arguments with double quotes only. Operations using Gremlin keywords,

Review Comment:
   is this still true? how are the gherkin tests passing - we surely have a `by(T.label)` somewhere in those tests?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867335025


##########
docs/src/reference/gremlin-variants.asciidoc:
##########
@@ -1897,3 +1897,300 @@ pip install gremlinpython
 pip install aiohttp
 python example.py
 ----
+
+[[gremlin-go]]

Review Comment:
   looks like this was added to the end of the document. the languages are in alphabetical order now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] spmallette commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
spmallette commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r867335965


##########
gremlin-go/docker-compose.yml:
##########
@@ -24,6 +24,8 @@ services:
     build:
       context: ../
       dockerfile: gremlin-go/Dockerfile
+      args:
+        NEO4J_VERSION: 3.5.3

Review Comment:
   hardcoding to a previous version isn't going to work. tests should run against the most recent build (i.e. whatever is in the current top-level pom.xml).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tinkerpop] lyndonbauto commented on a diff in pull request #1639: Gremlin Go Milestone 6

Posted by GitBox <gi...@apache.org>.
lyndonbauto commented on code in PR #1639:
URL: https://github.com/apache/tinkerpop/pull/1639#discussion_r869623954


##########
docs/src/reference/gremlin-variants.asciidoc:
##########
@@ -1897,3 +1897,300 @@ pip install gremlinpython
 pip install aiohttp
 python example.py
 ----
+
+[[gremlin-go]]
+== Gremlin-Go
+
+image:gremlin-go.png[width=130,float=right] Apache TinkerPop's Gremlin-Go implements Gremlin within the link:https://go.dev/[Go] language and can therefore be used on different operating systems. Go's syntax has the similar constructs as Java including
+"dot notation" for function chaining (`a.b.c`) and round bracket function arguments (`a(b,c)`). Something unlike Java is that Gremlin-Go requires a 
+`gremlingo` prefix when using the namespace (`a(b())` vs `gremlingo.a(gremlingo.__.b())`). Anyone familiar with Gremlin-Java will be able to work
+with Gremlin-Go with relative ease. Moreover, there are a few added constructs to Gremlin-Go that make traversals a bit more
+succinct.
+
+To install the Gremlin-Go as a dependency for your project, run the following in the root directory of your project that contains your `go.mod` file:
+
+[source,bash]
+----
+go get github.com/apache/tinkerpop/gremlin-go/v3[optionally append @<version>, such as @v3.5.3]
+----
+
+[[gremlin-go-connecting]]
+=== 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_()`.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin")
+g := gremlingo.Traversal_().WithRemote(remote)
+----
+
+If you need to additional parameters to connection setup, you can pass in a configuration function.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin",
+  func(settings *DriverRemoteConnectionSettings) {
+    settings.TraversalSource = "gmodern"
+  })
+----
+
+Gremlin-go supports plain text authentication. It can be set in the connection function.
+
+[source,go]
+----
+remote, err := gremlingo.NewDriverRemoteConnection("ws://localhost:8182/gremlin",
+  func(settings *DriverRemoteConnectionSettings) {
+    settings.TlsConfig = &tls.Config{InsecureSkipVerify: true}
+    settings.AuthInfo = gremlingo.BasicAuthInfo("login", "password")
+  })
+----
+
+If you authenticate to a remote <<connecting-gremlin-server,Gremlin Server>> or
+<<connecting-rgp,Remote Gremlin Provider>>, this server normally has SSL activated and the websockets url will start
+with 'wss://'.
+
+Some connection options can also be set on individual requests made through the using `With()` step on the
+`TraversalSource`. For instance to set request timeout to 500 milliseconds:
+
+[source,go]
+----
+results, err := g.With("evaluationTimeout", 500).V().Out("knows").ToList()
+----
+
+The following options are allowed on a per-request basis in this fashion: `batchSize`, `requestId`, `userAgent` and
+`evaluationTimeout` (formerly `scriptEvaluationTimeout` which is also supported but now deprecated).
+
+anchor:go-imports[]
+[[gremlin-go-imports]]
+=== Common Imports
+
+There are a number of classes, functions and tokens that are typically used with Gremlin. The following import
+provide most of the typical functionality required to use Gremlin:
+
+[source,go]
+----
+import (
+	"github.com/apache/tinkerpop/gremlin-go/driver"
+)
+----
+
+These can be used analogously to how they are used in Gremlin-Java.
+
+[source,go]
+----
+results, err := g.V().HasLabel("person").Has("age", gremlingo.T__.Is(gremlingo.P.Gt(30))).Order().By("age", gremlingo.Desc).ToList()
+[v[6], v[4]]
+----
+
+anchor:go-configuration[]
+[[gremlin-go-configuration]]
+=== Configuration
+
+The following table describes the various configuration options for the Gremlin-go Driver. They
+can be passed to the `NewClient` or `NewDriverRemoteConnection` functions as configuration function arguments:
+
+[width="100%",cols="3,10,^2",options="header"]
+|=========================================================
+|Key |Description |Default
+|TraversalSource |Traversal source. |"g"
+|TransporterType |Transporter type. |Gorilla
+|LogVerbosity |Log verbosity.|gremlingo.INFO
+|Logger |Instance of logger. |log
+|Language |Language used for logging messages. |language.English
+|AuthInfo |Authentification info, can be build with BasicAuthInfo() or HeaderAuthInfo(). |empty
+|TlsConfig |TLS configuration. |empty
+|KeepAliveInterval |Keep connection alive interval. |5 seconds
+|WriteDeadline |Write deadline. |3 seconds
+|ConnectionTimeout | Timeout for establishing connection. |45 seconds
+|NewConnectionThreshold | Minimum amount of concurrent active traversals on a connection to trigger creation of a new connection. |4
+|MaximumConcurrentConnections | Maximum number of concurrent connections. |number of runtime processors
+|EnableCompression |Flag to enable compression. |false
+|ReadBufferSize |Specify I/O buffer sizes in bytes. If a buffer size is zero, then a useful default size is used |0
+|WriteBufferSize |Specify I/O buffer sizes in bytes. If a buffer size is zero, then a useful default size is used |0
+|Session |Session ID. |""
+|=========================================================
+
+[[gremlin-go-strategies]]
+=== Traversal Strategies
+
+In order to add and remove <<traversalstrategy,traversal strategies>> from a traversal source, Gremlin-Go has a
+`TraversalStrategy` interface along with a collection of functions that mirror the standard Gremlin-Java strategies.
+
+[source,go]
+----
+promise := g.WithStrategies(gremlingo.ReadOnlyStrategy()).AddV("person").Property("name", "foo").Iterate()
+----
+
+NOTE: Many of the `TraversalStrategy` classes in Gremlin-Go are proxies to the respective strategy on
+Apache TinkerPop's JVM-based Gremlin traversal machine. As such, their `apply(Traversal)` method does nothing. However,
+the strategy is encoded in the Gremlin-Go bytecode and transmitted to the Gremlin traversal machine for
+re-construction machine-side.
+
+[[gremlin-go-transactions]]
+=== Transactions
+
+To get a full understanding of this section, it would be good to start by reading the <<transactions,Transactions>>
+section of this documentation, which discusses transactions in the general context of TinkerPop itself. This section
+builds on that content by demonstrating the transactional syntax for Go.
+
+[source,go]
+----
+remote, err := NewDriverRemoteConnection("ws://localhost:8182/gremlin")
+g := gremlingo.Traversal_().WithRemote(remote)
+
+// Create a Transaction.
+tx := g.Tx()
+
+// Spawn a new GraphTraversalSource, binding all traversals established from it to tx.
+gtx, _ := tx.Begin()
+
+// Execute a traversal within the transaction.
+promise := g.AddV("person").Property("name", "Lyndon").Iterate()
+err := <-promise
+
+if err != nil {
+  // Rollback the transaction if an error occurs.
+  tx.rollback()
+} else {
+  // Commit the transaction. The transaction can no longer be used and cannot be re-used.
+  // A new transaction can be spawned through g.Tx().
+  tx.Commit()
+}
+----
+
+[[gremlin-go-lambda]]
+=== The Lambda Solution
+
+Supporting link:https://en.wikipedia.org/wiki/Anonymous_function[anonymous functions] across languages is difficult as
+most languages do not support lambda introspection and thus, code analysis. In Gremlin-Go, a Gremlin lambda should
+be represented as a zero-arg callable that returns a string representation of the lambda expected for use in the
+traversal. The lambda should be written as a `Gremlin-Groovy` string. 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.
+
+[source,go]
+----
+r, err := g.V().Out().Map(&gremlingo.Lambda{Script: "it.get().value('name').length()", Language: ""}).Sum().ToList()		
+----
+
+TIP: When running into situations where Groovy cannot properly discern a method signature based on the `Lambda`
+instance created, it will help to fully define the closure in the lambda expression - so rather than
+`Script: "it.get().value('name')", Language: "gremlin-groovy"`, prefer `Script: "x -> x.get().value('name')", Language: "gremlin-groovy"`.
+
+Finally, Gremlin `Bytecode` that includes lambdas requires that the traversal be processed by the
+`ScriptEngine`. To avoid continued recompilation costs, it supports the encoding of bindings, which allow a remote
+engine to 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.
+
+[source,go]
+----
+r, err := g.V((&gremlingo.Bindings{}).Of("x", 1)).Out("created").Map(&gremlingo.Lambda{Script: "it.get().value('name').length()", Language: ""}).Sum().ToList()
+// 3
+r, err := g.V((&gremlingo.Bindings{}).Of("x", 4)).Out("created").Map(&gremlingo.Lambda{Script: "it.get().value('name').length()", Language: ""}).Sum().ToList()
+// 9
+----
+
+WARNING: As explained throughout the documentation, when possible <<a-note-on-lambdas,avoid>> lambdas.
+
+[[gremlin-go-scripts]]
+=== Submitting Scripts
+
+The `Client` class implementation/interface is based on the Java Driver, with some restrictions. Most notably,
+Gremlin-go does not yet implement the `Cluster` class. Instead, `Client` is instantiated directly.
+Usage is as follows:
+
+[source,go]
+----
+import "github.com/apache/tinkerpop/gremlin-go/v3/driver" <1>
+client, err := gremlingo.NewClient("ws://localhost:8182/gremlin") <2>
+----
+
+<1> Import the Gremlin-Go module.
+<2> Opens a reference to `localhost` - note that there are various configuration options that can be passed
+to the `Client` object upon instantiation as keyword arguments.
+
+Once a `Client` instance is ready, it is possible to issue some Gremlin:
+
+[source,go] //todo: clarify replacement one with One
+----
+resultSet, err := client.Submit("g.V().count()") <1>
+result, err := resultSet.All() <2>
+fmt.Println(result[0].GetString()) <3>
+----
+
+<1> Submit a script that simply returns a Count of vertexes.  
+<2> Get results from resultSet. Block until the the script is evaluated and results are sent back by the server.
+<3> Use the result.
+
+==== Per Request Settings
+
+The `client.Submit()` functions accept a `bindings` which expects a map. The `bindings` provide a way to include options
+that are specific to the request made with the call to `Submit()`. A good use-case for this feature is to set a per-request
+override to the `evaluationTimeout` so that it only applies to the current request.
+
+[source,go]
+----
+resultSet, err := client.Submit("g.V().repeat(both()).times(100)", map[string]interface{}{"evaluationTimeout": 5000})
+----
+
+The following options are allowed on a per-request basis in this fashion: `batchSize`, `requestId`, `userAgent` and
+`evaluationTimeout` (formerly `scriptEvaluationTimeout` which is also supported but now deprecated).
+
+IMPORTANT: The preferred method for setting a per-request timeout for scripts is demonstrated above, but those familiar
+with bytecode may try `g.with("evaluationTimeout", 500)` within a script. Scripts with multiple traversals and multiple
+timeouts will be interpreted as a sum of all timeouts identified in the script for that request.
+
+[source,go]
+----
+resultSet, err := client.Submit("g.with('evaluationTimeout', 500).addV().iterate();"+
+  "g.addV().iterate();"+
+  "g.with('evaluationTimeout', 500).addV();", map[string]interface{}{"evaluationTimeout": 500})
+results, err := resultSet.All()
+----
+
+In the above example, defines a timeout of 500 milliseconds, but the script has three traversals with
+two internal settings for the timeout using `with()`. The request timeout used by the server will therefore be 1000
+milliseconds (overriding the 500 which itself was an override for whatever configuration was on the server).
+
+[[gremlin-go-differences]]
+=== Differences
+
+In situations where Go reserved words and global functions overlap with standard Gremlin steps and tokens, those
+bits of conflicting Gremlin get an underscore appended as a suffix. In addition, all function names start with a 
+capital letter in order to be public:
+
+*Steps* - <<and-step,And()>>, <<as-step,As()>>, <<filter-step,Filter()>>, <<from-step,From()>>, <<id-step,Id()>>,
+<<is-step,Is()>>, <<in-step,In()>>, <<max-step,Max()>>, <<min-step,Min()>>, <<not-step,Not()>>, <<or-step,Or()>>,
+<<range-step,Range()>>, <<sum-step,Sum()>>, <<with-step,With()>>
+
+*Tokens* - <<a-note-on-scopes,Scope.Global>>, <<a-note-on-scopes,Scope.Local>>
+
+*Statics* - <<__, T__>> // todo: impove 
+
+[[gremlin-go-limitations]]
+=== Limitations
+
+* There is no default `set` type in Go. Any set type code from server will be deserialized into slices with the list 
+type implementation. To input a set into Gremlin-Go, a custom struct which implements the `gremlingo.Set` interface 
+will be serialized as a set. `gremlingo.NewSimpleSet` is a basic implementation of a set that is provided by Gremlin-Go 
+that can be used to fulfill the `gremlingo.Set` interface if desired.
+* The `path` data type serialization is currently incomplete as labels are represented as list of lists instead of list 
+of sets. Fully functional Path serialization will be implemented when set is implemented in the next milestone. Path 
+can be successfully deserialized.
+* Traversal step functions currently take `string` arguments with double quotes only. Operations using Gremlin keywords,

Review Comment:
   There are outdated, will remove



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org