Skip to content

Commit 8b45a6f

Browse files
committed
CTR dotnet fix regex parsing for Gremlin.cs generation to resolve build failure & update examples
1 parent 6b99e21 commit 8b45a6f

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static async Task Main()
3131
{
3232
var server = new GremlinServer(ServerHost, ServerPort);
3333
using var remoteConnection = new DriverRemoteConnection(new GremlinClient(server), "g");
34-
var g = Traversal().WithRemote(remoteConnection);
34+
var g = Traversal().With(remoteConnection);
3535

3636
// Basic Gremlin: adding and retrieving data
3737
var v1 = g.AddV(VertexLabel).Property("name", "marko").Next();

gremlin-dotnet/Examples/Connections/Connections.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ public class ConnectionExample
3030

3131
static void Main()
3232
{
33-
WithRemote();
33+
WithRemoteConnection();
3434
WithConf();
3535
WithSerializer();
3636
}
3737

3838
// Connecting to the server
39-
static void WithRemote()
39+
static void WithRemoteConnection()
4040
{
4141
var server = new GremlinServer(ServerHost, ServerPort);
4242
using var remoteConnection = new DriverRemoteConnection(new GremlinClient(server), "g");
43-
var g = Traversal().WithRemote(remoteConnection);
43+
var g = Traversal().With(remoteConnection);
4444

4545
// Simple query to verify connection
4646
var v = g.AddV(VertexLabel).Iterate();
@@ -53,7 +53,7 @@ static void WithConf()
5353
{
5454
using var remoteConnection = new DriverRemoteConnection(new GremlinClient(
5555
new GremlinServer(hostname: ServerHost, port: ServerPort, enableSsl: false, username: "", password: "")), "g");
56-
var g = Traversal().WithRemote(remoteConnection);
56+
var g = Traversal().With(remoteConnection);
5757

5858
var v = g.AddV(VertexLabel).Iterate();
5959
var count = g.V().HasLabel(VertexLabel).Count().Next();
@@ -66,7 +66,7 @@ static void WithSerializer()
6666
var server = new GremlinServer(ServerHost, ServerPort);
6767
var client = new GremlinClient(server, new GraphSON3MessageSerializer());
6868
using var remoteConnection = new DriverRemoteConnection(client, "g");
69-
var g = Traversal().WithRemote(remoteConnection);
69+
var g = Traversal().With(remoteConnection);
7070

7171
var v = g.AddV(VertexLabel).Iterate();
7272
var count = g.V().HasLabel(VertexLabel).Count().Next();

gremlin-dotnet/Examples/ModernTraversals/ModernTraversals.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void Main()
3636
// Use gmodern in CI environment, default connection locally
3737
var traversalSource = IsDocker ? "gmodern" : "g";
3838
using var remoteConnection = new DriverRemoteConnection(new GremlinClient(server), traversalSource);
39-
var g = Traversal().WithRemote(remoteConnection);
39+
var g = Traversal().With(remoteConnection);
4040

4141
/*
4242
This example requires the Modern toy graph to be preloaded upon launching the Gremlin server.

gremlin-dotnet/build/generate.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ radishGremlinFile.withWriter('UTF-8') { Writer writer ->
115115
writer.write("(g,p) =>")
116116
writer.write(t.getTranslated().
117117
replaceAll("xx([0-9]+)", "p[\"xx\$1\"]").
118-
replaceAll("v([0-9]+)", "(Vertex) p[\"v\$1\"]").
118+
replaceAll("(?<![\\w\\-])v([0-9]+)(?![\\w\\.])", "(Vertex) p[\"v\$1\"]").
119119
replaceAll("vid([0-9]+)", "p[\"vid\$1\"]").
120-
replaceAll("e([0-9]+)", "p[\"e\$1\"]").
120+
replaceAll("(?<![\\w\\-])e([0-9]+)(?![\\w\\.])", "p[\"e\$1\"]").
121121
replaceAll("eid([0-9]+)", "p[\"eid\$1\"]").
122-
replaceAll("l([0-9]+)", "(IFunction) p[\"l\$1\"]").
122+
replaceAll("(?<![\\w\\-])l([0-9]+)(?![\\w\\.])", "(IFunction) p[\"l\$1\"]").
123123
replaceAll("pred([0-9]+)", "(IPredicate) p[\"pred\$1\"]").
124-
replaceAll("c([0-9]+)", "(IComparator) p[\"c\$1\"]"))
124+
replaceAll("(?<![\\w\\-])c([0-9]+)(?![\\w\\.])", "(IComparator) p[\"c\$1\"]"))
125125
if (gremlinItty.hasNext())
126126
writer.write(', ')
127127
else

gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,8 +1888,8 @@ private static IDictionary<string, List<Func<GraphTraversalSource, IDictionary<s
18881888
{"g_V_properties_order_id", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Properties<object>().Order().Id()}},
18891889
{"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").From("a").To("a").Property("weight", 0.4d).Property("a", 14).AddE("self").From("a").To("a").Property("weight", 0.2d).Property("a", 15), (g,p) =>g.E().Properties<object>().Order().Value<object>()}},
18901890
{"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).AddE("self").From("a").To("a").Property("weight", 0.4d).Property("a", 14).AddE("self").From("a").To("a").Property("weight", 0.2d).Property("a", 15), (g,p) =>g.E().Properties<object>().Order().By(Order.Desc).Value<object>()}},
1891-
{"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", "z" }, new Dictionary<object, object> {{ "a", "a" }, { "b", false }, { "c", "c" }}, "bar", Guid.Parse("5100808b-62f9-42b7-957e-ed66(IComparator) p["c30"]f40d1"), true, false, Double.PositiveInfinity, Double.NaN, Double.NegativeInfinity).Order()}},
1892-
{"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> { "x", "y", "z" }, new Dictionary<object, object> {{ "a", "a" }, { "b", false }, { "c", "c" }}, "bar", Guid.Parse("5100808b-62f9-42b7-957e-ed66(IComparator) p["c30"]f40d1"), true, false, Double.PositiveInfinity, Double.NaN, Double.NegativeInfinity).Order().By(Order.Desc)}},
1891+
{"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 Dictionary<object, object> {{ "a", "a" }, { "b", false }, { "c", "c" }}, "bar", Guid.Parse("5100808b-62f9-42b7-957e-ed66c30f40d1"), true, false, Double.PositiveInfinity, Double.NaN, Double.NegativeInfinity).Order()}},
1892+
{"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" }, new Dictionary<object, object> {{ "a", "a" }, { "b", false }, { "c", "c" }}, "bar", Guid.Parse("5100808b-62f9-42b7-957e-ed66c30f40d1"), true, false, Double.PositiveInfinity, Double.NaN, Double.NegativeInfinity).Order().By(Order.Desc)}},
18931893
{"g_V_out_out_order_byXascX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Out().Out().Order().By(Order.Asc)}},
18941894
{"g_V_out_out_order_byXdescX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Out().Out().Order().By(Order.Desc)}},
18951895
{"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")}},

0 commit comments

Comments
 (0)