You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/10/28 22:26:39 UTC
[1/2] tinkerpop git commit: TINKERPOP-919 Added
supportsDuplicateMultiProperties()
Repository: tinkerpop
Updated Branches:
refs/heads/tp32 630c1ff0e -> c4682f172
TINKERPOP-919 Added supportsDuplicateMultiProperties()
That feature allows a graph to specify whether or not it supports multi-properties that allow the same value to be supplied on the same key.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3a7805c7
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3a7805c7
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3a7805c7
Branch: refs/heads/tp32
Commit: 3a7805c73301ad370e70a410326f23aa92b6e99e
Parents: 2d9bb20
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 25 13:50:48 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 26 11:08:11 2016 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../upgrade/release-3.2.x-incubating.asciidoc | 8 ++++++
.../tinkerpop/gremlin/structure/Graph.java | 12 +++++++++
.../gremlin/structure/VertexProperty.java | 4 +++
.../gremlin/structure/FeatureSupportTest.java | 27 ++++++++++++++++++--
.../gremlin/structure/VertexPropertyTest.java | 26 ++++++++++++++++---
6 files changed, 73 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 73bfa1e..1df17de 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.4 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Added `VertexFeatures.supportsDuplicateMultiProperties()` for graphs that only support unique values in multi-properties.
* Deprecated the "performance" tests in `OptIn`.
* Fixed a severe bug where `GraphComputer` strategies are not being loaded until the second use of the traversal source.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/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 0fba8f5..30daae1 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -35,6 +35,14 @@ Upgrading for Providers
Graph Database Providers
^^^^^^^^^^^^^^^^^^^^^^^^
+Duplicate Multi-Properties
+++++++++++++++++++++++++++
+
+Added `supportsDuplicateMultiProperties` to `VertexFeatures` so that graph provider who only support unique values as
+multi-properties have more flexibility in describing their graph capabilities.
+
+See: https://issues.apache.org/jira/browse/TINKERPOP-919[TINKERPOP-919]
+
Deprecated Performance OptIn
++++++++++++++++++++++++++++
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index ed3f12d..255fbca 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.engine.ComputerTraversalEngine;
import org.apache.tinkerpop.gremlin.structure.io.Io;
import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
import org.apache.tinkerpop.gremlin.structure.util.FeatureDescriptor;
@@ -512,6 +513,7 @@ public interface Graph extends AutoCloseable, Host {
public interface VertexFeatures extends ElementFeatures {
public static final String FEATURE_ADD_VERTICES = "AddVertices";
public static final String FEATURE_MULTI_PROPERTIES = "MultiProperties";
+ public static final String FEATURE_DUPLICATE_MULTI_PROPERTIES = "DuplicateMultiProperties";
public static final String FEATURE_META_PROPERTIES = "MetaProperties";
public static final String FEATURE_REMOVE_VERTICES = "RemoveVertices";
@@ -550,6 +552,16 @@ public interface Graph extends AutoCloseable, Host {
}
/**
+ * Determines if a {@link Vertex} can support non-unique values on the same key. For this value to be
+ * {@code true}, then {@link #supportsMetaProperties()} must also return true. By default this method,
+ * just returns what {@link #supportsMultiProperties()} returns.
+ */
+ @FeatureDescriptor(name = FEATURE_DUPLICATE_MULTI_PROPERTIES)
+ public default boolean supportsDuplicateMultiProperties() {
+ return supportsMultiProperties();
+ }
+
+ /**
* Determines if a {@link Vertex} can support properties on vertex properties. It is assumed that a
* graph will support all the same data types for meta-properties that are supported for regular
* properties.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
index ecbefb3..c6b443c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
@@ -99,6 +99,10 @@ public interface VertexProperty<V> extends Property<V>, Element {
return new UnsupportedOperationException("Multiple properties on a vertex is not supported");
}
+ public static UnsupportedOperationException identicalMultiPropertiesNotSupported() {
+ return new UnsupportedOperationException("Multiple properties on a vertex is supported, but a single key may not hold the same value more than once");
+ }
+
public static UnsupportedOperationException metaPropertiesNotSupported() {
return new UnsupportedOperationException("Properties on a vertex property is not supported");
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
index 98406b4..c73474c 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
@@ -697,7 +697,8 @@ public class FeatureSupportTest {
"multiPropertiesNotSupported",
"metaPropertiesNotSupported",
"userSuppliedIdsNotSupported",
- "userSuppliedIdsOfThisTypeNotSupported"
+ "userSuppliedIdsOfThisTypeNotSupported",
+ "identicalMultiPropertiesNotSupported"
})
@ExceptionCoverage(exceptionClass = Element.Exceptions.class, methods = {
"propertyRemovalNotSupported"
@@ -877,6 +878,22 @@ public class FeatureSupportTest {
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY)
+ @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_MULTI_PROPERTIES)
+ @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_DUPLICATE_MULTI_PROPERTIES, supported = false)
+ public void shouldSupportIdenticalMultiPropertyIfTheSameKeyCanBeAssignedSameValueMoreThanOnce() throws Exception {
+ try {
+ final Vertex v = graph.addVertex("name", "stephen", "name", "stephen");
+ if (2 == IteratorUtils.count(v.properties()))
+ fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_DUPLICATE_MULTI_PROPERTIES));
+ } catch (Exception ex) {
+ validateException(VertexProperty.Exceptions.identicalMultiPropertiesNotSupported(), ex);
+ }
+ }
+
+ @Test
+ @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+ @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+ @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_MULTI_PROPERTIES, supported = false)
public void shouldSupportMultiPropertyIfTheSameKeyCanBeAssignedMoreThanOnce() throws Exception {
try {
@@ -1023,7 +1040,13 @@ public class FeatureSupportTest {
@Test
public void shouldSupportRegularTransactionsIfThreadedTransactionsAreEnabled() {
if (graphFeatures.supportsThreadedTransactions())
- assertTrue(graphFeatures.supportsThreadedTransactions());
+ assertThat(graphFeatures.supportsThreadedTransactions(), is(true));
+ }
+
+ @Test
+ public void shouldSupportMultiPropertiesIfSupportingIdenticalMultiProperties() {
+ if (vertexFeatures.supportsDuplicateMultiProperties())
+ assertThat(vertexFeatures.supportsMultiProperties(), is(true));
}
}
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
index 845be70..04b431d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
@@ -34,6 +34,7 @@ import java.util.Map;
import java.util.UUID;
import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertThat;
@@ -288,11 +289,8 @@ public class VertexPropertyTest extends AbstractGremlinTest {
}
}
});
-
-
}
-
@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)
@@ -329,6 +327,28 @@ public class VertexPropertyTest extends AbstractGremlinTest {
assertEquals(0, IteratorUtils.count(newMexico.properties(T.key.getAccessor())));
assertEquals(0, IteratorUtils.count(newMexico.properties(T.value.getAccessor())));
}
+
+ @Test
+ @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+ @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
+ @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_DUPLICATE_MULTI_PROPERTIES)
+ public void shouldAllowIdenticalValuedMultiProperties() {
+ final Vertex v = graph.addVertex();
+ v.property(VertexProperty.Cardinality.list, "name", "stephen");
+ v.property(VertexProperty.Cardinality.list, "name", "stephen");
+ v.property(VertexProperty.Cardinality.list, "name", "steve");
+ v.property(VertexProperty.Cardinality.list, "name", "stephen");
+ v.property(VertexProperty.Cardinality.list, "color", "red");
+
+ tryCommit(graph, g -> {
+ final Vertex vertex = graph.vertices(v).next();
+ assertEquals(4, IteratorUtils.count(vertex.properties("name")));
+ assertEquals(1, IteratorUtils.count(vertex.properties("color")));
+ assertEquals(5, IteratorUtils.count(vertex.properties()));
+
+ assertThat(IteratorUtils.set(vertex.values("name")), contains("stephen", "steve"));
+ });
+ }
}
public static class VertexPropertyRemoval extends AbstractGremlinTest {
[2/2] tinkerpop git commit: Merge branch 'TINKERPOP-919' into tp32
Posted by sp...@apache.org.
Merge branch 'TINKERPOP-919' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c4682f17
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c4682f17
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c4682f17
Branch: refs/heads/tp32
Commit: c4682f172f04a9e38b69a9c9a9829ebc7caf3cad
Parents: 630c1ff 3a7805c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Oct 28 18:26:00 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Oct 28 18:26:00 2016 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../upgrade/release-3.2.x-incubating.asciidoc | 8 ++++++
.../tinkerpop/gremlin/structure/Graph.java | 12 +++++++++
.../gremlin/structure/VertexProperty.java | 4 +++
.../gremlin/structure/FeatureSupportTest.java | 27 ++++++++++++++++++--
.../gremlin/structure/VertexPropertyTest.java | 26 ++++++++++++++++---
6 files changed, 73 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c4682f17/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index 88fcde2,1df17de..48f08ef
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -26,8 -26,8 +26,9 @@@ image::https://raw.githubusercontent.co
TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ * Added `VertexFeatures.supportsDuplicateMultiProperties()` for graphs that only support unique values in multi-properties.
* Deprecated the "performance" tests in `OptIn`.
+* Added `Pick.none` and `Pick.any` to the serializers and importers.
* Fixed a severe bug where `GraphComputer` strategies are not being loaded until the second use of the traversal source.
[[release-3-2-3]]