Repository: tinkerpop
Updated Branches:
refs/heads/tp32 eb2585b66 -> 1cd042b61
Fixed a bug where ReferenceVertex was not returning label() (only EMPTY_STRING). ReferenceEdge and ReferenceVertexProperty were behaving correctly, but I needed to make a change at ReferenceElement for general handling. Thus, those other two classes changed. And thus, the Gryo. I updated all the ReferenceXXXTest classes to check for label() to be certain of proper data handling. Updated CHANGELOG and upgrade docs.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d6cb13e8
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d6cb13e8
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d6cb13e8
Branch: refs/heads/tp32
Commit: d6cb13e8fb1ff37b354d31cdc96aa5a765538e02
Parents: 98ed3d4
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Sep 21 13:23:15 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Sep 21 13:23:15 2017 -0600
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
docs/src/upgrade/release-3.2.x-incubating.asciidoc | 13 +++++++++++++
.../structure/util/reference/ReferenceEdge.java | 7 -------
.../structure/util/reference/ReferenceElement.java | 6 +++---
.../util/reference/ReferenceVertexProperty.java | 9 +--------
.../structure/util/reference/ReferenceEdgeTest.java | 6 +++++-
.../util/reference/ReferenceVertexPropertyTest.java | 8 +++++++-
.../structure/util/reference/ReferenceVertexTest.java | 1 +
8 files changed, 31 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ecfd078..795a3b0 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* `ReferenceVertex` was missing its `label()` string. `ReferenceElement` now supports all label handling.
* Added `GraphHelper.cloneElements(Graph original, Graph clone)` to the `gremlin-test` module to quickly clone a graph.
* Bump to GMavenPlus 1.6.
* Added better error message for illegal use of `repeat()`-step.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 71d1930..5f9043b 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -95,6 +95,19 @@ In `gremlin-test` there is a new `GraphHelper` class that has a `cloneElements()
the first graph to the second - `GraphHelper.cloneElements(Graph original, Graph clone)`. This helper method is
primarily intended for use in tests.
+Upgrading for Providers
+~~~~~~~~~~~~~~~~~~~~~~~
+
+ReferenceVertex Label
+^^^^^^^^^^^^^^^^^^^^^
+
+`ReferenceVertex.label()` was hard coded to return `EMPTY_STRING`. At some point, `ReferenceElements` were support to
+return labels and `ReferenceVertex` was never updated as such. Note that `ReferenceEdge` and `ReferenceVertexProperty`
+work as expected. However, given a general change at `ReferenceElement`, the Gryo serialization of `ReferenceXXX` is
+different.
+
+See: https://issues.apache.org/jira/browse/TINKERPOP-1789[TINKERPOP-1789]
+
TinkerPop 3.2.6
---------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
index 51711c9..a353ea7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
@@ -36,7 +36,6 @@ public class ReferenceEdge extends ReferenceElement<Edge> implements Edge {
private ReferenceVertex inVertex;
private ReferenceVertex outVertex;
- private String label;
private ReferenceEdge() {
@@ -46,7 +45,6 @@ public class ReferenceEdge extends ReferenceElement<Edge> implements Edge {
super(edge);
this.inVertex = new ReferenceVertex(edge.inVertex());
this.outVertex = new ReferenceVertex(edge.outVertex());
- this.label = edge.label();
}
@Override
@@ -88,9 +86,4 @@ public class ReferenceEdge extends ReferenceElement<Edge> implements Edge {
public String toString() {
return StringFactory.edgeString(this);
}
-
- @Override
- public String label() {
- return this.label;
- }
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
index dfdf5a9..14e5ab3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
@@ -31,9 +31,8 @@ import java.io.Serializable;
*/
public abstract class ReferenceElement<E extends Element> implements Element, Serializable, Attachable<E> {
- protected static final String EMPTY_STRING = "";
-
protected Object id;
+ protected String label;
protected ReferenceElement() {
@@ -41,6 +40,7 @@ public abstract class ReferenceElement<E extends Element> implements Element, Se
public ReferenceElement(final Element element) {
this.id = element.id();
+ this.label = element.label();
}
@Override
@@ -50,7 +50,7 @@ public abstract class ReferenceElement<E extends Element> implements Element, Se
@Override
public String label() {
- return EMPTY_STRING;
+ return this.label;
}
@Override
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
index 93b4c48..e607ebb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
@@ -34,7 +34,6 @@ import java.util.NoSuchElementException;
public class ReferenceVertexProperty<V> extends ReferenceElement<VertexProperty<V>> implements VertexProperty<V> {
private ReferenceVertex vertex;
- private String key;
private V value;
private ReferenceVertexProperty() {
@@ -44,7 +43,6 @@ public class ReferenceVertexProperty<V> extends ReferenceElement<VertexProperty<
public ReferenceVertexProperty(final VertexProperty<V> vertexProperty) {
super(vertexProperty);
this.vertex = ReferenceFactory.detach(vertexProperty.element());
- this.key = vertexProperty.key();
this.value = vertexProperty.value();
}
@@ -55,12 +53,7 @@ public class ReferenceVertexProperty<V> extends ReferenceElement<VertexProperty<
@Override
public String key() {
- return this.key;
- }
-
- @Override
- public String label() {
- return this.key;
+ return this.label();
}
@Override
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
index a0d3a3d..3602223 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
@@ -34,7 +34,10 @@ import org.junit.Test;
import java.util.HashSet;
import java.util.Set;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -60,6 +63,7 @@ public class ReferenceEdgeTest extends AbstractGremlinTest {
final Vertex v = graph.addVertex();
final Edge e = v.addEdge("test", v);
final ReferenceEdge re = ReferenceFactory.detach(e);
+ assertEquals("test", e.label());
assertSame(re, ReferenceFactory.detach(re));
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
index 1920e67..15980da 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
@@ -25,7 +25,10 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.apache.tinkerpop.gremlin.structure.util.Attachable;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -38,6 +41,9 @@ public class ReferenceVertexPropertyTest extends AbstractGremlinTest {
final Vertex v = graph.addVertex();
final VertexProperty vp = v.property(VertexProperty.Cardinality.single, "test", "this");
final ReferenceVertexProperty dvp = ReferenceFactory.detach(vp);
+ assertEquals("test", vp.label());
+ assertEquals("test", vp.key());
+ assertEquals("this", vp.value());
assertSame(dvp, ReferenceFactory.detach(dvp));
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
index 35c31c6..e342e1e 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
@@ -74,6 +74,7 @@ public class ReferenceVertexTest extends AbstractGremlinTest {
final ReferenceVertex referenceVertex = ReferenceFactory.detach(v);
assertEquals(v.id(), referenceVertex.id());
+ assertEquals("test", v.label());
assertEquals(0, IteratorUtils.count(referenceVertex.properties()));
}
GremlinResultSetIntegrateTest assiming EMPTY_STRING.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/cf393e5e
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/cf393e5e
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/cf393e5e
Branch: refs/heads/tp32
Commit: cf393e5e9b8a3fc2841946f7c5ccb01b98025bc9
Parents: fb1e245
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Sep 21 14:48:46 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Sep 21 14:48:46 2017 -0600
----------------------------------------------------------------------
.../tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cf393e5e/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
index ec39dec..d890b85 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
@@ -148,7 +148,7 @@ public class GremlinResultSetIntegrateTest extends AbstractGremlinServerIntegrat
assertThat(v, instanceOf(ReferenceVertex.class));
assertEquals(1L, v.id());
- assertEquals("", v.label());
+ assertEquals("person", v.label());
assertEquals(0, IteratorUtils.count(v.properties()));
}
updated upgrade doc. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/fb1e2459 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/fb1e2459 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/fb1e2459 Branch: refs/heads/tp32 Commit: fb1e2459b058725640c6b0bcfb9cf8d6f7e519fe Parents: 9f252f0 Author: Marko A. Rodriguez <ok...@gmail.com> Authored: Thu Sep 21 14:01:20 2017 -0600 Committer: Marko A. Rodriguez <ok...@gmail.com> Committed: Thu Sep 21 14:01:20 2017 -0600 ---------------------------------------------------------------------- docs/src/upgrade/release-3.2.x-incubating.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fb1e2459/docs/src/upgrade/release-3.2.x-incubating.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc index 5f9043b..74a5d5e 100644 --- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc +++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc @@ -104,7 +104,7 @@ ReferenceVertex Label `ReferenceVertex.label()` was hard coded to return `EMPTY_STRING`. At some point, `ReferenceElements` were support to return labels and `ReferenceVertex` was never updated as such. Note that `ReferenceEdge` and `ReferenceVertexProperty` work as expected. However, given a general change at `ReferenceElement`, the Gryo serialization of `ReferenceXXX` is -different. +different. If the vertex does not have a label `Vertex.DEFAULT_LABEL` is assumed. See: https://issues.apache.org/jira/browse/TINKERPOP-1789[TINKERPOP-1789]
Merge branch 'TINKERPOP-1789' into tp32 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1cd042b6 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1cd042b6 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1cd042b6 Branch: refs/heads/tp32 Commit: 1cd042b61d0dea08d003a7ff9e57f175343c039c Parents: eb2585b 20d22db Author: Marko A. Rodriguez <ok...@gmail.com> Authored: Thu Sep 28 14:06:01 2017 -0600 Committer: Marko A. Rodriguez <ok...@gmail.com> Committed: Thu Sep 28 14:06:01 2017 -0600 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 1 + .../upgrade/release-3.2.x-incubating.asciidoc | 12 ++++++++++++ .../structure/util/reference/ReferenceEdge.java | 7 ------- .../util/reference/ReferenceElement.java | 20 ++++++++++++++++---- .../util/reference/ReferenceVertexProperty.java | 9 +-------- .../ser/GryoLiteMessageSerializerV1d0Test.java | 8 ++++---- .../server/GremlinResultSetIntegrateTest.java | 2 +- .../util/reference/ReferenceEdgeTest.java | 6 +++++- .../reference/ReferenceVertexPropertyTest.java | 8 +++++++- .../util/reference/ReferenceVertexTest.java | 5 ++++- 10 files changed, 51 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cd042b6/CHANGELOG.asciidoc ---------------------------------------------------------------------- diff --cc CHANGELOG.asciidoc index 7ae7dfa,795a3b0..e48dfb5 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@@ -21,8 -23,10 +21,9 @@@ limitations under the License image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/images/nine-inch-gremlins.png[width=185] [[release-3-2-7]] -TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +=== TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET) + * `ReferenceVertex` was missing its `label()` string. `ReferenceElement` now supports all label handling. * Added `GraphHelper.cloneElements(Graph original, Graph clone)` to the `gremlin-test` module to quickly clone a graph. * Bump to GMavenPlus 1.6. * Added better error message for illegal use of `repeat()`-step. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cd042b6/docs/src/upgrade/release-3.2.x-incubating.asciidoc ---------------------------------------------------------------------- diff --cc docs/src/upgrade/release-3.2.x-incubating.asciidoc index 681631c,f35e990..732e29e --- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc +++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc @@@ -102,11 -95,26 +102,12 @@@ In `gremlin-test` there is a new `Graph the first graph to the second - `GraphHelper.cloneElements(Graph original, Graph clone)`. This helper method is primarily intended for use in tests. -Upgrading for Providers -~~~~~~~~~~~~~~~~~~~~~~~ +== TinkerPop 3.2.6 -ReferenceVertex Label -^^^^^^^^^^^^^^^^^^^^^ - -`ReferenceVertex.label()` was hard coded to return `EMPTY_STRING`. At some point, `ReferenceElements` were suppose to -return labels and `ReferenceVertex` was never updated as such. Note that `ReferenceEdge` and `ReferenceVertexProperty` -work as expected. However, given a general change at `ReferenceElement`, the Gryo serialization of `ReferenceXXX` is -different. If the vertex does not have a label `Vertex.DEFAULT_LABEL` is assumed. - -See: https://issues.apache.org/jira/browse/TINKERPOP-1789[TINKERPOP-1789] - -TinkerPop 3.2.6 ---------------- + *Release Date: August 21, 2017* -Upgrading for Users -~~~~~~~~~~~~~~~~~~~ +=== Upgrading for Users Please see the link:https://github.com/apache/tinkerpop/blob/3.2.6/CHANGELOG.asciidoc#release-3-2-6[changelog] for a complete list of all the modifications that are part of this release. @@@ -126,7 -136,8 +127,18 @@@ authentication for both protocols in co See: link:https://issues.apache.org/jira/browse/TINKERPOP-915[TINKERPOP-915] -TinkerPop 3.2.5 ---------------- ++=== Upgrading for Providers ++ ++==== ReferenceVertex Label ++ ++`ReferenceVertex.label()` was hard coded to return `EMPTY_STRING`. At some point, `ReferenceElements` were suppose to ++return labels and `ReferenceVertex` was never updated as such. Note that `ReferenceEdge` and `ReferenceVertexProperty` ++work as expected. However, given a general change at `ReferenceElement`, the Gryo serialization of `ReferenceXXX` is ++different. If the vertex does not have a label `Vertex.DEFAULT_LABEL` is assumed. ++ ++See: https://issues.apache.org/jira/browse/TINKERPOP-1789[TINKERPOP-1789] ++ +== TinkerPop 3.2.5 *Release Date: June 12, 2017*
fixed doc bug. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/20d22db8 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/20d22db8 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/20d22db8 Branch: refs/heads/tp32 Commit: 20d22db8bc06b1a935edab90bb6f4ac078e4c432 Parents: cf393e5 Author: Marko A. Rodriguez <ok...@gmail.com> Authored: Fri Sep 22 08:48:11 2017 -0600 Committer: Marko A. Rodriguez <ok...@gmail.com> Committed: Fri Sep 22 08:48:11 2017 -0600 ---------------------------------------------------------------------- docs/src/upgrade/release-3.2.x-incubating.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/20d22db8/docs/src/upgrade/release-3.2.x-incubating.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc index 74a5d5e..f35e990 100644 --- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc +++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc @@ -101,7 +101,7 @@ Upgrading for Providers ReferenceVertex Label ^^^^^^^^^^^^^^^^^^^^^ -`ReferenceVertex.label()` was hard coded to return `EMPTY_STRING`. At some point, `ReferenceElements` were support to +`ReferenceVertex.label()` was hard coded to return `EMPTY_STRING`. At some point, `ReferenceElements` were suppose to return labels and `ReferenceVertex` was never updated as such. Note that `ReferenceEdge` and `ReferenceVertexProperty` work as expected. However, given a general change at `ReferenceElement`, the Gryo serialization of `ReferenceXXX` is different. If the vertex does not have a label `Vertex.DEFAULT_LABEL` is assumed.
tweak to ReferenceXXXTest
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b61f2b4d
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b61f2b4d
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b61f2b4d
Branch: refs/heads/tp32
Commit: b61f2b4db2f407843f77fc288aa23d4aff981513
Parents: 291532c
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Sep 21 13:47:44 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Sep 21 13:47:44 2017 -0600
----------------------------------------------------------------------
.../gremlin/structure/util/reference/ReferenceEdgeTest.java | 2 +-
.../structure/util/reference/ReferenceVertexPropertyTest.java | 6 +++---
.../gremlin/structure/util/reference/ReferenceVertexTest.java | 6 ++++--
3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f2b4d/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
index 3602223..c3805dd 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
@@ -63,7 +63,7 @@ public class ReferenceEdgeTest extends AbstractGremlinTest {
final Vertex v = graph.addVertex();
final Edge e = v.addEdge("test", v);
final ReferenceEdge re = ReferenceFactory.detach(e);
- assertEquals("test", e.label());
+ assertEquals("test", re.label());
assertSame(re, ReferenceFactory.detach(re));
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f2b4d/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
index 15980da..a125115 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
@@ -41,9 +41,9 @@ public class ReferenceVertexPropertyTest extends AbstractGremlinTest {
final Vertex v = graph.addVertex();
final VertexProperty vp = v.property(VertexProperty.Cardinality.single, "test", "this");
final ReferenceVertexProperty dvp = ReferenceFactory.detach(vp);
- assertEquals("test", vp.label());
- assertEquals("test", vp.key());
- assertEquals("this", vp.value());
+ assertEquals("test", dvp.label());
+ assertEquals("test", dvp.key());
+ assertEquals("this", dvp.value());
assertSame(dvp, ReferenceFactory.detach(dvp));
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b61f2b4d/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
index e342e1e..07d82b9 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
@@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
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.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.apache.tinkerpop.gremlin.structure.util.Attachable;
@@ -70,11 +71,12 @@ public class ReferenceVertexTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldConstructReferenceVertex() {
- final Vertex v = graph.addVertex("test", "123");
+ final Vertex v = graph.addVertex(T.label, "blah", "test", "123");
final ReferenceVertex referenceVertex = ReferenceFactory.detach(v);
assertEquals(v.id(), referenceVertex.id());
- assertEquals("test", v.label());
+ assertEquals("blah", referenceVertex.label());
+ assertEquals(v.label(), referenceVertex.label());
assertEquals(0, IteratorUtils.count(referenceVertex.properties()));
}
got rid of unneeded EMPTY_STRING static final field.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/291532c4
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/291532c4
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/291532c4
Branch: refs/heads/tp32
Commit: 291532c476293b88a9f04b8876b3876ad084abc2
Parents: acbc18d
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Sep 21 13:36:46 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Sep 21 13:36:46 2017 -0600
----------------------------------------------------------------------
.../gremlin/structure/util/reference/ReferenceElement.java | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/291532c4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
index 1603cfb..2e45903 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
@@ -34,8 +34,6 @@ import java.io.Serializable;
*/
public abstract class ReferenceElement<E extends Element> implements Element, Serializable, Attachable<E> {
- private final static String EMPTY_STRING = "";
-
protected Object id;
protected String label;
GryoLite now assumes DEFAULT_LABEL instead of empty string.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9f252f05
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9f252f05
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9f252f05
Branch: refs/heads/tp32
Commit: 9f252f0565628913c613c21a3eaef77778f56f01
Parents: b61f2b4
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Sep 21 13:58:34 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Sep 21 13:58:34 2017 -0600
----------------------------------------------------------------------
.../driver/ser/GryoLiteMessageSerializerV1d0Test.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9f252f05/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoLiteMessageSerializerV1d0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoLiteMessageSerializerV1d0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoLiteMessageSerializerV1d0Test.java
index 2a23d02..fe1ce63 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoLiteMessageSerializerV1d0Test.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoLiteMessageSerializerV1d0Test.java
@@ -82,9 +82,9 @@ public class GryoLiteMessageSerializerV1d0Test {
assertEquals(0, IteratorUtils.count(deserializedEdge.properties()));
assertEquals(v1.id(), deserializedEdge.outVertex().id());
- assertEquals("", deserializedEdge.outVertex().label());
+ assertEquals(Vertex.DEFAULT_LABEL, deserializedEdge.outVertex().label());
assertEquals(v2.id(), deserializedEdge.inVertex().id());
- assertEquals("", deserializedEdge.inVertex().label());
+ assertEquals(Vertex.DEFAULT_LABEL, deserializedEdge.inVertex().label());
}
@Test
@@ -112,7 +112,7 @@ public class GryoLiteMessageSerializerV1d0Test {
final ReferenceVertex deserializedVertex = vertexList.get(0);
assertEquals(0L, deserializedVertex.id());
- assertEquals("", deserializedVertex.label());
+ assertEquals(Vertex.DEFAULT_LABEL, deserializedVertex.label());
assertEquals(0, IteratorUtils.count(deserializedVertex.properties()));
}
@@ -133,7 +133,7 @@ public class GryoLiteMessageSerializerV1d0Test {
final Vertex deserializedMarko = deserializedMap.keySet().iterator().next();
assertEquals(0, IteratorUtils.count(deserializedMarko.properties()));
assertEquals(1, deserializedMarko.id());
- assertEquals("", deserializedMarko.label());
+ assertEquals(Vertex.DEFAULT_LABEL, deserializedMarko.label());
assertEquals(new Integer(1000), deserializedMap.values().iterator().next());
}
In GraphComputer, labels of adjacent vertices can not be accessed. Thus, ReferenceElement needs to ensure that label() doesn't throw an UnsupportedOperationException. I borrowed the same technique used in DeatchedElement.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/acbc18dd
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/acbc18dd
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/acbc18dd
Branch: refs/heads/tp32
Commit: acbc18ddc37a6a9453d672a0b4f64bcace9cf6cf
Parents: d6cb13e
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Sep 21 13:31:18 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Sep 21 13:31:18 2017 -0600
----------------------------------------------------------------------
.../util/reference/ReferenceElement.java | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/acbc18dd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
index 14e5ab3..1603cfb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
@@ -18,10 +18,13 @@
*/
package org.apache.tinkerpop.gremlin.structure.util.reference;
+import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.apache.tinkerpop.gremlin.structure.util.Attachable;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
import java.io.Serializable;
@@ -31,6 +34,8 @@ import java.io.Serializable;
*/
public abstract class ReferenceElement<E extends Element> implements Element, Serializable, Attachable<E> {
+ private final static String EMPTY_STRING = "";
+
protected Object id;
protected String label;
@@ -40,7 +45,16 @@ public abstract class ReferenceElement<E extends Element> implements Element, Se
public ReferenceElement(final Element element) {
this.id = element.id();
- this.label = element.label();
+ try {
+ this.label = element.label();
+ } catch (final UnsupportedOperationException e) {
+ if (element instanceof Vertex)
+ this.label = Vertex.DEFAULT_LABEL;
+ else if (element instanceof Edge)
+ this.label = Edge.DEFAULT_LABEL;
+ else
+ this.label = VertexProperty.DEFAULT_LABEL;
+ }
}
@Override