Skip to content

Commit

Permalink
Revert "CTR Update examples to use new with() syntax when creating g"
Browse files Browse the repository at this point in the history
This reverts commit 307ebbc.

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.
  • Loading branch information
Cole-Greer committed Dec 19, 2023
1 parent ffc6f22 commit 76b2989
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gremlin-dotnet/Examples/BasicGremlin/BasicGremlin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion gremlin-dotnet/Examples/Connections/Connections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion gremlin-driver/src/main/java/examples/BasicGremlin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions gremlin-driver/src/main/java/examples/Connections.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Edge> e1 = g.V(1).bothE().toList(); // (1)
List<Edge> e2 = g.V(1).bothE().where(otherV().hasId(2)).toList(); // (2)
Expand Down
4 changes: 2 additions & 2 deletions gremlin-go/examples/basic_gremlin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -66,4 +66,4 @@ func main() {
for _, person := range peopleMarkoKnows {
fmt.Println("marko knows", person.GetString())
}
}
}
2 changes: 1 addition & 1 deletion gremlin-javascript/examples/basic-gremlin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion gremlin-javascript/examples/connections.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion gremlin-javascript/examples/modern-traversals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion gremlin-python/src/main/python/examples/basic_gremlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion gremlin-python/src/main/python/examples/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 76b2989

Please sign in to comment.