Skip to content

Commit

Permalink
Merge branch '3.6-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Cole-Greer committed Aug 31, 2023
2 parents 02973f2 + 91e033f commit 397eff0
Show file tree
Hide file tree
Showing 4 changed files with 1,110 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ This release also includes changes from <<release-3-5-8, 3.5.8>>.
* Allowed `gremlin-driver` to be used over HTTP for experimental purposes.
* Deprecated the `HandshakeInterceptor` in favor of a more generic `RequestInterceptor`.
* Fix a bug in `StarGraph` where `EdgeFilter` did not remove associated Edge Properties
* Added translator to the Go GLV
[[release-3-6-5]]
=== TinkerPop 3.6.5 (Release Date: July 31, 2023)
Expand Down
31 changes: 24 additions & 7 deletions docs/src/reference/the-traversal.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5479,14 +5479,15 @@ therefore allows Gremlin to be converted from the host programming language of t
The following translators are available, where the first column identifies the host programming language and the
columns represent the language that Gremlin can be generated in:
[width="100%",cols="<,^,^,^,^,^",options="header"]
[width="100%",cols="<,^,^,^,^,^,^",options="header"]
|=========================================================
| |Java |Groovy |Javascript |.NET |Python
|*Java* |- |X |X |X |X
|*Groovy* | |X |X | |X
|*Javascript* | |X |- | |
|*.NET* | |X | |- |
|*Python* | |X | | |-
| |Java |Groovy |Javascript |.NET |Python |Go
|*Java* |- |X |X |X |X |X
|*Groovy* | |X |X | |X |
|*Javascript* | |X |- | | |
|*.NET* | |X | |- | |
|*Python* | |X | | |- |
|*Go* | |X | | | |-
|=========================================================
Each programming language has its own API for translation, but the pattern is quite similar from one to the next:
Expand Down Expand Up @@ -5520,6 +5521,10 @@ System.out.println(pythonTranslator.translate(t).getScript());
Translator.ScriptTranslator javascriptTranslator = JavascriptTranslator.of("g");
System.out.println(javascriptTranslator.translate(t).getScript());
// OUTPUT: g.V().has("person","name","marko").where(__.in_("knows")).values("age").map(() => "it.get() + 1")
Translator.ScriptTranslator golangTranslator = GolangTranslator.of("g");
System.out.println(golangTranslator.translate(t).getScript());
// OUTPUT: g.V().Has("person", "name", "marko").Where(gremlingo.T__.In("knows")).Values("age").Map(&gremlingo.Lambda{Script:"it.get() + 1", Language:""})
----
[source,javascript]
----
Expand Down Expand Up @@ -5557,6 +5562,18 @@ var translator = GroovyTranslator.Of("g");
Console.WriteLine(translator.Translate(t));
// OUTPUT: g.V().has('person', 'name', 'marko').where(__.in('knows')).values('age')
----
[source,go]
----
g := ...
t := g.V().Has("person", "name", "marko").
Where(T__.In("knows")).
Values("age")
// Groovy
translator := NewTranslator("g")
print(translator.Translate(t.Bytecode))
// OUTPUT: g.V().has('person','name','marko').where(in('knows')).values('age')
----
The JVM-based translator has the added option of parameter extraction, where the translation process will attempt to
identify opportunities to generate an output that would replace constant values with parameters. The parameters would
Expand Down
Loading

0 comments on commit 397eff0

Please sign in to comment.