From 76b29896e9a1b0504138dd9ded4ff8f991dceb99 Mon Sep 17 00:00:00 2001 From: Cole-Greer Date: Tue, 19 Dec 2023 13:13:29 -0800 Subject: [PATCH] Revert "CTR Update examples to use new with() syntax when creating g" This reverts commit 307ebbcbcd72de6f3666b73c1288f500fbc2181a. This commit was previously updating the master branch examples to use new 4.0.0 syntax, however these examples cannot be used without 4.0.0 artifacts being published. I am reverting this for now such that master will continue to host 3.7 examples which will remain fully functional. --- gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs | 2 +- gremlin-dotnet/Examples/Connections/Connections.cs | 2 +- .../Examples/ModernTraversals/ModernTraversals.cs | 2 +- gremlin-driver/src/main/java/examples/BasicGremlin.java | 2 +- gremlin-driver/src/main/java/examples/Connections.java | 8 ++++---- .../src/main/java/examples/ModernTraversals.java | 2 +- gremlin-go/examples/basic_gremlin.go | 4 ++-- gremlin-javascript/examples/basic-gremlin.js | 2 +- gremlin-javascript/examples/connections.js | 2 +- gremlin-javascript/examples/modern-traversals.js | 2 +- gremlin-python/src/main/python/examples/basic_gremlin.py | 2 +- gremlin-python/src/main/python/examples/connections.py | 2 +- .../src/main/python/examples/modern_traversals.py | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs b/gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs index 9971ef1809f..91820bfe095 100644 --- a/gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs +++ b/gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs @@ -27,7 +27,7 @@ static async Task Main() { var server = new GremlinServer("localhost", 8182); using var remoteConnection = new DriverRemoteConnection(new GremlinClient(server), "g"); - var g = Traversal().With(remoteConnection); + var g = Traversal().WithRemote(remoteConnection); // Basic Gremlin: adding and retrieving data var v1 = g.AddV("person").Property("name", "marko").Next(); diff --git a/gremlin-dotnet/Examples/Connections/Connections.cs b/gremlin-dotnet/Examples/Connections/Connections.cs index d5a4e648f88..26490f750b2 100644 --- a/gremlin-dotnet/Examples/Connections/Connections.cs +++ b/gremlin-dotnet/Examples/Connections/Connections.cs @@ -36,7 +36,7 @@ static void withRemote() { var server = new GremlinServer("localhost", 8182); using var remoteConnection = new DriverRemoteConnection(new GremlinClient(server), "g"); - var g = Traversal().With(remoteConnection); + var g = Traversal().WithRemote(remoteConnection); // Drop existing vertices g.V().Drop().Iterate(); diff --git a/gremlin-dotnet/Examples/ModernTraversals/ModernTraversals.cs b/gremlin-dotnet/Examples/ModernTraversals/ModernTraversals.cs index b112254556c..fab70735301 100644 --- a/gremlin-dotnet/Examples/ModernTraversals/ModernTraversals.cs +++ b/gremlin-dotnet/Examples/ModernTraversals/ModernTraversals.cs @@ -30,7 +30,7 @@ static void Main() { var server = new GremlinServer("localhost", 8182); using var remoteConnection = new DriverRemoteConnection(new GremlinClient(server), "g"); - var g = Traversal().With(remoteConnection); + var g = Traversal().WithRemote(remoteConnection); /* This example requires the Modern toy graph to be preloaded upon launching the Gremlin server. diff --git a/gremlin-driver/src/main/java/examples/BasicGremlin.java b/gremlin-driver/src/main/java/examples/BasicGremlin.java index 46542a6e25f..a5075d46061 100644 --- a/gremlin-driver/src/main/java/examples/BasicGremlin.java +++ b/gremlin-driver/src/main/java/examples/BasicGremlin.java @@ -31,7 +31,7 @@ Licensed to the Apache Software Foundation (ASF) under one public class BasicGremlin { public static void main(String[] args) { Graph graph = TinkerGraph.open(); - GraphTraversalSource g = traversal().with(graph); + GraphTraversalSource g = traversal().withEmbedded(graph); // Basic Gremlin: adding and retrieving data Vertex v1 = g.addV("person").property("name","marko").next(); diff --git a/gremlin-driver/src/main/java/examples/Connections.java b/gremlin-driver/src/main/java/examples/Connections.java index d388cad8245..458d5c8fd53 100644 --- a/gremlin-driver/src/main/java/examples/Connections.java +++ b/gremlin-driver/src/main/java/examples/Connections.java @@ -45,7 +45,7 @@ public static void main(String[] args) throws Exception { // Creating an embedded graph private static void withEmbedded() throws Exception { Graph graph = TinkerGraph.open(); - GraphTraversalSource g = traversal().with(graph); + GraphTraversalSource g = traversal().withEmbedded(graph); g.addV().iterate(); long count = g.V().count().next(); @@ -57,7 +57,7 @@ private static void withEmbedded() throws Exception { // Connecting to the server private static void withRemote() throws Exception { Cluster cluster = Cluster.build("localhost").port(8182).create(); - GraphTraversalSource g = traversal().with(DriverRemoteConnection.using(cluster, "g")); + GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(cluster, "g")); // Drop existing vertices g.V().drop().iterate(); @@ -83,7 +83,7 @@ private static void withCluster() throws Exception { port(8182). serializer(new GraphBinaryMessageSerializerV1()). create(); - GraphTraversalSource g = traversal().with(DriverRemoteConnection.using(cluster, "g")); + GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(cluster, "g")); g.addV().iterate(); long count = g.V().count().next(); @@ -102,7 +102,7 @@ private static void withSerializer() throws Exception { serializer(serializer). create(); Client client = cluster.connect(); - GraphTraversalSource g = traversal().with(DriverRemoteConnection.using(client, "g")); + GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(client, "g")); g.addV().iterate(); long count = g.V().count().next(); diff --git a/gremlin-driver/src/main/java/examples/ModernTraversals.java b/gremlin-driver/src/main/java/examples/ModernTraversals.java index cbaef5e5a88..c67b6daeb27 100644 --- a/gremlin-driver/src/main/java/examples/ModernTraversals.java +++ b/gremlin-driver/src/main/java/examples/ModernTraversals.java @@ -36,7 +36,7 @@ public class ModernTraversals { public static void main(String[] args) { // Performs basic traversals on the Modern toy graph which can be created using TinkerFactory Graph modern = TinkerFactory.createModern(); - GraphTraversalSource g = traversal().with(modern); + GraphTraversalSource g = traversal().withEmbedded(modern); List e1 = g.V(1).bothE().toList(); // (1) List e2 = g.V(1).bothE().where(otherV().hasId(2)).toList(); // (2) diff --git a/gremlin-go/examples/basic_gremlin.go b/gremlin-go/examples/basic_gremlin.go index c4bb8e6c23c..0ab2b1117fd 100644 --- a/gremlin-go/examples/basic_gremlin.go +++ b/gremlin-go/examples/basic_gremlin.go @@ -32,7 +32,7 @@ func main() { return } defer driverRemoteConnection.Close() - g := gremlingo.Traversal_().With(driverRemoteConnection) + g := gremlingo.Traversal_().WithRemote(driverRemoteConnection) // Basic Gremlin: adding and retrieving data v1, err := g.AddV("person").Property("name", "marko").Next() @@ -66,4 +66,4 @@ func main() { for _, person := range peopleMarkoKnows { fmt.Println("marko knows", person.GetString()) } -} +} \ No newline at end of file diff --git a/gremlin-javascript/examples/basic-gremlin.js b/gremlin-javascript/examples/basic-gremlin.js index bc412b356b6..77e7f3b7d9f 100644 --- a/gremlin-javascript/examples/basic-gremlin.js +++ b/gremlin-javascript/examples/basic-gremlin.js @@ -23,7 +23,7 @@ const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection; async function main() { const dc = new DriverRemoteConnection('ws://localhost:8182/gremlin'); - const g = traversal().with(dc); + const g = traversal().withRemote(dc); // Basic Gremlin: adding and retrieving data const v1 = await g.addV('person').property('name','marko').next(); diff --git a/gremlin-javascript/examples/connections.js b/gremlin-javascript/examples/connections.js index 4264ec54713..183f6404f6e 100644 --- a/gremlin-javascript/examples/connections.js +++ b/gremlin-javascript/examples/connections.js @@ -30,7 +30,7 @@ async function main() { async function withRemote() { // Connecting to the server const dc = new DriverRemoteConnection('ws://localhost:8182/gremlin'); - const g = traversal().with(dc); + const g = traversal().withRemote(dc); // Drop existing vertices await g.V().drop().iterate(); diff --git a/gremlin-javascript/examples/modern-traversals.js b/gremlin-javascript/examples/modern-traversals.js index dfac46a0802..66b039fca38 100644 --- a/gremlin-javascript/examples/modern-traversals.js +++ b/gremlin-javascript/examples/modern-traversals.js @@ -31,7 +31,7 @@ async function main() { conf/gremlin-server-modern.yaml. */ const dc = new DriverRemoteConnection('ws://localhost:8182/gremlin'); - const g = traversal().with(dc); + const g = traversal().withRemote(dc); const e1 = await g.V(1).bothE().toList(); // (1) const e2 = await g.V(1).bothE().where(__.otherV().hasId(2)).toList(); // (2) diff --git a/gremlin-python/src/main/python/examples/basic_gremlin.py b/gremlin-python/src/main/python/examples/basic_gremlin.py index 1dfe75be4da..256ed984416 100644 --- a/gremlin-python/src/main/python/examples/basic_gremlin.py +++ b/gremlin-python/src/main/python/examples/basic_gremlin.py @@ -26,7 +26,7 @@ def main(): rc = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g') - g = traversal().with_(rc) + g = traversal().with_remote(rc) # basic Gremlin: adding and retrieving data v1 = g.add_v('person').property('name', 'marko').next() diff --git a/gremlin-python/src/main/python/examples/connections.py b/gremlin-python/src/main/python/examples/connections.py index dd9fd6a1635..f268e6c27d5 100644 --- a/gremlin-python/src/main/python/examples/connections.py +++ b/gremlin-python/src/main/python/examples/connections.py @@ -41,7 +41,7 @@ def with_remote(): # which starts it in "console" mode with an empty in-memory TinkerGraph ready to go bound to a # variable named "g" as referenced in the following line. rc = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g') - g = traversal().with_(rc) + g = traversal().with_remote(rc) # drop existing vertices g.V().drop().iterate() diff --git a/gremlin-python/src/main/python/examples/modern_traversals.py b/gremlin-python/src/main/python/examples/modern_traversals.py index 32b4e1fb20f..ae757b10b4f 100644 --- a/gremlin-python/src/main/python/examples/modern_traversals.py +++ b/gremlin-python/src/main/python/examples/modern_traversals.py @@ -32,7 +32,7 @@ def main(): # For details, see https://tinkerpop.apache.org/docs/current/reference/#gremlin-server-docker-image and use # conf/gremlin-server-modern.yaml. rc = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g') - g = traversal().with_(rc) + g = traversal().with_remote(rc) e1 = g.V(1).both_e().to_list() # (1) e2 = g.V(1).both_e().where(__.other_v().has_id(2)).to_list() # (2)