You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by co...@apache.org on 2025/05/05 23:55:23 UTC
(tinkerpop) branch master updated (e3e5c97a44 -> 32a7fa51a1)
This is an automated email from the ASF dual-hosted git repository.
colegreer pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
from e3e5c97a44 Merge branch '3.8-dev'
add 35a1eac8bc TINKERPOP-3023 Implement UUID in gremlin-lang which should have two forms: UUID() and UUID(“uuid”) (#3112)
new 32a7fa51a1 Merge branch '3.8-dev'
The 1 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 | 1 +
.../grammar/DefaultGremlinBaseVisitor.java | 12 +++--
.../language/grammar/GenericLiteralVisitor.java | 18 ++++++++
.../translator/AnonymizedTranslatorVisitor.java | 3 ++
.../translator/DotNetTranslateVisitor.java | 12 +++++
.../language/translator/GoTranslateVisitor.java | 12 +++++
.../translator/JavascriptTranslateVisitor.java | 10 +++++
.../translator/PythonTranslateVisitor.java | 12 +++++
.../language/translator/TranslateVisitor.java | 6 +++
.../language/translator/GremlinTranslatorTest.java | 18 ++++++++
.../Gherkin/CommonSteps.cs | 10 +++++
.../Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs | 17 +++++++
gremlin-go/build/generate.groovy | 1 +
gremlin-go/driver/cucumber/cucumberSteps_test.go | 52 +++++++++++++---------
gremlin-go/driver/cucumber/gremlin.go | 18 ++++++++
gremlin-javascript/build/generate.groovy | 1 +
.../test/cucumber/feature-steps.js | 5 +++
.../gremlin-javascript/test/cucumber/gremlin.js | 3 ++
gremlin-language/src/main/antlr4/Gremlin.g4 | 14 ++++++
gremlin-python/build/generate.groovy | 1 +
.../src/main/python/radish/feature_steps.py | 4 ++
gremlin-python/src/main/python/radish/gremlin.py | 3 ++
.../gremlin/server/GremlinDriverIntegrateTest.java | 20 +++++++++
.../tinkerpop/gremlin/features/StepDefinition.java | 4 +-
.../Uuid.feature} | 25 +++++------
25 files changed, 244 insertions(+), 38 deletions(-)
copy gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/{integrated/LazyBarrierStrategy.feature => sideEffect/Uuid.feature} (65%)
(tinkerpop) 01/01: Merge branch '3.8-dev'
Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
colegreer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 32a7fa51a1b7291729799a39cff9a1bc3d7cb89d
Merge: e3e5c97a44 35a1eac8bc
Author: Cole-Greer <Co...@improving.com>
AuthorDate: Mon May 5 16:55:07 2025 -0700
Merge branch '3.8-dev'
CHANGELOG.asciidoc | 1 +
.../grammar/DefaultGremlinBaseVisitor.java | 12 +++--
.../language/grammar/GenericLiteralVisitor.java | 18 ++++++++
.../translator/AnonymizedTranslatorVisitor.java | 3 ++
.../translator/DotNetTranslateVisitor.java | 12 +++++
.../language/translator/GoTranslateVisitor.java | 12 +++++
.../translator/JavascriptTranslateVisitor.java | 10 +++++
.../translator/PythonTranslateVisitor.java | 12 +++++
.../language/translator/TranslateVisitor.java | 6 +++
.../language/translator/GremlinTranslatorTest.java | 18 ++++++++
.../Gherkin/CommonSteps.cs | 10 +++++
.../Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs | 17 +++++++
gremlin-go/build/generate.groovy | 1 +
gremlin-go/driver/cucumber/cucumberSteps_test.go | 52 +++++++++++++---------
gremlin-go/driver/cucumber/gremlin.go | 18 ++++++++
gremlin-javascript/build/generate.groovy | 1 +
.../test/cucumber/feature-steps.js | 5 +++
.../gremlin-javascript/test/cucumber/gremlin.js | 3 ++
gremlin-language/src/main/antlr4/Gremlin.g4 | 14 ++++++
gremlin-python/build/generate.groovy | 1 +
.../src/main/python/radish/feature_steps.py | 4 ++
gremlin-python/src/main/python/radish/gremlin.py | 3 ++
.../gremlin/server/GremlinDriverIntegrateTest.java | 20 +++++++++
.../tinkerpop/gremlin/features/StepDefinition.java | 4 +-
.../gremlin/test/features/sideEffect/Uuid.feature | 41 +++++++++++++++++
25 files changed, 273 insertions(+), 25 deletions(-)
diff --cc gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs
index 384dbf3ff9,1b6de4dddd..690f2750fc
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs
@@@ -1688,6 -1673,20 +1688,23 @@@ namespace Gremlin.Net.IntegrationTest.G
{"g_withSideEffectXa_setX_V_both_name_storeXaX_capXaX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithSideEffect("a", p["xx1"]).V().Both().Values<object>("name").Store("a").Cap<object>("a")}},
{"g_withSideEffectXa_set_inlineX_V_both_name_storeXaX_capXaX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithSideEffect("a", new HashSet<object> { "alice" }).V().Both().Values<object>("name").Store("a").Cap<object>("a")}},
{"g_V_storeXaX_byXoutEXcreatedX_countX_out_out_storeXaX_byXinEXcreatedX_weight_sumX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Store("a").By(__.OutE("created").Count()).Out().Out().Store("a").By(__.InE("created").Values<object>("weight").Sum<object>()).Cap<object>("a")}},
++<<<<<<< HEAD
++=======
+ {"g_VX1X_outEXknowsX_subgraphXsgX_name_capXsgX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V(p["vid1"]).OutE("knows").Subgraph("sg").Values<object>("name").Cap<object>("sg")}},
+ {"g_V_repeatXbothEXcreatedX_subgraphXsgX_outVX_timesX5X_name_dedup_capXsgX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Repeat(__.BothE("created").Subgraph("sg").OutV()).Times(5).Values<object>("name").Dedup().Cap<object>("sg")}},
+ {"g_V_outEXnoexistX_subgraphXsgXcapXsgX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().OutE("noexist").Subgraph("sg").Cap<object>("sg")}},
+ {"g_VX1X_out_out_tree_byXnameX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V(p["vid1"]).Out().Out().Tree<object>().By("name")}},
+ {"g_VX1X_out_out_tree", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V(p["vid1"]).Out().Out().Tree<object>()}},
+ {"g_V_out_tree_byXageX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Out().Tree<object>().By("age")}},
+ {"g_VX1X_out_out_treeXaX_byXnameX_both_both_capXaX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V(p["vid1"]).Out().Out().Tree("a").By("name").Both().Both().Cap<object>("a")}},
+ {"g_VX1X_out_out_treeXaX_both_both_capXaX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V(p["vid1"]).Out().Out().Tree("a").Both().Both().Cap<object>("a")}},
+ {"g_VX1X_out_out_tree_byXlabelX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V(p["vid1"]).Out().Out().Tree<object>().By(T.Label)}},
+ {"g_VX1X_out_out_treeXaX_byXlabelX_both_both_capXaX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V(p["vid1"]).Out().Out().Tree("a").By(T.Label).Both().Both().Cap<object>("a")}},
+ {"g_VX1X_out_out_out_tree", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Out().Out().Out().Tree<object>()}},
+ {"g_VX1X_outE_inV_bothE_otherV_tree", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V(p["vid1"]).OutE().InV().BothE().OtherV().Tree<object>()}},
+ {"g_VX1X_outE_inV_bothE_otherV_tree_byXnameX_byXlabelX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V(p["vid1"]).OutE().InV().BothE().OtherV().Tree<object>().By("name").By(T.Label)}},
+ {"g_injectXUUIDX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>(Guid.Parse("f47af10b-58cc-4372-a567-0f02b2f3d479"))}},
++>>>>>>> 3.8-dev
};
public static ITraversal UseTraversal(string scenarioName, GraphTraversalSource g, IDictionary<string, object> parameters)
diff --cc gremlin-go/driver/cucumber/gremlin.go
index d7ef1358d2,d232db2a9e..934010d1da
--- a/gremlin-go/driver/cucumber/gremlin.go
+++ b/gremlin-go/driver/cucumber/gremlin.go
@@@ -1661,6 -1643,20 +1662,23 @@@ var translationMap = map[string][]func(
"g_withSideEffectXa_setX_V_both_name_storeXaX_capXaX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithSideEffect("a", p["xx1"]).V().Both().Values("name").Store("a").Cap("a")}},
"g_withSideEffectXa_set_inlineX_V_both_name_storeXaX_capXaX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithSideEffect("a", gremlingo.NewSimpleSet("alice")).V().Both().Values("name").Store("a").Cap("a")}},
"g_V_storeXaX_byXoutEXcreatedX_countX_out_out_storeXaX_byXinEXcreatedX_weight_sumX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Store("a").By(gremlingo.T__.OutE("created").Count()).Out().Out().Store("a").By(gremlingo.T__.InE("created").Values("weight").Sum()).Cap("a")}},
++<<<<<<< HEAD
++=======
+ "g_VX1X_outEXknowsX_subgraphXsgX_name_capXsgX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V(p["vid1"]).OutE("knows").Subgraph("sg").Values("name").Cap("sg")}},
+ "g_V_repeatXbothEXcreatedX_subgraphXsgX_outVX_timesX5X_name_dedup_capXsgX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Repeat(gremlingo.T__.BothE("created").Subgraph("sg").OutV()).Times(5).Values("name").Dedup().Cap("sg")}},
+ "g_V_outEXnoexistX_subgraphXsgXcapXsgX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().OutE("noexist").Subgraph("sg").Cap("sg")}},
+ "g_VX1X_out_out_tree_byXnameX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V(p["vid1"]).Out().Out().Tree().By("name")}},
+ "g_VX1X_out_out_tree": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V(p["vid1"]).Out().Out().Tree()}},
+ "g_V_out_tree_byXageX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Out().Tree().By("age")}},
+ "g_VX1X_out_out_treeXaX_byXnameX_both_both_capXaX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V(p["vid1"]).Out().Out().Tree("a").By("name").Both().Both().Cap("a")}},
+ "g_VX1X_out_out_treeXaX_both_both_capXaX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V(p["vid1"]).Out().Out().Tree("a").Both().Both().Cap("a")}},
+ "g_VX1X_out_out_tree_byXlabelX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V(p["vid1"]).Out().Out().Tree().By(gremlingo.T.Label)}},
+ "g_VX1X_out_out_treeXaX_byXlabelX_both_both_capXaX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V(p["vid1"]).Out().Out().Tree("a").By(gremlingo.T.Label).Both().Both().Cap("a")}},
+ "g_VX1X_out_out_out_tree": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Out().Out().Out().Tree()}},
+ "g_VX1X_outE_inV_bothE_otherV_tree": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V(p["vid1"]).OutE().InV().BothE().OtherV().Tree()}},
+ "g_VX1X_outE_inV_bothE_otherV_tree_byXnameX_byXlabelX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V(p["vid1"]).OutE().InV().BothE().OtherV().Tree().By("name").By(gremlingo.T.Label)}},
+ "g_injectXUUIDX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(uuid.MustParse("f47af10b-58cc-4372-a567-0f02b2f3d479"))}},
++>>>>>>> 3.8-dev
}
func GetTraversal(scenarioName string, g *gremlingo.GraphTraversalSource, parameters map[string]interface{}) (*gremlingo.GraphTraversal, error) {
diff --cc gremlin-javascript/build/generate.groovy
index 2ee326bd3c,9d04bc3e1b..8e7872a74c
--- a/gremlin-javascript/build/generate.groovy
+++ b/gremlin-javascript/build/generate.groovy
@@@ -54,9 -54,10 +54,10 @@@ radishGremlinFile.withWriter('UTF-8')
writer.writeLine("//********************************************************************************\n\n")
writer.writeLine(
- 'const uuid = require(\'uuid\');\n' +
- 'const graphTraversalModule = require(\'../../lib/process/graph-traversal\');\n' +
- 'const traversalModule = require(\'../../lib/process/traversal\');\n' +
- 'const { TraversalStrategies, VertexProgramStrategy, OptionsStrategy, PartitionStrategy, \n' +
+ 'import * as graphTraversalModule from \'../../lib/process/graph-traversal.js\';\n' +
+ 'import * as traversalModule from \'../../lib/process/traversal.js\';\n' +
++ 'import * as uuid from \'uuid\';\n' +
+ 'import { TraversalStrategies, VertexProgramStrategy, OptionsStrategy, PartitionStrategy, \n' +
' ReadOnlyStrategy, GraphFilterStrategy, SeedStrategy, SubgraphStrategy, ProductiveByStrategy, \n' +
' LambdaRestrictionStrategy, StandardVerificationStrategy, VertexProgramRestrictionStrategy, \n' +
' ComputerVerificationStrategy, MessagePassingReductionStrategy, ProfileStrategy, InlineFilterStrategy, \n' +
diff --cc gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js
index c762148a6b,d2f89c8696..7cdea9ec3c
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js
@@@ -24,9 -24,9 +24,10 @@@
//********************************************************************************
-const graphTraversalModule = require('../../lib/process/graph-traversal');
-const traversalModule = require('../../lib/process/traversal');
-const { TraversalStrategies, VertexProgramStrategy, OptionsStrategy, PartitionStrategy,
+import * as graphTraversalModule from '../../lib/process/graph-traversal.js';
+import * as traversalModule from '../../lib/process/traversal.js';
++import * as uuid from 'uuid';
+import { TraversalStrategies, VertexProgramStrategy, OptionsStrategy, PartitionStrategy,
ReadOnlyStrategy, GraphFilterStrategy, SeedStrategy, SubgraphStrategy, ProductiveByStrategy,
LambdaRestrictionStrategy, StandardVerificationStrategy, VertexProgramRestrictionStrategy,
ComputerVerificationStrategy, MessagePassingReductionStrategy, ProfileStrategy, InlineFilterStrategy,
@@@ -1752,6 -1685,7 +1753,8 @@@ const gremlins =
g_VX1X_out_out_out_tree: [function({g}) { return g.V().out().out().out().tree() }],
g_VX1X_outE_inV_bothE_otherV_tree: [function({g, vid1}) { return g.V(vid1).outE().inV().bothE().otherV().tree() }],
g_VX1X_outE_inV_bothE_otherV_tree_byXnameX_byXlabelX: [function({g, vid1}) { return g.V(vid1).outE().inV().bothE().otherV().tree().by("name").by(T.label) }],
- g_injectXUUIDX: [function({g}) { return g.inject("f47af10b-58cc-4372-a567-0f02b2f3d479") }],
++ g_injectXUUIDX47af10b_58cc_4372_a567_0f02b2f3d479XX: [function({g}) { return g.inject("f47af10b-58cc-4372-a567-0f02b2f3d479") }],
++ g_injectXUUIDXXX: [function({g}) { return g.inject(uuid.v4()) }],
}
-exports.gremlin = gremlins
+export const gremlin = gremlins
diff --cc gremlin-python/src/main/python/radish/gremlin.py
index 10ad03b3e4,078afdcfee..97ab39d040
--- a/gremlin-python/src/main/python/radish/gremlin.py
+++ b/gremlin-python/src/main/python/radish/gremlin.py
@@@ -1725,4 -1659,5 +1726,6 @@@ world.gremlins =
'g_VX1X_out_out_out_tree': [(lambda g:g.V().out().out().out().tree())],
'g_VX1X_outE_inV_bothE_otherV_tree': [(lambda g, vid1=None:g.V(vid1).out_e().in_v().both_e().other_v().tree())],
'g_VX1X_outE_inV_bothE_otherV_tree_byXnameX_byXlabelX': [(lambda g, vid1=None:g.V(vid1).out_e().in_v().both_e().other_v().tree().by('name').by(T.label))],
- 'g_injectXUUIDX': [(lambda g:g.inject(uuid.UUID('f47af10b-58cc-4372-a567-0f02b2f3d479')))],
++ 'g_injectXUUIDX47af10b_58cc_4372_a567_0f02b2f3d479XX': [(lambda g:g.inject(uuid.UUID('f47af10b-58cc-4372-a567-0f02b2f3d479')))],
++ 'g_injectXUUIDXXX': [(lambda g:g.inject(uuid.uuid4()))],
}
diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index 63b1e3e6d5,6dc2e4fdb8..d7f7bc5192
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@@ -1245,4 -1898,23 +1246,23 @@@ public class GremlinDriverIntegrateTes
public void shouldFailOnInitiallyDeadHostForClusterClient() throws Exception {
testShouldFailOnInitiallyDeadHost(true);
}
+
+ @Test
+ public void shouldFailOnInitiallyDeadHostForSessionClient() throws Exception {
+ testShouldFailOnInitiallyDeadHost(false);
+ }
+
+ @Test
+ public void shouldReturnUuid() throws Exception {
- final Cluster cluster = TestClientFactory.build().serializer(Serializers.GRAPHSON_V3).create();
++ final Cluster cluster = TestClientFactory.build().create();
+ try {
+ final Client client = cluster.connect().alias("g");
+ List<Result> returnedList = client.submit("g.inject(UUID())", RequestOptions.build().language("gremlin-lang").create()).all().get();
+ assertEquals(1, returnedList.size());
+ Object value = returnedList.get(0).getObject();
+ assertTrue(value instanceof UUID);
+ } finally {
+ cluster.close();
+ }
+ }
}
diff --cc gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/features/StepDefinition.java
index f4770ea5e8,275166e06d..d4203c8923
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/features/StepDefinition.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/features/StepDefinition.java
@@@ -83,22 -92,8 +83,23 @@@ import java.util.regex.Matcher
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+ import java.util.UUID;
+import static org.apache.commons.text.StringEscapeUtils.escapeJava;
+import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData;
+import static org.apache.tinkerpop.gremlin.process.traversal.P.eq;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.Every.everyItem;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+import static org.hamcrest.core.StringContains.containsStringIgnoringCase;
+import static org.hamcrest.core.StringEndsWith.endsWithIgnoringCase;
+import static org.hamcrest.core.StringStartsWith.startsWithIgnoringCase;
+import static org.hamcrest.number.IsCloseTo.closeTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
@ScenarioScoped
public final class StepDefinition {