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/02/10 19:45:27 UTC
incubator-tinkerpop git commit: added VertexProperty.Cardinality enum
-- single, list, set. Fixed #389.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 174ebc02c -> 600881fdf
added VertexProperty.Cardinality enum -- single, list, set. Fixed #389.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/600881fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/600881fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/600881fd
Branch: refs/heads/master
Commit: 600881fdf246d69b107ad452bee809ad2dbaabdb
Parents: 174ebc0
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Feb 10 11:45:16 2015 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Feb 10 11:45:24 2015 -0700
----------------------------------------------------------------------
.../peerpressure/PeerPressureVertexProgram.java | 18 +++--
.../ranking/pagerank/PageRankVertexProgram.java | 7 +-
.../com/tinkerpop/gremlin/structure/Vertex.java | 22 +++++-
.../gremlin/structure/VertexProperty.java | 4 ++
.../gremlin/structure/util/ElementHelper.java | 2 +-
.../structure/util/batch/BatchGraph.java | 5 --
.../groovy/loaders/SugarLoaderTest.groovy | 2 +-
.../computer/GroovyGraphComputerTest.groovy | 10 +--
.../jsr223/GremlinGroovyScriptEngineTest.java | 4 +-
.../gremlin/groovy/loaders/SugarLoader.groovy | 2 +-
.../AbstractImportCustomizerProvider.java | 4 +-
.../process/computer/GraphComputerTest.java | 5 +-
.../structure/StructureStandardSuite.java | 4 +-
.../gremlin/structure/TransactionTest.java | 8 +--
.../gremlin/structure/VertexPropertyTest.java | 72 ++++++++++++++++++--
.../tinkerpop/gremlin/structure/VertexTest.java | 4 +-
.../computer/giraph/GiraphComputeVertex.java | 3 +-
.../gremlin/neo4j/structure/Neo4jGraph.java | 27 +++++---
.../gremlin/neo4j/structure/Neo4jVertex.java | 32 ---------
.../gremlin/neo4j/structure/Neo4jGraphTest.java | 8 +--
.../tinkergraph/structure/TinkerGraphTest.java | 2 +-
21 files changed, 157 insertions(+), 88 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
index 37270f6..98fafcc 100644
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
+++ b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
@@ -30,13 +30,19 @@ import com.tinkerpop.gremlin.process.graph.traversal.__;
import com.tinkerpop.gremlin.process.util.MapHelper;
import com.tinkerpop.gremlin.structure.Edge;
import com.tinkerpop.gremlin.structure.Vertex;
+import com.tinkerpop.gremlin.structure.VertexProperty;
import com.tinkerpop.gremlin.structure.util.StringFactory;
import com.tinkerpop.gremlin.util.StreamFactory;
import org.apache.commons.configuration.Configuration;
import org.javatuples.Pair;
import java.io.Serializable;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
import java.util.function.Supplier;
/**
@@ -116,15 +122,15 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ
messenger.sendMessage(this.countScope, Pair.with('c', 1.0d));
} else {
double voteStrength = 1.0d;
- vertex.singleProperty(CLUSTER, vertex.id());
- vertex.singleProperty(VOTE_STRENGTH, voteStrength);
+ vertex.property(VertexProperty.Cardinality.single, CLUSTER, vertex.id());
+ vertex.property(VertexProperty.Cardinality.single, VOTE_STRENGTH, voteStrength);
messenger.sendMessage(this.voteScope, new Pair<>((Serializable) vertex.id(), voteStrength));
memory.and(VOTE_TO_HALT, false);
}
} else if (1 == memory.getIteration() && this.distributeVote) {
double voteStrength = 1.0d / StreamFactory.stream(messenger.receiveMessages(this.countScope)).map(Pair::getValue1).reduce(0.0d, (a, b) -> a + b);
- vertex.singleProperty(CLUSTER, vertex.id());
- vertex.singleProperty(VOTE_STRENGTH, voteStrength);
+ vertex.property(VertexProperty.Cardinality.single, CLUSTER, vertex.id());
+ vertex.property(VertexProperty.Cardinality.single, VOTE_STRENGTH, voteStrength);
messenger.sendMessage(this.voteScope, new Pair<>((Serializable) vertex.id(), voteStrength));
memory.and(VOTE_TO_HALT, false);
} else {
@@ -134,7 +140,7 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ
Serializable cluster = PeerPressureVertexProgram.largestCount(votes);
if (null == cluster) cluster = (Serializable) vertex.id();
memory.and(VOTE_TO_HALT, vertex.value(CLUSTER).equals(cluster));
- vertex.singleProperty(CLUSTER, cluster);
+ vertex.property(VertexProperty.Cardinality.single, CLUSTER, cluster);
messenger.sendMessage(this.voteScope, new Pair<>(cluster, vertex.<Double>value(VOTE_STRENGTH)));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
index ee3595f..e0f6273 100644
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
+++ b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
@@ -30,6 +30,7 @@ import com.tinkerpop.gremlin.process.computer.util.VertexProgramHelper;
import com.tinkerpop.gremlin.process.graph.traversal.__;
import com.tinkerpop.gremlin.structure.Edge;
import com.tinkerpop.gremlin.structure.Vertex;
+import com.tinkerpop.gremlin.structure.VertexProperty;
import com.tinkerpop.gremlin.structure.util.StringFactory;
import com.tinkerpop.gremlin.util.StreamFactory;
import org.apache.commons.configuration.Configuration;
@@ -120,13 +121,13 @@ public class PageRankVertexProgram extends StaticVertexProgram<Double> {
} else if (1 == memory.getIteration()) {
double initialPageRank = 1.0d / this.vertexCountAsDouble;
double edgeCount = StreamFactory.stream(messenger.receiveMessages(this.countMessageScope)).reduce(0.0d, (a, b) -> a + b);
- vertex.singleProperty(PAGE_RANK, initialPageRank);
- vertex.singleProperty(EDGE_COUNT, edgeCount);
+ vertex.property(VertexProperty.Cardinality.single,PAGE_RANK, initialPageRank);
+ vertex.property(VertexProperty.Cardinality.single,EDGE_COUNT, edgeCount);
messenger.sendMessage(this.incidentMessageScope, initialPageRank / edgeCount);
} else {
double newPageRank = StreamFactory.stream(messenger.receiveMessages(this.incidentMessageScope)).reduce(0.0d, (a, b) -> a + b);
newPageRank = (this.alpha * newPageRank) + ((1.0d - this.alpha) / this.vertexCountAsDouble);
- vertex.singleProperty(PAGE_RANK, newPageRank);
+ vertex.property(VertexProperty.Cardinality.single,PAGE_RANK, newPageRank);
messenger.sendMessage(this.incidentMessageScope, newPageRank / vertex.<Double>value(EDGE_COUNT));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Vertex.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Vertex.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Vertex.java
index 9b72b3e..b2fb418 100644
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Vertex.java
+++ b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/Vertex.java
@@ -84,9 +84,25 @@ public interface Vertex extends Element, VertexTraversal {
return vertexProperty;
}
- public default <V> VertexProperty<V> singleProperty(final String key, final V value, final Object... keyValues) {
- this.iterators().propertyIterator(key).forEachRemaining(VertexProperty::remove);
- return this.property(key, value, keyValues);
+ public default <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) {
+ if (cardinality.equals(VertexProperty.Cardinality.list))
+ return this.property(key, value, keyValues);
+ else if (cardinality.equals(VertexProperty.Cardinality.single)) {
+ this.iterators().propertyIterator(key).forEachRemaining(VertexProperty::remove);
+ return this.property(key, value, keyValues);
+ } else if (cardinality.equals(VertexProperty.Cardinality.set)) {
+ final Iterator<VertexProperty<V>> iterator = this.iterators().propertyIterator(key);
+ while (iterator.hasNext()) {
+ final VertexProperty<V> property = iterator.next();
+ if (property.value().equals(value)) {
+ ElementHelper.attachProperties(property, keyValues);
+ return property;
+ }
+ }
+ return this.property(key, value, keyValues);
+ } else {
+ throw new IllegalArgumentException("The provided cardinality is unknown: " + cardinality);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/VertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/VertexProperty.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/VertexProperty.java
index 0f4826d..0eba9e6 100644
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/VertexProperty.java
+++ b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/VertexProperty.java
@@ -40,6 +40,10 @@ public interface VertexProperty<V> extends Property<V>, Element, VertexPropertyT
public static final String DEFAULT_LABEL = "vertexProperty";
+ public enum Cardinality {
+ single, list, set
+ }
+
/**
* Gets the {@link Vertex} that owns this {@code VertexProperty}.
*/
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/util/ElementHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/util/ElementHelper.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/util/ElementHelper.java
index 888e240..60a6ba7 100644
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/util/ElementHelper.java
+++ b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/util/ElementHelper.java
@@ -264,7 +264,7 @@ public class ElementHelper {
for (int i = 0; i < propertyKeyValues.length; i = i + 2) {
if (!propertyKeyValues[i].equals(T.id) && !propertyKeyValues[i].equals(T.label))
- vertex.singleProperty((String) propertyKeyValues[i], propertyKeyValues[i + 1]);
+ vertex.property(VertexProperty.Cardinality.single, (String) propertyKeyValues[i], propertyKeyValues[i + 1]);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/util/batch/BatchGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/util/batch/BatchGraph.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/util/batch/BatchGraph.java
index d31764b..4820501 100644
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/util/batch/BatchGraph.java
+++ b/gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/util/batch/BatchGraph.java
@@ -442,11 +442,6 @@ public class BatchGraph<G extends Graph> implements Graph, Graph.Iterators {
}
@Override
- public <V> VertexProperty<V> singleProperty(final String key, final V value, final Object... keyValues) {
- return getCachedVertex(externalID).singleProperty(key, value, keyValues);
- }
-
- @Override
public <V> VertexProperty<V> property(final String key) {
return getCachedVertex(externalID).property(key);
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-groovy-test/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy b/gremlin-groovy-test/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
index 786c56b..9d30e0a 100644
--- a/gremlin-groovy-test/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
@@ -130,7 +130,7 @@ class SugarLoaderTest extends AbstractGremlinTest {
println " Groovy-style: " + clock(5000) { g.V(1)['name'] = 'okram' }
println("\ng.V(1).name = 'okram'")
- println " Java8-style: " + clock(5000) { g.V(1).singleProperty('name', 'okram') }
+ println " Java8-style: " + clock(5000) { g.V(1).property(single,'name', 'okram') }
println " Groovy-style: " + clock(5000) { g.V(1).name = 'okram' }*/
println("\ng.V(1).outE")
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-groovy-test/src/main/groovy/com/tinkerpop/gremlin/process/computer/GroovyGraphComputerTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/com/tinkerpop/gremlin/process/computer/GroovyGraphComputerTest.groovy b/gremlin-groovy-test/src/main/groovy/com/tinkerpop/gremlin/process/computer/GroovyGraphComputerTest.groovy
index 62d0680..88c416e 100644
--- a/gremlin-groovy-test/src/main/groovy/com/tinkerpop/gremlin/process/computer/GroovyGraphComputerTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/com/tinkerpop/gremlin/process/computer/GroovyGraphComputerTest.groovy
@@ -76,7 +76,7 @@ public abstract class GroovyGraphComputerTest {
a.property("nameLengthCounter", a.<String>value("name").length());
c.incr("b", a.<String>value("name").length());
} else {
- a.singleProperty("nameLengthCounter", a.<String>value("name").length() + a.<Integer>value("nameLengthCounter"));
+ a.property(VertexProperty.Cardinality.single,"nameLengthCounter", a.<String>value("name").length() + a.<Integer>value("nameLengthCounter"));
}
""").terminate("gremlin-groovy", "a.getIteration() == 1")
.elementComputeKeys("nameLengthCounter").
@@ -152,7 +152,7 @@ public abstract class GroovyGraphComputerTest {
@Override
public GraphComputer get_g_compute_executeXcounterX_terminateX8X_mapreduceXcounter_aX_mapreduceXcounter_bX() {
return g.compute().program(LambdaVertexProgram.build()
- .execute("gremlin-groovy", "a.singleProperty('counter', c.isInitialIteration() ? 1 : a.value('counter') + 1)")
+ .execute("gremlin-groovy", "a.property(VertexProperty.Cardinality.single,'counter', c.isInitialIteration() ? 1 : a.value('counter') + 1)")
.terminate("gremlin-groovy", "a.getIteration() > 8")
.elementComputeKeys(["counter"] as Set).create())
.mapReduce(LambdaMapReduce.<MapReduce.NullObject, Integer, MapReduce.NullObject, Integer, Integer> build()
@@ -184,9 +184,9 @@ public abstract class GroovyGraphComputerTest {
.memoryKey("ids")
.reduceKeySort("Comparator.reverseOrder()")
.memory("""
- list = []
- a.forEachRemaining{list.add(it.getKey())}
- list
+ temp = []
+ a.forEachRemaining{temp.add(it.getKey())}
+ temp
""")
.create());
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-groovy-test/src/main/java/com/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/com/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java b/gremlin-groovy-test/src/main/java/com/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
index c43742a..1f7dbe4 100644
--- a/gremlin-groovy-test/src/main/java/com/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
+++ b/gremlin-groovy-test/src/main/java/com/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
@@ -64,9 +64,9 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
final ScriptEngine engine = new GremlinGroovyScriptEngine();
final List list = new ArrayList();
engine.put("g", g);
- engine.put("list", list);
+ engine.put("temp", list);
assertEquals(list.size(), 0);
- engine.eval("g.V(1).out().fill(list)");
+ engine.eval("g.V(1).out().fill(temp)");
assertEquals(list.size(), 3);
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-groovy/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/SugarLoader.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/SugarLoader.groovy b/gremlin-groovy/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/SugarLoader.groovy
index af4de0c..a2da2c2 100644
--- a/gremlin-groovy/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/SugarLoader.groovy
+++ b/gremlin-groovy/src/main/groovy/com/tinkerpop/gremlin/groovy/loaders/SugarLoader.groovy
@@ -116,7 +116,7 @@ class SugarLoader {
}
public static final set(final Vertex vertex, final String key, final Object value) {
- vertex.singleProperty(key, value);
+ vertex.property(VertexProperty.Cardinality.single, key, value);
}
public static final putAt(final Vertex vertex, final String key, final Object value) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-groovy/src/main/java/com/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/com/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java b/gremlin-groovy/src/main/java/com/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
index 7c68594..415fcb1 100644
--- a/gremlin-groovy/src/main/java/com/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/com/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
@@ -29,9 +29,9 @@ import com.tinkerpop.gremlin.process.computer.clustering.peerpressure.PeerPressu
import com.tinkerpop.gremlin.process.computer.lambda.LambdaVertexProgram;
import com.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
import com.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
-import com.tinkerpop.gremlin.process.graph.traversal.step.TraversalOptionParent;
import com.tinkerpop.gremlin.process.graph.traversal.GraphTraversal;
import com.tinkerpop.gremlin.process.graph.traversal.__;
+import com.tinkerpop.gremlin.process.graph.traversal.step.TraversalOptionParent;
import com.tinkerpop.gremlin.process.util.metric.TraversalMetrics;
import com.tinkerpop.gremlin.structure.Compare;
import com.tinkerpop.gremlin.structure.Contains;
@@ -39,6 +39,7 @@ import com.tinkerpop.gremlin.structure.Direction;
import com.tinkerpop.gremlin.structure.Graph;
import com.tinkerpop.gremlin.structure.Operator;
import com.tinkerpop.gremlin.structure.Order;
+import com.tinkerpop.gremlin.structure.VertexProperty;
import com.tinkerpop.gremlin.structure.io.GraphReader;
import com.tinkerpop.gremlin.structure.io.graphml.GraphMLReader;
import com.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
@@ -123,6 +124,7 @@ public abstract class AbstractImportCustomizerProvider implements ImportCustomiz
staticImports.add(Operator.class.getCanonicalName() + DOT_STAR);
staticImports.add(Scope.class.getCanonicalName() + DOT_STAR);
staticImports.add(TimeUtils.class.getCanonicalName() + DOT_STAR);
+ staticImports.add(VertexProperty.Cardinality.class.getCanonicalName() + DOT_STAR);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-test/src/main/java/com/tinkerpop/gremlin/process/computer/GraphComputerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/com/tinkerpop/gremlin/process/computer/GraphComputerTest.java b/gremlin-test/src/main/java/com/tinkerpop/gremlin/process/computer/GraphComputerTest.java
index fa5cace..e01bb97 100644
--- a/gremlin-test/src/main/java/com/tinkerpop/gremlin/process/computer/GraphComputerTest.java
+++ b/gremlin-test/src/main/java/com/tinkerpop/gremlin/process/computer/GraphComputerTest.java
@@ -25,6 +25,7 @@ import com.tinkerpop.gremlin.process.computer.lambda.LambdaMapReduce;
import com.tinkerpop.gremlin.process.computer.lambda.LambdaVertexProgram;
import com.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
import com.tinkerpop.gremlin.structure.Graph;
+import com.tinkerpop.gremlin.structure.VertexProperty;
import com.tinkerpop.gremlin.structure.util.StringFactory;
import com.tinkerpop.gremlin.util.StreamFactory;
import org.junit.Test;
@@ -382,7 +383,7 @@ public abstract class GraphComputerTest extends AbstractGremlinProcessTest {
vertex.property("nameLengthCounter", vertex.<String>value("name").length());
memory.incr("b", vertex.<String>value("name").length());
} else {
- vertex.singleProperty("nameLengthCounter", vertex.<String>value("name").length() + vertex.<Integer>value("nameLengthCounter"));
+ vertex.property(VertexProperty.Cardinality.single, "nameLengthCounter", vertex.<String>value("name").length() + vertex.<Integer>value("nameLengthCounter"));
}
}).
terminate(memory -> memory.getIteration() == 1).
@@ -458,7 +459,7 @@ public abstract class GraphComputerTest extends AbstractGremlinProcessTest {
public GraphComputer get_g_compute_executeXcounterX_terminateX8X_mapreduceXcounter_aX_mapreduceXcounter_bX() {
return g.compute().program(LambdaVertexProgram.build()
.execute((vertex, messenger, memory) -> {
- vertex.singleProperty("counter", memory.isInitialIteration() ? 1 : vertex.<Integer>value("counter") + 1);
+ vertex.property(VertexProperty.Cardinality.single, "counter", memory.isInitialIteration() ? 1 : vertex.<Integer>value("counter") + 1);
})
.terminate(memory -> memory.getIteration() > 8)
.elementComputeKeys(new HashSet<>(Arrays.asList("counter"))).create())
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/StructureStandardSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/StructureStandardSuite.java b/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/StructureStandardSuite.java
index 8ba988b..14af0d9 100644
--- a/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/StructureStandardSuite.java
+++ b/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/StructureStandardSuite.java
@@ -50,6 +50,8 @@ import java.util.stream.Stream;
* "Suite" implements {@link com.tinkerpop.gremlin.GraphProvider} as a convenience only. It could be implemented in a
* separate class file):
* <code>
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
* @RunWith(StructureStandardSuite.class)
* @StructureStandardSuite.GraphProviderClass(TinkerGraphStructureStandardTest.class) public class TinkerGraphStructureStandardTest implements GraphProvider {
* }
@@ -62,8 +64,6 @@ import java.util.stream.Stream;
* Set the {@code gremlin.structure.tests} environment variable to a comma separated list of test classes to execute.
* This setting can be helpful to restrict execution of tests to specific ones being focused on during development.
* <br/>
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class StructureStandardSuite extends AbstractGremlinSuite {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/TransactionTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/TransactionTest.java b/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/TransactionTest.java
index c6114d7..899005f 100644
--- a/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/TransactionTest.java
+++ b/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/TransactionTest.java
@@ -234,7 +234,7 @@ public class TransactionTest extends AbstractGremlinTest {
assertEquals("marko", v1.<String>value("name"));
assertEquals("marko", g.iterators().vertexIterator(v1.id()).next().<String>value("name"));
- v1.singleProperty("name", "stephen");
+ v1.property(VertexProperty.Cardinality.single, "name", "stephen");
assertEquals("stephen", v1.<String>value("name"));
assertEquals("stephen", g.iterators().vertexIterator(v1.id()).next().<String>value("name"));
@@ -275,7 +275,7 @@ public class TransactionTest extends AbstractGremlinTest {
assertEquals("marko", v1.<String>value("name"));
assertEquals("marko", g.iterators().vertexIterator(v1.id()).next().<String>value("name"));
- v1.singleProperty("name", "stephen");
+ v1.property(VertexProperty.Cardinality.single, "name", "stephen");
assertEquals("stephen", v1.<String>value("name"));
assertEquals("stephen", g.iterators().vertexIterator(v1.id()).next().<String>value("name"));
@@ -509,11 +509,11 @@ public class TransactionTest extends AbstractGremlinTest {
latch.await(10000, TimeUnit.MILLISECONDS);
// threaded transaction is not yet committed so g should not reflect any change
- assertVertexEdgeCounts(0,0);
+ assertVertexEdgeCounts(0, 0);
threadedG.tx().commit();
// there should be one vertex for each thread
- assertVertexEdgeCounts(numberOfThreads,0);
+ assertVertexEdgeCounts(numberOfThreads, 0);
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/VertexPropertyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/VertexPropertyTest.java b/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/VertexPropertyTest.java
index fc34fab..b2525fc 100644
--- a/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/VertexPropertyTest.java
+++ b/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/VertexPropertyTest.java
@@ -31,6 +31,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Arrays;
+import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.function.Consumer;
@@ -75,7 +76,7 @@ public class VertexPropertyTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = Graph.Features.VertexPropertyFeatures.FEATURE_INTEGER_VALUES)
- public void shouldAddMultiProperties() {
+ public void shouldHandleListVertexProperties() {
final Vertex v = g.addVertex("name", "marko", "age", 34);
tryCommit(g, g -> {
assertEquals("marko", v.property("name").value());
@@ -166,7 +167,7 @@ public class VertexPropertyTest extends AbstractGremlinTest {
assertTrue(values.contains("marko a. rodriguez"));
assertTrue(values.contains("marko rodriguez"));
});
- v.singleProperty("name", "okram", "acl", "private", "date", 2014);
+ v.property(VertexProperty.Cardinality.single, "name", "okram", "acl", "private", "date", 2014);
tryCommit(g, g -> {
assertEquals(1, IteratorUtils.count(v.iterators().propertyIterator("name")));
assertEquals(1, IteratorUtils.count(v.iterators().propertyIterator()));
@@ -183,7 +184,7 @@ public class VertexPropertyTest extends AbstractGremlinTest {
final Vertex u = g.addVertex("name", "marko", "name", "marko a. rodriguez", "name", "marko rodriguez");
tryCommit(g);
u.properties().remove();
- u.singleProperty("name", "okram", "acl", "private", "date", 2014);
+ u.property(VertexProperty.Cardinality.single, "name", "okram", "acl", "private", "date", 2014);
tryCommit(g, g -> {
assertEquals(1, IteratorUtils.count(u.iterators().propertyIterator("name")));
assertEquals(1, IteratorUtils.count(u.iterators().propertyIterator()));
@@ -195,6 +196,69 @@ public class VertexPropertyTest extends AbstractGremlinTest {
}
@Test
+ @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+ @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
+ @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
+ @FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = Graph.Features.VertexPropertyFeatures.FEATURE_INTEGER_VALUES)
+ @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_VERTICES)
+ public void shouldHandleSetVertexProperties() {
+ final Vertex v = g.addVertex("name", "marko", "name", "marko a. rodriguez");
+ tryCommit(g, g -> {
+ assertEquals(2, IteratorUtils.count(v.iterators().propertyIterator()));
+ assertEquals(2, IteratorUtils.count(v.iterators().propertyIterator("name")));
+ final List<String> values = IteratorUtils.list(v.iterators().valueIterator("name"));
+ assertTrue(values.contains("marko"));
+ assertTrue(values.contains("marko a. rodriguez"));
+ });
+ v.property(VertexProperty.Cardinality.set, "name", "marko rodriguez", "acl", "private");
+ tryCommit(g, g -> {
+ assertEquals(3, IteratorUtils.count(v.iterators().propertyIterator()));
+ assertEquals(3, IteratorUtils.count(v.iterators().propertyIterator("name")));
+ final List<String> values = IteratorUtils.list(v.iterators().valueIterator("name"));
+ assertTrue(values.contains("marko"));
+ assertTrue(values.contains("marko a. rodriguez"));
+ assertTrue(values.contains("marko rodriguez"));
+ final Iterator<VertexProperty<String>> iterator = v.iterators().propertyIterator("name");
+ while (iterator.hasNext()) {
+ final VertexProperty<String> property = iterator.next();
+ if (property.value().equals("marko rodriguez")) {
+ assertEquals(1, IteratorUtils.count(property.iterators().propertyIterator()));
+ assertEquals("acl", property.iterators().propertyIterator().next().key());
+ assertEquals("private", property.iterators().propertyIterator().next().value());
+ } else {
+ assertEquals(0, IteratorUtils.count(property.iterators().propertyIterator()));
+ }
+ }
+ });
+ ///
+ v.property(VertexProperty.Cardinality.set, "name", "marko rodriguez", "acl", "public", "creator", "stephen");
+ tryCommit(g, g -> {
+ assertEquals(3, IteratorUtils.count(v.iterators().propertyIterator()));
+ assertEquals(3, IteratorUtils.count(v.iterators().propertyIterator("name")));
+ final List<String> values = IteratorUtils.list(v.iterators().valueIterator("name"));
+ assertTrue(values.contains("marko"));
+ assertTrue(values.contains("marko a. rodriguez"));
+ assertTrue(values.contains("marko rodriguez"));
+ final Iterator<VertexProperty<String>> iterator = v.iterators().propertyIterator("name");
+ while (iterator.hasNext()) {
+ final VertexProperty<String> property = iterator.next();
+ if (property.value().equals("marko rodriguez")) {
+ assertEquals(2, IteratorUtils.count(property.iterators().propertyIterator()));
+ assertEquals("acl", property.iterators().propertyIterator("acl").next().key());
+ assertEquals("public", property.iterators().propertyIterator("acl").next().value());
+ assertEquals("creator", property.iterators().propertyIterator("creator").next().key());
+ assertEquals("stephen", property.iterators().propertyIterator("creator").next().value());
+ } else {
+ assertEquals(0, IteratorUtils.count(property.iterators().propertyIterator()));
+ }
+ }
+ });
+
+
+ }
+
+
+ @Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = Graph.Features.VertexPropertyFeatures.FEATURE_STRING_VALUES)
@@ -470,7 +534,7 @@ public class VertexPropertyTest extends AbstractGremlinTest {
assertEquals(3, IteratorUtils.count(v.iterators().propertyIterator("i")));
});
- v.iterators().propertyIterator("i").forEachRemaining(p -> p.property("aKey", "aValue"));
+ v.iterators().propertyIterator("i").forEachRemaining(p -> p.<String>property("aKey", "aValue"));
v.iterators().propertyIterator("i").next().iterators().propertyIterator("aKey").forEachRemaining(p -> assertEquals("aValue", p.value()));
tryCommit(g, g -> {
// validating over multi-properties and the whole graph - easier to just use traversal
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/VertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/VertexTest.java b/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/VertexTest.java
index a9373aa..47acf87 100644
--- a/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/VertexTest.java
+++ b/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/VertexTest.java
@@ -450,8 +450,8 @@ public class VertexTest {
{"property(k,v)", FunctionUtils.wrapConsumer((Vertex v) -> {
v.property("k", "v");
})},
- {"singleProperty(k,v)", FunctionUtils.wrapConsumer((Vertex v) -> {
- v.singleProperty("k", "v");
+ {"property(single,k,v)", FunctionUtils.wrapConsumer((Vertex v) -> {
+ v.property(VertexProperty.Cardinality.single, "k", "v");
})},
{"value(k)", FunctionUtils.wrapConsumer((Vertex v) -> v.value("name"))}});
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/hadoop-gremlin/src/main/java/com/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphComputeVertex.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/com/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphComputeVertex.java b/hadoop-gremlin/src/main/java/com/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphComputeVertex.java
index f073c12..a8ef4a4 100644
--- a/hadoop-gremlin/src/main/java/com/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphComputeVertex.java
+++ b/hadoop-gremlin/src/main/java/com/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphComputeVertex.java
@@ -26,6 +26,7 @@ import com.tinkerpop.gremlin.process.computer.util.MapMemory;
import com.tinkerpop.gremlin.structure.Direction;
import com.tinkerpop.gremlin.structure.Edge;
import com.tinkerpop.gremlin.structure.Graph;
+import com.tinkerpop.gremlin.structure.VertexProperty;
import com.tinkerpop.gremlin.structure.io.kryo.KryoReader;
import com.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
import com.tinkerpop.gremlin.structure.strategy.StrategyVertex;
@@ -88,7 +89,7 @@ public final class GiraphComputeVertex extends Vertex<LongWritable, Text, NullWr
final MapMemory mapMemory = new MapMemory();
memory.asMap().forEach(mapMemory::set);
mapMemory.setIteration(memory.getIteration() - 1);
- this.wrappedVertex.singleProperty(Constants.MAP_MEMORY, mapMemory); // TODO: this is a "computer key"
+ this.wrappedVertex.property(VertexProperty.Cardinality.single, Constants.MAP_MEMORY, mapMemory); // TODO: this is a "computer key"
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java b/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
index b483d55..80dde3e 100644
--- a/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
+++ b/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
@@ -23,9 +23,9 @@ import com.tinkerpop.gremlin.neo4j.process.graph.traversal.step.util.Neo4jCypher
import com.tinkerpop.gremlin.neo4j.process.graph.traversal.strategy.Neo4jGraphStepStrategy;
import com.tinkerpop.gremlin.process.TraversalStrategies;
import com.tinkerpop.gremlin.process.computer.GraphComputer;
+import com.tinkerpop.gremlin.process.graph.traversal.DefaultGraphTraversal;
import com.tinkerpop.gremlin.process.graph.traversal.GraphTraversal;
import com.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.StartStep;
-import com.tinkerpop.gremlin.process.graph.traversal.DefaultGraphTraversal;
import com.tinkerpop.gremlin.structure.Edge;
import com.tinkerpop.gremlin.structure.Graph;
import com.tinkerpop.gremlin.structure.Transaction;
@@ -63,8 +63,13 @@ import java.util.stream.Stream;
* @author Marko A. Rodriguez (http://markorodriguez.com)
* @author Pieter Martin
*/
-@Graph.OptIn(Graph.OptIn.SUITE_STRUCTURE_STANDARD)
@Graph.OptIn(Graph.OptIn.SUITE_PROCESS_STANDARD)
+@Graph.OptIn(Graph.OptIn.SUITE_STRUCTURE_STANDARD)
+@Graph.OptOut(
+ test = "com.tinkerpop.gremlin.structure.VertexTest$ExceptionConsistencyWhenVertexRemovedTest",
+ method = "shouldThrowExceptionIfVertexWasRemovedWhenCallingProperty",
+ specific = "property(single,k,v)",
+ reason = "Neo4j throws a NodeNotFoundException instead of the desired IllegalStateException")
public class Neo4jGraph implements Graph, Graph.Iterators, WrappedGraph<GraphDatabaseService> {
static {
@@ -499,7 +504,8 @@ public class Neo4jGraph implements Graph, Graph.Iterators, WrappedGraph<GraphDat
private VariableFeatures variableFeatures = new Neo4jGraphVariables.Neo4jVariableFeatures();
- Neo4jGraphGraphFeatures() {}
+ Neo4jGraphGraphFeatures() {
+ }
@Override
public boolean supportsComputer() {
@@ -521,7 +527,8 @@ public class Neo4jGraph implements Graph, Graph.Iterators, WrappedGraph<GraphDat
private final VertexPropertyFeatures vertexPropertyFeatures = new Neo4jVertexPropertyFeatures();
- Neo4jVertexFeatures() {}
+ Neo4jVertexFeatures() {
+ }
@Override
public VertexPropertyFeatures properties() {
@@ -543,7 +550,8 @@ public class Neo4jGraph implements Graph, Graph.Iterators, WrappedGraph<GraphDat
private final EdgePropertyFeatures edgePropertyFeatures = new Neo4jEdgePropertyFeatures();
- Neo4jEdgeFeatures() {}
+ Neo4jEdgeFeatures() {
+ }
@Override
public EdgePropertyFeatures properties() {
@@ -553,7 +561,8 @@ public class Neo4jGraph implements Graph, Graph.Iterators, WrappedGraph<GraphDat
public class Neo4jElementFeatures implements ElementFeatures {
- Neo4jElementFeatures() {}
+ Neo4jElementFeatures() {
+ }
@Override
public boolean supportsUserSuppliedIds() {
@@ -583,7 +592,8 @@ public class Neo4jGraph implements Graph, Graph.Iterators, WrappedGraph<GraphDat
public class Neo4jVertexPropertyFeatures implements VertexPropertyFeatures {
- Neo4jVertexPropertyFeatures() {}
+ Neo4jVertexPropertyFeatures() {
+ }
@Override
public boolean supportsMapValues() {
@@ -613,7 +623,8 @@ public class Neo4jGraph implements Graph, Graph.Iterators, WrappedGraph<GraphDat
public class Neo4jEdgePropertyFeatures implements EdgePropertyFeatures {
- Neo4jEdgePropertyFeatures() {}
+ Neo4jEdgePropertyFeatures() {
+ }
@Override
public boolean supportsMapValues() {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jVertex.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jVertex.java b/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jVertex.java
index bb2b4f2..17070da 100644
--- a/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jVertex.java
+++ b/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jVertex.java
@@ -117,38 +117,6 @@ public class Neo4jVertex extends Neo4jElement implements Vertex, Vertex.Iterator
}
@Override
- public <V> VertexProperty<V> singleProperty(final String key, final V value, final Object... keyValues) {
- if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.getBaseVertex().getId());
- if (!this.graph.supportsMultiProperties) {
- this.getBaseVertex().setProperty(key, value);
- return new Neo4jVertexProperty<>(this, key, value);
- } else {
- ElementHelper.legalPropertyKeyValueArray(keyValues);
- this.graph.tx().readWrite();
- final String prefixedKey = Neo4jVertexProperty.VERTEX_PROPERTY_PREFIX.concat(key);
- this.getBaseVertex().getRelationships(org.neo4j.graphdb.Direction.OUTGOING, DynamicRelationshipType.withName(prefixedKey)).forEach(relationship -> {
- final Node multiPropertyNode = relationship.getEndNode();
- relationship.delete();
- multiPropertyNode.delete();
- });
- if (keyValues.length == 0) {
- this.getBaseVertex().setProperty(key, value);
- return new Neo4jVertexProperty<>(this, key, value);
- } else {
- this.getBaseVertex().setProperty(key, Neo4jVertexProperty.VERTEX_PROPERTY_TOKEN);
- final Node node = this.graph.getBaseGraph().createNode(Neo4jVertexProperty.VERTEX_PROPERTY_LABEL, DynamicLabel.label(key));
- node.setProperty(T.key.getAccessor(), key);
- node.setProperty(T.value.getAccessor(), value);
- for (int i = 0; i < keyValues.length; i = i + 2) {
- node.setProperty((String) keyValues[i], keyValues[i + 1]);
- }
- this.getBaseVertex().createRelationshipTo(node, DynamicRelationshipType.withName(prefixedKey));
- return new Neo4jVertexProperty<>(this, node);
- }
- }
- }
-
- @Override
public void remove() {
if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.getBaseVertex().getId());
this.removed = true;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/neo4j-gremlin/src/test/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraphTest.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/test/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraphTest.java b/neo4j-gremlin/src/test/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraphTest.java
index c87f646..e347d17 100644
--- a/neo4j-gremlin/src/test/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraphTest.java
+++ b/neo4j-gremlin/src/test/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraphTest.java
@@ -507,7 +507,7 @@ public class Neo4jGraphTest extends BaseNeo4jGraphTest {
vertex.property("name", "marko");
assertEquals("marko", vertex.value("name"));
tryCommit(g, g -> validateCounts(g, 1, 0, 1, 0));
- vertex.singleProperty("name", "okram");
+ vertex.property(VertexProperty.Cardinality.single, "name", "okram");
tryCommit(g, g -> {
validateCounts(g, 1, 0, 1, 0);
assertEquals("okram", vertex.value("name"));
@@ -576,7 +576,7 @@ public class Neo4jGraphTest extends BaseNeo4jGraphTest {
assertEquals("virginia", b.getBaseVertex().getProperty("location"));
});
- a.singleProperty("name", "the marko");
+ a.property(VertexProperty.Cardinality.single, "name", "the marko");
tryCommit(g, g -> {
assertEquals(2, g.V().count().next().intValue());
assertEquals(1, a.properties().count().next().intValue());
@@ -606,7 +606,7 @@ public class Neo4jGraphTest extends BaseNeo4jGraphTest {
assertEquals(2, StreamFactory.stream(b.getBaseVertex().getPropertyKeys()).count());
});
- a.singleProperty("name", "the marko", "acl", "private");
+ a.property(VertexProperty.Cardinality.single, "name", "the marko", "acl", "private");
tryCommit(g, g -> {
assertEquals(2, g.V().count().next().intValue());
assertEquals(1, a.properties("name").count().next().intValue());
@@ -652,7 +652,7 @@ public class Neo4jGraphTest extends BaseNeo4jGraphTest {
a.property("name", "okram", "acl", "public");
// TODO tx.commit() THIS IS REQUIRED: ?! Why does Neo4j not delete vertices correctly?
g.tx().commit();
- a.singleProperty("name", "the marko", "acl", "private");
+ a.property(VertexProperty.Cardinality.single, "name", "the marko", "acl", "private");
tryCommit(g, g -> {
assertEquals(2, g.V().count().next().intValue());
assertEquals(1, a.properties("name").count().next().intValue());
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/600881fd/tinkergraph-gremlin/src/test/java/com/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/com/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java b/tinkergraph-gremlin/src/test/java/com/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
index 9c66e80..b5348b1 100644
--- a/tinkergraph-gremlin/src/test/java/com/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
+++ b/tinkergraph-gremlin/src/test/java/com/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
@@ -110,7 +110,7 @@ public class TinkerGraphTest {
@Ignore
public void benchmarkStandardTraversals() throws Exception {
Graph g = TinkerGraph.open();
- g.io().readGraphML("../data/grateful-dead.xml");
+ g.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(),