You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/03/09 23:13:51 UTC
incubator-tinkerpop git commit: more tests.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/newapi 3b2c35fe0 -> 41f0fe4ef
more tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/41f0fe4e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/41f0fe4e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/41f0fe4e
Branch: refs/heads/newapi
Commit: 41f0fe4ef55cca547c01becf0475499257a62a62
Parents: 3b2c35f
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Mar 9 16:13:48 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Mar 9 16:13:48 2015 -0600
----------------------------------------------------------------------
.../engine/GremlinExecutorPerformanceTest.java | 4 +-
.../engine/GroovyTraversalScriptTest.java | 4 +-
.../jsr223/GremlinGroovyScriptEngineTest.java | 4 +-
.../tinkerpop/gremlin/structure/BatchTest.java | 148 +++++++++----------
.../strategy/SequenceStrategyTest.java | 18 +--
.../tinkergraph/structure/TinkerFactory.java | 2 +-
.../tinkergraph/structure/TinkerGraphTest.java | 70 +++++----
7 files changed, 130 insertions(+), 120 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/41f0fe4e/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorPerformanceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorPerformanceTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorPerformanceTest.java
index 1acb655..ba592c3 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorPerformanceTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorPerformanceTest.java
@@ -107,10 +107,10 @@ public class GremlinExecutorPerformanceTest extends AbstractGremlinTest {
public String generateGremlin() {
final int targetStepCount = rand.nextInt(10);
final StringBuilder sb = new StringBuilder("g.V()");
- final Vertex start = syntaxGraph.V().has("starter", true).order().by(this::shuffle).next();
+ final Vertex start = syntaxGraph.traversal().V().has("starter", true).order().by(this::shuffle).next();
sb.append((String) start.value("step"));
- syntaxGraph.V(start).times(targetStepCount - 1).repeat(
+ syntaxGraph.traversal().V(start).times(targetStepCount - 1).repeat(
__.local(__.outE().has("weight", Compare.gte, rand.nextDouble())
.inV().order().by(this::shuffle).limit(1)).sideEffect(t -> sb.append((String) t.get().value("step")))
).iterate();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/41f0fe4e/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GroovyTraversalScriptTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GroovyTraversalScriptTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GroovyTraversalScriptTest.java
index 56d2ae8..aacf96e 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GroovyTraversalScriptTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GroovyTraversalScriptTest.java
@@ -36,7 +36,7 @@ public class GroovyTraversalScriptTest extends AbstractGremlinTest {
@Test
@LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
public void shouldSubmitTraversalCorrectly() throws Exception {
- final List<String> names = GroovyTraversalScript.<Vertex, String>of("g.V().out().out().values('name')").over(g).using(g.compute()).traversal().get().toList();
+ final List<String> names = GroovyTraversalScript.<Vertex, String>of("g.V().out().out().values('name')").over(graph).using(graph.compute()).traversal().get().toList();
assertEquals(2, names.size());
assertTrue(names.contains("lop"));
assertTrue(names.contains("ripple"));
@@ -45,7 +45,7 @@ public class GroovyTraversalScriptTest extends AbstractGremlinTest {
@Test
@LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
public void shouldSubmitTraversalCorrectly2() throws Exception {
- final List<String> names = GroovyTraversalScript.<Vertex, String>of("g.V(1).out().out().values('name')").over(g).using(g.compute()).traversal().get().toList();
+ final List<String> names = GroovyTraversalScript.<Vertex, String>of("g.V(1).out().out().values('name')").over(graph).using(graph.compute()).traversal().get().toList();
assertEquals(2, names.size());
assertTrue(names.contains("lop"));
assertTrue(names.contains("ripple"));
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/41f0fe4e/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
index 9473c0b..fdc0899 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
@@ -594,8 +594,8 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldProcessUTF8Query() throws Exception {
- final Vertex nonUtf8 = g.addVertex(T.id, "1", "name", "marko", "age", 29);
- final Vertex utf8Name = g.addVertex(T.id, "2", "name", "轉注", "age", 32);
+ final Vertex nonUtf8 = graph.addVertex(T.id, "1", "name", "marko", "age", 29);
+ final Vertex utf8Name = graph.addVertex(T.id, "2", "name", "轉注", "age", 32);
final ScriptEngine engine = new GremlinGroovyScriptEngine();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/41f0fe4e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/BatchTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/BatchTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/BatchTest.java
index 38f5913..c8bcdbd 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/BatchTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/BatchTest.java
@@ -47,16 +47,16 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
public void shouldLoadVerticesIncrementallyWithSuppliedIdentifier() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true)
.bufferSize(1).create();
final Object id1 = GraphManager.getGraphProvider().convertId("1");
final Object id2 = GraphManager.getGraphProvider().convertId("2");
- graph.addVertex(T.id, id1, "name", "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, id2, "name", "stephen", "age", 37);
- final Vertex v2 = graph.addVertex(T.id, id1, "name", "marko", "age", 34);
+ batchGraph.addVertex(T.id, id1, "name", "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, id2, "name", "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, id1, "name", "marko", "age", 34);
v1.addEdge("knows", v2, "weight", 1.0d);
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -71,15 +71,15 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldLoadVerticesIncrementallyWithNamedIdentifier() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true)
.vertexIdKey("name")
.bufferSize(1).create();
- graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 34);
+ batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 34);
v1.addEdge("knows", v2, "weight", 1.0d);
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -94,13 +94,13 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
public void shouldLoadVerticesIncrementallyWithSuppliedIdentifierThrowOnExistingVertex() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.THROW, Exists.IGNORE)
.bufferSize(1).create();
final Object id1 = GraphManager.getGraphProvider().convertId("1");
- graph.addVertex(T.id, id1, "name", "marko", "age", 29);
+ batchGraph.addVertex(T.id, id1, "name", "marko", "age", 29);
try {
- graph.addVertex(T.id, id1, "name", "marko", "age", 34);
+ batchGraph.addVertex(T.id, id1, "name", "marko", "age", 34);
fail("Should have thrown an error because the vertex already exists");
} catch (Exception ex) {
assertTrue(ex instanceof IllegalStateException);
@@ -111,13 +111,13 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
public void shouldLoadVerticesIncrementallyWithNamedIdentifierThrowOnExistingVertex() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.THROW, Exists.IGNORE)
.vertexIdKey("name")
.bufferSize(1).create();
- graph.addVertex(T.id, "marko", "age", 29);
+ batchGraph.addVertex(T.id, "marko", "age", 29);
try {
- graph.addVertex(T.id, "marko", "age", 34);
+ batchGraph.addVertex(T.id, "marko", "age", 34);
fail("Should have thrown an error because the vertex already exists");
} catch (Exception ex) {
assertTrue(ex instanceof IllegalStateException);
@@ -130,16 +130,16 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
public void shouldLoadVerticesIncrementallyWithSuppliedIdentifierOverwriteSingleExistingVertex() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.OVERWRITE_SINGLE, Exists.IGNORE)
.bufferSize(1).create();
final Object id1 = GraphManager.getGraphProvider().convertId("1");
final Object id2 = GraphManager.getGraphProvider().convertId("2");
- graph.addVertex(T.id, id1, "name", "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, id2, "name", "stephen", "age", 37);
- final Vertex v2 = graph.addVertex(T.id, id1, "name", "marko", "age", 34);
+ batchGraph.addVertex(T.id, id1, "name", "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, id2, "name", "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, id1, "name", "marko", "age", 34);
v1.addEdge("knows", v2, "weight", 1.0d);
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -154,15 +154,15 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldLoadVerticesIncrementallyWithNamedIdentifierOverwriteSingleExistingVertex() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.OVERWRITE_SINGLE, Exists.IGNORE)
.vertexIdKey("name")
.bufferSize(1).create();
- graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 34);
+ batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 34);
v1.addEdge("knows", v2, "weight", 1.0d);
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -178,16 +178,16 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
public void shouldLoadVerticesIncrementallyWithSuppliedIdentifierOverwriteExistingVertex() {
- final BatchGraph<?> graph = BatchGraph.build(g)
+ final BatchGraph<?> batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.OVERWRITE, Exists.IGNORE)
.bufferSize(1).create();
final Object id1 = GraphManager.getGraphProvider().convertId("1");
final Object id2 = GraphManager.getGraphProvider().convertId("2");
- graph.addVertex(T.id, id1, "name", "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, id2, "name", "stephen", "age", 37);
- final Vertex v2 = graph.addVertex(T.id, id1, "name", "marko", "age", 34);
+ batchGraph.addVertex(T.id, id1, "name", "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, id2, "name", "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, id1, "name", "marko", "age", 34);
v1.addEdge("knows", v2, "weight", 1.0d);
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -206,15 +206,15 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
public void shouldLoadVerticesIncrementallyWithNamedIdentifierAddMultiPropertyExistingVertex() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.OVERWRITE, Exists.IGNORE)
.vertexIdKey("name")
.bufferSize(1).create();
- graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 34);
+ batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 34);
v1.addEdge("knows", v2, "weight", 1.0d);
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -233,18 +233,18 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
public void shouldLoadEdgesIncrementallyWithSuppliedIdentifier() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true)
.vertexIdKey("name")
.bufferSize(1).create();
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
final Object id1 = GraphManager.getGraphProvider().convertId("1");
v1.addEdge("knows", v2, "weight", 1.0d, T.id, id1);
v1.addEdge("knows", v2, "weight", 0.5d, T.id, id1); // second edge is ignored as it already exists
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -260,16 +260,16 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldLoadEdgesIncrementallyWithNamedIdentifier() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true)
.vertexIdKey("name")
.edgeIdKey("uid")
.bufferSize(1).create();
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
v1.addEdge("knows", v2, "weight", 1.0d, T.id, "abcde");
v1.addEdge("knows", v2, "weight", 0.5d, T.id, "abcde"); // second edge is ignored as it already exists
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -286,16 +286,16 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
public void shouldLoadEdgesIncrementallyWithSuppliedIdentifierOverwriteSingleExistingEdge() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.IGNORE, Exists.OVERWRITE_SINGLE)
.vertexIdKey("name")
.bufferSize(1).create();
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
final Object id1 = GraphManager.getGraphProvider().convertId("1");
v1.addEdge("knows", v2, "weight", 1.0d, T.id, id1);
v1.addEdge("knows", v2, "weight", 0.5d, T.id, id1); // second edge is overwrites properties of the first
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -311,16 +311,16 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldLoadEdgesIncrementallyWithNamedIdentifierOverwriteSingleExistingEdge() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.IGNORE, Exists.OVERWRITE_SINGLE)
.vertexIdKey("name")
.edgeIdKey("uid")
.bufferSize(1).create();
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
v1.addEdge("knows", v2, "weight", 1.0d, T.id, "abcde");
v1.addEdge("knows", v2, "weight", 0.5d, T.id, "abcde"); // second edge overwrites properties of the first
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -337,16 +337,16 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
public void shouldLoadEdgesIncrementallyWithSuppliedIdentifierOverwriteExistingEdge() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.IGNORE, Exists.OVERWRITE)
.vertexIdKey("name")
.bufferSize(1).create();
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
final Object id1 = GraphManager.getGraphProvider().convertId("1");
v1.addEdge("knows", v2, "weight", 1.0d, T.id, id1);
v1.addEdge("knows", v2, "weight", 0.5d, T.id, id1); // second edge is overwrites properties of the first
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -362,16 +362,16 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldLoadEdgesIncrementallyWithNamedIdentifierOverwriteExistingEdge() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.IGNORE, Exists.OVERWRITE)
.vertexIdKey("name")
.edgeIdKey("uid")
.bufferSize(1).create();
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
v1.addEdge("knows", v2, "weight", 1.0d, T.id, "abcde");
v1.addEdge("knows", v2, "weight", 0.5d, T.id, "abcde"); // second edge overwrites properties of the first
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -388,12 +388,12 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
public void shouldLoadEdgesIncrementallyWithSuppliedIdentifierThrowOnExistingEdge() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.IGNORE, Exists.THROW)
.vertexIdKey("name")
.bufferSize(1).create();
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
final Object id1 = GraphManager.getGraphProvider().convertId("1");
v1.addEdge("knows", v2, "weight", 1.0d, T.id, id1);
try {
@@ -409,13 +409,13 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldLoadEdgesIncrementallyWithNamedIdentifierThrowOnExistingEdge() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true, Exists.IGNORE, Exists.THROW)
.vertexIdKey("name")
.edgeIdKey("uid")
.bufferSize(1).create();
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
v1.addEdge("knows", v2, "weight", 1.0d, T.id, "abcde");
try {
v1.addEdge("knows", v2, "weight", 0.5d, T.id, "abcde"); // second edge is overwrites properties of the first
@@ -430,15 +430,15 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldLoadEdgesIncrementallyNoIdSpecified() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true)
.vertexIdKey("name")
.bufferSize(1).create();
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
v1.addEdge("knows", v2, "weight", 1.0d);
v1.addEdge("knows", v2, "weight", 0.5d);
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
@@ -454,16 +454,16 @@ public class BatchTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = Graph.Features.EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldLoadEdgesIncrementallyWithNamedIdentifierAndNoIdSpecified() {
- final BatchGraph graph = BatchGraph.build(g)
+ final BatchGraph batchGraph = BatchGraph.build(graph)
.incrementalLoading(true)
.vertexIdKey("name")
.edgeIdKey("uid")
.bufferSize(1).create();
- final Vertex v2 = graph.addVertex(T.id, "marko", "age", 29);
- final Vertex v1 = graph.addVertex(T.id, "stephen", "age", 37);
+ final Vertex v2 = batchGraph.addVertex(T.id, "marko", "age", 29);
+ final Vertex v1 = batchGraph.addVertex(T.id, "stephen", "age", 37);
v1.addEdge("knows", v2, "weight", 1.0d);
v1.addEdge("knows", v2, "weight", 0.5d);
- tryCommit(graph);
+ tryCommit(batchGraph);
final Vertex vStephen = g.V().has("name", "stephen").next();
assertEquals(37, vStephen.property("age").value());
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/41f0fe4e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/SequenceStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/SequenceStrategyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/SequenceStrategyTest.java
index 5944794..9805fbf 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/SequenceStrategyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/SequenceStrategyTest.java
@@ -59,7 +59,7 @@ public class SequenceStrategyTest extends AbstractGremlinTest {
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
public void shouldAppendMultiPropertyValuesToVertex() {
- final StrategyGraph swg = g.strategy(SequenceStrategy.build().sequence(
+ final StrategyGraph swg = graph.strategy(SequenceStrategy.build().sequence(
new GraphStrategy() {
@Override
public UnaryOperator<Function<Object[], Vertex>> getAddVertexStrategy(final StrategyContext ctx, final GraphStrategy composingStrategy) {
@@ -113,7 +113,7 @@ public class SequenceStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldOverwritePropertyValuesToVertex() {
- final StrategyGraph swg = g.strategy(SequenceStrategy.build().sequence(
+ final StrategyGraph swg = graph.strategy(SequenceStrategy.build().sequence(
new GraphStrategy() {
@Override
public UnaryOperator<Function<Object[], Vertex>> getAddVertexStrategy(final StrategyContext ctx, final GraphStrategy composingStrategy) {
@@ -169,7 +169,7 @@ public class SequenceStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldAllowForALocalGraphStrategyCallInSequence() {
- final StrategyGraph swg = g.strategy(SequenceStrategy.build().sequence(
+ final StrategyGraph swg = graph.strategy(SequenceStrategy.build().sequence(
new GraphStrategy() {
@Override
public UnaryOperator<Function<Object[], Vertex>> getAddVertexStrategy(final StrategyContext ctx, final GraphStrategy composingStrategy) {
@@ -265,7 +265,7 @@ public class SequenceStrategyTest extends AbstractGremlinTest {
}
}).create();
- final StrategyGraph swg = g.strategy(SequenceStrategy.build().sequence(
+ final StrategyGraph swg = graph.strategy(SequenceStrategy.build().sequence(
new GraphStrategy() {
@Override
public UnaryOperator<Function<Object[], Vertex>> getAddVertexStrategy(final StrategyContext ctx, final GraphStrategy composingStrategy) {
@@ -299,7 +299,7 @@ public class SequenceStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldAlterArgumentsToAddVertexInOrderOfSequence() {
- final StrategyGraph swg = g.strategy(SequenceStrategy.build().sequence(
+ final StrategyGraph swg = graph.strategy(SequenceStrategy.build().sequence(
new GraphStrategy() {
@Override
public UnaryOperator<Function<Object[], Vertex>> getAddVertexStrategy(final StrategyContext ctx, final GraphStrategy composingStrategy) {
@@ -350,7 +350,7 @@ public class SequenceStrategyTest extends AbstractGremlinTest {
@Test(expected = RuntimeException.class)
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldShortCircuitStrategyWithException() {
- final StrategyGraph swg = g.strategy(SequenceStrategy.build().sequence(
+ final StrategyGraph swg = graph.strategy(SequenceStrategy.build().sequence(
new GraphStrategy() {
@Override
public UnaryOperator<Function<Object[], Vertex>> getAddVertexStrategy(final StrategyContext ctx, final GraphStrategy composingStrategy) {
@@ -387,7 +387,7 @@ public class SequenceStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldShortCircuitStrategyWithNoOp() {
- final StrategyGraph swg = g.strategy(SequenceStrategy.build().sequence(
+ final StrategyGraph swg = graph.strategy(SequenceStrategy.build().sequence(
new GraphStrategy() {
@Override
public UnaryOperator<Function<Object[], Vertex>> getAddVertexStrategy(final StrategyContext ctx, final GraphStrategy composingStrategy) {
@@ -423,7 +423,7 @@ public class SequenceStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldDoSomethingBeforeAndAfter() {
- final StrategyGraph swg = g.strategy(SequenceStrategy.build().sequence(
+ final StrategyGraph swg = graph.strategy(SequenceStrategy.build().sequence(
new GraphStrategy() {
@Override
public UnaryOperator<Function<Object[], Vertex>> getAddVertexStrategy(final StrategyContext ctx, final GraphStrategy composingStrategy) {
@@ -483,7 +483,7 @@ public class SequenceStrategyTest extends AbstractGremlinTest {
// invoke all the strategy methods
Stream.of(methods).forEach(method -> {
try {
- method.invoke(strategy, new StrategyContext(new StrategyGraph(g), new StrategyWrapped() {
+ method.invoke(strategy, new StrategyContext(new StrategyGraph(graph), new StrategyWrapped() {
}), strategy);
} catch (Exception ex) {
ex.printStackTrace();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/41f0fe4e/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
index bd041b2..d630f8e 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
@@ -160,7 +160,7 @@ public class TinkerFactory {
}
public SocialTraversal<S, Vertex> people(final String name) {
- return (SocialTraversal) this.addStep(new StartStep<>(this, this.graph.V().has("name", name)));
+ return (SocialTraversal) this.addStep(new StartStep<>(this, this.graph.traversal().V().has("name", name)));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/41f0fe4e/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
index 8aeec48..a24b1d8 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
@@ -20,11 +20,15 @@ package org.apache.tinkerpop.gremlin.tinkergraph.structure;
import org.apache.commons.io.FileUtils;
import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.GraphTraversalContext;
import org.apache.tinkerpop.gremlin.process.T;
import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.GraphTraversalContext;
import org.apache.tinkerpop.gremlin.process.traversal.engine.StandardTraversalEngine;
-import org.apache.tinkerpop.gremlin.structure.*;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Operator;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
@@ -36,7 +40,11 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-import java.io.*;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
@@ -96,7 +104,7 @@ public class TinkerGraphTest {
v7.addEdge("link", v9, "weight", 1f);
v8.addEdge("link", v9, "weight", 7f);
- g.V(v1).withSack(Float.MIN_VALUE).repeat(outE().sack(Operator.max, "weight").inV()).times(5).sack().forEachRemaining(System.out::println);
+ g.traversal().V(v1).withSack(Float.MIN_VALUE).repeat(outE().sack(Operator.max, "weight").inV()).times(5).sack().forEachRemaining(System.out::println);
}
/* @Test
@@ -111,8 +119,9 @@ public class TinkerGraphTest {
@Test
@Ignore
public void benchmarkStandardTraversals() throws Exception {
- Graph g = TinkerGraph.open();
- g.io().readGraphML("data/grateful-dead.xml");
+ Graph graph = TinkerGraph.open();
+ GraphTraversalContext g = graph.traversal();
+ graph.io().readGraphML("data/grateful-dead.xml");
final List<Supplier<Traversal>> traversals = Arrays.asList(
() -> g.V().outE().inV().outE().inV().outE().inV(),
() -> g.V().out().out().out(),
@@ -144,8 +153,9 @@ public class TinkerGraphTest {
@Test
@Ignore
public void testPlay4() throws Exception {
- Graph g = TinkerGraph.open();
- g.io().readGraphML("/Users/marko/software/tinkerpop/tinkerpop3/data/grateful-dead.xml");
+ Graph graph = TinkerGraph.open();
+ graph.io().readGraphML("/Users/marko/software/tinkerpop/tinkerpop3/data/grateful-dead.xml");
+ GraphTraversalContext g = graph.traversal();
final List<Supplier<Traversal>> traversals = Arrays.asList(
() -> g.V().has(T.label, "song").out().groupCount().<Vertex>by(t ->
g.V(t).choose(r -> g.V(r).has(T.label, "artist").hasNext(),
@@ -175,7 +185,7 @@ public class TinkerGraphTest {
@Test
@Ignore
public void testPlayDK() throws Exception {
- Graph g = TinkerFactory.createModern();
+ GraphTraversalContext g = TinkerFactory.createModern().traversal();
Traversal t = g.V().hasLabel("person").as("person").local(bothE().label().groupCount().cap()).as("relations").select().by("name").by();
t.forEachRemaining(System.out::println);
System.out.println("--");
@@ -225,7 +235,7 @@ public class TinkerGraphTest {
@Test
public void shouldWriteClassicVerticesAsGryo() throws IOException {
final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-classic-vertices.kryo");
- GryoWriter.build().create().writeVertices(os, TinkerFactory.createClassic().V(), Direction.BOTH);
+ GryoWriter.build().create().writeVertices(os, TinkerFactory.createClassic().traversal().V(), Direction.BOTH);
os.close();
}
@@ -235,7 +245,7 @@ public class TinkerGraphTest {
@Test
public void shouldWriteClassicVerticesAsGraphSON() throws IOException {
final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-classic-vertices.ldjson");
- GraphSONWriter.build().create().writeVertices(os, TinkerFactory.createClassic().V(), Direction.BOTH);
+ GraphSONWriter.build().create().writeVertices(os, TinkerFactory.createClassic().traversal().V(), Direction.BOTH);
os.close();
}
@@ -245,7 +255,7 @@ public class TinkerGraphTest {
@Test
public void shouldWriteModernVerticesAsGryo() throws IOException {
final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-modern-vertices.kryo");
- GryoWriter.build().create().writeVertices(os, TinkerFactory.createModern().V(), Direction.BOTH);
+ GryoWriter.build().create().writeVertices(os, TinkerFactory.createModern().traversal().V(), Direction.BOTH);
os.close();
}
@@ -255,7 +265,7 @@ public class TinkerGraphTest {
@Test
public void shouldWriteModernVerticesAsGraphSON() throws IOException {
final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-modern-vertices.ldjson");
- GraphSONWriter.build().create().writeVertices(os, TinkerFactory.createModern().V(), Direction.BOTH);
+ GraphSONWriter.build().create().writeVertices(os, TinkerFactory.createModern().traversal().V(), Direction.BOTH);
os.close();
}
@@ -265,7 +275,7 @@ public class TinkerGraphTest {
@Test
public void shouldWriteCrewVerticesAsGryo() throws IOException {
final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-crew-vertices.kryo");
- GryoWriter.build().create().writeVertices(os, TinkerFactory.createTheCrew().V(), Direction.BOTH);
+ GryoWriter.build().create().writeVertices(os, TinkerFactory.createTheCrew().traversal().V(), Direction.BOTH);
os.close();
}
@@ -461,7 +471,7 @@ public class TinkerGraphTest {
// is used because only "stephen" ages should pass through the pipeline due to the inclusion of the
// key index lookup on "name". If there's an age of something other than 35 in the pipeline being evaluated
// then something is wrong.
- assertEquals(1, StreamFactory.stream(g.V().has("age", (t, u) -> {
+ assertEquals(1, StreamFactory.stream(g.traversal().V().has("age", (t, u) -> {
assertEquals(35, t);
return true;
}, 35).has("name", "stephen")).count());
@@ -482,13 +492,13 @@ public class TinkerGraphTest {
// is used because only "stephen" ages should pass through the pipeline due to the inclusion of the
// key index lookup on "name". If there's an age of something other than 35 in the pipeline being evaluated
// then something is wrong.
- assertEquals(2, StreamFactory.stream(g.V().has("age", (t, u) -> {
+ assertEquals(2, StreamFactory.stream(g.traversal().V().has("age", (t, u) -> {
assertEquals(35, t);
return true;
}, 35).has("name", "stephen")).count());
v.remove();
- assertEquals(1, StreamFactory.stream(g.V().has("age", (t, u) -> {
+ assertEquals(1, StreamFactory.stream(g.traversal().V().has("age", (t, u) -> {
assertEquals(35, t);
return true;
}, 35).has("name", "stephen")).count());
@@ -505,7 +515,7 @@ public class TinkerGraphTest {
// a tricky way to evaluate if indices are actually being used is to pass a fake BiPredicate to has()
// to get into the Pipeline and evaluate what's going through it. in this case, we know that at index
// is not used because "stephen" and "marko" ages both pass through the pipeline.
- assertEquals(1, StreamFactory.stream(g.V().has("age", (t, u) -> {
+ assertEquals(1, StreamFactory.stream(g.traversal().V().has("age", (t, u) -> {
assertTrue(t.equals(35) || t.equals(29));
return true;
}, 35).has("name", "stephen")).count());
@@ -516,7 +526,7 @@ public class TinkerGraphTest {
// is used because only "stephen" ages should pass through the pipeline due to the inclusion of the
// key index lookup on "name". If there's an age of something other than 35 in the pipeline being evaluated
// then something is wrong.
- assertEquals(1, StreamFactory.stream(g.V().has("age", (t, u) -> {
+ assertEquals(1, StreamFactory.stream(g.traversal().V().has("age", (t, u) -> {
assertEquals(35, t);
return true;
}, 35).has("name", "stephen")).count());
@@ -537,7 +547,7 @@ public class TinkerGraphTest {
// is used because only oid 1 should pass through the pipeline due to the inclusion of the
// key index lookup on "oid". If there's an weight of something other than 0.5f in the pipeline being
// evaluated then something is wrong.
- assertEquals(1, StreamFactory.stream(g.E().has("weight", (t, u) -> {
+ assertEquals(1, StreamFactory.stream(g.traversal().E().has("weight", (t, u) -> {
assertEquals(0.5f, t);
return true;
}, 0.5).has("oid", "1")).count());
@@ -559,13 +569,13 @@ public class TinkerGraphTest {
// is used because only oid 1 should pass through the pipeline due to the inclusion of the
// key index lookup on "oid". If there's an weight of something other than 0.5f in the pipeline being
// evaluated then something is wrong.
- assertEquals(2, StreamFactory.stream(g.E().has("weight", (t, u) -> {
+ assertEquals(2, StreamFactory.stream(g.traversal().E().has("weight", (t, u) -> {
assertEquals(0.5f, t);
return true;
}, 0.5).has("oid", "1")).count());
e.remove();
- assertEquals(1, StreamFactory.stream(g.E().has("weight", (t, u) -> {
+ assertEquals(1, StreamFactory.stream(g.traversal().E().has("weight", (t, u) -> {
assertEquals(0.5f, t);
return true;
}, 0.5).has("oid", "1")).count());
@@ -583,7 +593,7 @@ public class TinkerGraphTest {
// a tricky way to evaluate if indices are actually being used is to pass a fake BiPredicate to has()
// to get into the Pipeline and evaluate what's going through it. in this case, we know that at index
// is not used because "1" and "2" weights both pass through the pipeline.
- assertEquals(1, StreamFactory.stream(g.E().has("weight", (t, u) -> {
+ assertEquals(1, StreamFactory.stream(g.traversal().E().has("weight", (t, u) -> {
assertTrue(t.equals(0.5f) || t.equals(0.6f));
return true;
}, 0.5).has("oid", "1")).count());
@@ -594,7 +604,7 @@ public class TinkerGraphTest {
// is used because only oid 1 should pass through the pipeline due to the inclusion of the
// key index lookup on "oid". If there's an weight of something other than 0.5f in the pipeline being
// evaluated then something is wrong.
- assertEquals(1, StreamFactory.stream(g.E().has("weight", (t, u) -> {
+ assertEquals(1, StreamFactory.stream(g.traversal().E().has("weight", (t, u) -> {
assertEquals(0.5f, t);
return true;
}, 0.5).has("oid", "1")).count());
@@ -620,7 +630,7 @@ public class TinkerGraphTest {
*/
final Graph ng = TinkerGraph.open();
- g.V().sideEffect(ov -> {
+ g.traversal().V().sideEffect(ov -> {
final Vertex v = ov.get();
if (v.label().equals("song"))
ng.addVertex(T.id, Integer.parseInt(v.id().toString()), T.label, "song", "name", v.value("name"), "performances", v.property("performances").orElse(0), "songType", v.property("songType").orElse(""));
@@ -630,10 +640,10 @@ public class TinkerGraphTest {
throw new RuntimeException("damn");
}).iterate();
- g.E().sideEffect(oe -> {
+ g.traversal().E().sideEffect(oe -> {
final Edge e = oe.get();
- final Vertex v2 = ng.V(Integer.parseInt(e.inVertex().id().toString())).next();
- final Vertex v1 = ng.V(Integer.parseInt(e.outVertex().id().toString())).next();
+ final Vertex v2 = ng.traversal().V(Integer.parseInt(e.inVertex().id().toString())).next();
+ final Vertex v1 = ng.traversal().V(Integer.parseInt(e.outVertex().id().toString())).next();
if (e.label().equals("followedBy"))
v1.addEdge("followedBy", v2, T.id, Integer.parseInt(e.id().toString()), "weight", e.value("weight"));
@@ -659,11 +669,11 @@ public class TinkerGraphTest {
os3.close();
final OutputStream os4 = new FileOutputStream(tempPath + "grateful-dead-vertices.kryo");
- GryoWriter.build().create().writeVertices(os4, g.V(), Direction.BOTH);
+ GryoWriter.build().create().writeVertices(os4, g.traversal().V(), Direction.BOTH);
os.close();
final OutputStream os5 = new FileOutputStream(tempPath + "grateful-dead-vertices.ldjson");
- GraphSONWriter.build().create().writeVertices(os5, g.V(), Direction.BOTH);
+ GraphSONWriter.build().create().writeVertices(os5, g.traversal().V(), Direction.BOTH);
os.close();
}
}