This is an automated email from the ASF dual-hosted git repository. xiazcy pushed a commit to branch 3.8-dev in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 8b45a6ff04676fc35819f0479249c6eca5fe3cf6 Author: Yang Xia <[email protected]> AuthorDate: Thu Mar 5 17:48:25 2026 -0800 CTR dotnet fix regex parsing for Gremlin.cs generation to resolve build failure & update examples --- gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs | 2 +- gremlin-dotnet/Examples/Connections/Connections.cs | 10 +++++----- gremlin-dotnet/Examples/ModernTraversals/ModernTraversals.cs | 2 +- gremlin-dotnet/build/generate.groovy | 8 ++++---- .../test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs b/gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs index 7a5f373133..fc97a24ab1 100644 --- a/gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs +++ b/gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs @@ -31,7 +31,7 @@ public class BasicGremlinExample { var server = new GremlinServer(ServerHost, ServerPort); using var remoteConnection = new DriverRemoteConnection(new GremlinClient(server), "g"); - var g = Traversal().WithRemote(remoteConnection); + var g = Traversal().With(remoteConnection); // Basic Gremlin: adding and retrieving data var v1 = g.AddV(VertexLabel).Property("name", "marko").Next(); diff --git a/gremlin-dotnet/Examples/Connections/Connections.cs b/gremlin-dotnet/Examples/Connections/Connections.cs index d0cfdc0783..c09eea3f7b 100644 --- a/gremlin-dotnet/Examples/Connections/Connections.cs +++ b/gremlin-dotnet/Examples/Connections/Connections.cs @@ -30,17 +30,17 @@ public class ConnectionExample static void Main() { - WithRemote(); + WithRemoteConnection(); WithConf(); WithSerializer(); } // Connecting to the server - static void WithRemote() + static void WithRemoteConnection() { var server = new GremlinServer(ServerHost, ServerPort); using var remoteConnection = new DriverRemoteConnection(new GremlinClient(server), "g"); - var g = Traversal().WithRemote(remoteConnection); + var g = Traversal().With(remoteConnection); // Simple query to verify connection var v = g.AddV(VertexLabel).Iterate(); @@ -53,7 +53,7 @@ public class ConnectionExample { using var remoteConnection = new DriverRemoteConnection(new GremlinClient( new GremlinServer(hostname: ServerHost, port: ServerPort, enableSsl: false, username: "", password: "")), "g"); - var g = Traversal().WithRemote(remoteConnection); + var g = Traversal().With(remoteConnection); var v = g.AddV(VertexLabel).Iterate(); var count = g.V().HasLabel(VertexLabel).Count().Next(); @@ -66,7 +66,7 @@ public class ConnectionExample var server = new GremlinServer(ServerHost, ServerPort); var client = new GremlinClient(server, new GraphSON3MessageSerializer()); using var remoteConnection = new DriverRemoteConnection(client, "g"); - var g = Traversal().WithRemote(remoteConnection); + var g = Traversal().With(remoteConnection); var v = g.AddV(VertexLabel).Iterate(); var count = g.V().HasLabel(VertexLabel).Count().Next(); diff --git a/gremlin-dotnet/Examples/ModernTraversals/ModernTraversals.cs b/gremlin-dotnet/Examples/ModernTraversals/ModernTraversals.cs index a7d608ddbb..52cede6321 100644 --- a/gremlin-dotnet/Examples/ModernTraversals/ModernTraversals.cs +++ b/gremlin-dotnet/Examples/ModernTraversals/ModernTraversals.cs @@ -36,7 +36,7 @@ public class ModernTraversalExample // Use gmodern in CI environment, default connection locally var traversalSource = IsDocker ? "gmodern" : "g"; using var remoteConnection = new DriverRemoteConnection(new GremlinClient(server), traversalSource); - var g = Traversal().WithRemote(remoteConnection); + var g = Traversal().With(remoteConnection); /* This example requires the Modern toy graph to be preloaded upon launching the Gremlin server. diff --git a/gremlin-dotnet/build/generate.groovy b/gremlin-dotnet/build/generate.groovy index 1a86a5155d..9a960303f5 100644 --- a/gremlin-dotnet/build/generate.groovy +++ b/gremlin-dotnet/build/generate.groovy @@ -115,13 +115,13 @@ radishGremlinFile.withWriter('UTF-8') { Writer writer -> writer.write("(g,p) =>") writer.write(t.getTranslated(). replaceAll("xx([0-9]+)", "p[\"xx\$1\"]"). - replaceAll("v([0-9]+)", "(Vertex) p[\"v\$1\"]"). + replaceAll("(?<![\\w\\-])v([0-9]+)(?![\\w\\.])", "(Vertex) p[\"v\$1\"]"). replaceAll("vid([0-9]+)", "p[\"vid\$1\"]"). - replaceAll("e([0-9]+)", "p[\"e\$1\"]"). + replaceAll("(?<![\\w\\-])e([0-9]+)(?![\\w\\.])", "p[\"e\$1\"]"). replaceAll("eid([0-9]+)", "p[\"eid\$1\"]"). - replaceAll("l([0-9]+)", "(IFunction) p[\"l\$1\"]"). + replaceAll("(?<![\\w\\-])l([0-9]+)(?![\\w\\.])", "(IFunction) p[\"l\$1\"]"). replaceAll("pred([0-9]+)", "(IPredicate) p[\"pred\$1\"]"). - replaceAll("c([0-9]+)", "(IComparator) p[\"c\$1\"]")) + replaceAll("(?<![\\w\\-])c([0-9]+)(?![\\w\\.])", "(IComparator) p[\"c\$1\"]")) if (gremlinItty.hasNext()) writer.write(', ') else diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs index a6c64091d5..98770fb3e8 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs @@ -1888,8 +1888,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin {"g_V_properties_order_id", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Properties<object>().Order().Id()}}, {"g_E_properties_order_value", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.AddV("person").Property("name", "alice").As("a").AddE("self").From("a").To("a").Property("weight", 0.5d).Property("a", 10).AddE("self").From("a").To("a").Property("weight", 1.0d).Property("a", 11).AddE("self").From("a").To("a").Property("weight", 0.4d).Property("a", 12).AddE("self").From("a").To("a").Property("weight", 1.0d).Property("a", 13).AddE("self") [...] {"g_E_properties_order_byXdescX_value", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.AddV("person").Property("name", "alice").As("a").AddE("self").From("a").To("a").Property("weight", 0.5d).Property("a", 10).AddE("self").From("a").To("a").Property("weight", 1.0d).Property("a", 11).AddE("self").From("a").To("a").Property("weight", 0.4d).Property("a", 12).AddE("self").From("a").To("a").Property("weight", 1.0d).Property("a", 13).Add [...] - {"g_inject_order", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("zzz", "foo", Guid.Parse("6100808b-62f9-42b7-957e-ed66(IComparator) p["c30"]f40d1"), new List<object> { "a", "b", "c", "d" }, 1, DateTimeOffset.Parse("2023-08-01T00:00Z"), new List<object> { "a", "b", "c" }, new Dictionary<object, object> {{ "a", "a" }, { "b", "b" }}, null, 2.0d, DateTimeOffset.Parse("2023-01-01T00:00Z"), new HashSet<object> { "x", "y" [...] - {"g_inject_order_byXdescX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("zzz", "foo", Guid.Parse("6100808b-62f9-42b7-957e-ed66(IComparator) p["c30"]f40d1"), new List<object> { "a", "b", "c", "d" }, 1, DateTimeOffset.Parse("2023-08-01T00:00Z"), new List<object> { "a", "b", "c" }, new Dictionary<object, object> {{ "a", "a" }, { "b", "b" }}, null, 2.0d, DateTimeOffset.Parse("2023-01-01T00:00Z"), new HashSet<object> { [...] + {"g_inject_order", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("zzz", "foo", Guid.Parse("6100808b-62f9-42b7-957e-ed66c30f40d1"), new List<object> { "a", "b", "c", "d" }, 1, DateTimeOffset.Parse("2023-08-01T00:00Z"), new List<object> { "a", "b", "c" }, new Dictionary<object, object> {{ "a", "a" }, { "b", "b" }}, null, 2.0d, DateTimeOffset.Parse("2023-01-01T00:00Z"), new HashSet<object> { "x", "y", "z" }, new Dictio [...] + {"g_inject_order_byXdescX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.Inject<object>("zzz", "foo", Guid.Parse("6100808b-62f9-42b7-957e-ed66c30f40d1"), new List<object> { "a", "b", "c", "d" }, 1, DateTimeOffset.Parse("2023-08-01T00:00Z"), new List<object> { "a", "b", "c" }, new Dictionary<object, object> {{ "a", "a" }, { "b", "b" }}, null, 2.0d, DateTimeOffset.Parse("2023-01-01T00:00Z"), new HashSet<object> { "x", "y", "z" }, n [...] {"g_V_out_out_order_byXascX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Out().Out().Order().By(Order.Asc)}}, {"g_V_out_out_order_byXdescX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Out().Out().Order().By(Order.Desc)}}, {"g_V_out_out_asXheadX_path_order_byXascX_selectXheadX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Out().Out().As("head").Path().Order().By(Order.Asc).Select<object>("head")}},
