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 2015/05/05 22:04:01 UTC

[1/4] incubator-tinkerpop git commit: Added VertexFeatures.getCardinality(key).

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master a095eed91 -> 747311526


Added VertexFeatures.getCardinality(key).

This let's a user consult the graph implementation for the appropriate cardinality for a key.  This helps with internal calls to property(cardinality,k,v) within gremlin-core as cardinality is not known - applies largely to IO and Attachable.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/1bed8324
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/1bed8324
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/1bed8324

Branch: refs/heads/master
Commit: 1bed83248a8ed365f4fdca42d58079f435c6bb9d
Parents: 1396497
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue May 5 15:59:28 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue May 5 15:59:28 2015 -0400

----------------------------------------------------------------------
 .../org/apache/tinkerpop/gremlin/structure/Graph.java   |  8 ++++++++
 .../structure/io/graphson/LegacyGraphSONReader.java     |  3 +--
 .../tinkerpop/gremlin/structure/util/Attachable.java    | 12 ++++++------
 .../util/star/StarGraphGraphSONSerializer.java          |  1 -
 4 files changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1bed8324/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 1add3f9..79ab87e 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
@@ -439,6 +439,14 @@ public interface Graph extends AutoCloseable, Host {
             public static final String FEATURE_REMOVE_VERTICES = "RemoveVertices";
 
             /**
+             * Gets the {@link VertexProperty.Cardinality} for a key.  By default, this method will return
+             * {@link VertexProperty.Cardinality#list}.
+             */
+            public default VertexProperty.Cardinality getCardinality(final String key) {
+                return VertexProperty.Cardinality.list;
+            }
+
+            /**
              * Determines if a {@link Vertex} can be added to the {@code Graph}.
              */
             @FeatureDescriptor(name = FEATURE_ADD_VERTICES)

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1bed8324/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
index e2834c2..935e2f0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
@@ -267,8 +267,7 @@ public class LegacyGraphSONReader implements GraphReader {
             cache.put(vertexId, v);
 
             for (Map.Entry<String, Object> entry : props.entrySet()) {
-                // todo: cardinality
-                v.property(VertexProperty.Cardinality.list, entry.getKey(), entry.getValue());
+                v.property(g.features().vertex().getCardinality(entry.getKey()), entry.getKey(), entry.getValue());
             }
 
             return v;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1bed8324/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Attachable.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Attachable.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Attachable.java
index aec1fae..cb6c22a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Attachable.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Attachable.java
@@ -278,8 +278,8 @@ public interface Attachable<V> {
             final boolean supportsUserSuppliedIds = hostGraph.features().vertex().properties().supportsUserSuppliedIds();
             baseVertex.properties().forEachRemaining(vp -> {
                 final VertexProperty vertexProperty = supportsUserSuppliedIds ?
-                        vertex.property(VertexProperty.Cardinality.list, vp.key(), vp.value(), T.id, vp.id()) :
-                        vertex.property(VertexProperty.Cardinality.list, vp.key(), vp.value());
+                        vertex.property(hostGraph.features().vertex().getCardinality(vp.key()), vp.key(), vp.value(), T.id, vp.id()) :
+                        vertex.property(hostGraph.features().vertex().getCardinality(vp.key()), vp.key(), vp.value());
                 vp.properties().forEachRemaining(p -> vertexProperty.property(p.key(), p.value()));
             });
             return vertex;
@@ -318,8 +318,8 @@ public interface Attachable<V> {
             final Iterator<Vertex> vertexIterator = hostGraph.vertices(baseVertexProperty.element().id());
             if (vertexIterator.hasNext()) {
                 final VertexProperty vertexProperty = hostGraph.features().vertex().properties().supportsUserSuppliedIds() ?
-                        vertexIterator.next().property(VertexProperty.Cardinality.list, baseVertexProperty.key(), baseVertexProperty.value(), T.id, baseVertexProperty.id()) :
-                        vertexIterator.next().property(VertexProperty.Cardinality.list, baseVertexProperty.key(), baseVertexProperty.value());
+                        vertexIterator.next().property(hostGraph.features().vertex().getCardinality(baseVertexProperty.key()), baseVertexProperty.key(), baseVertexProperty.value(), T.id, baseVertexProperty.id()) :
+                        vertexIterator.next().property(hostGraph.features().vertex().getCardinality(baseVertexProperty.key()), baseVertexProperty.key(), baseVertexProperty.value());
                 baseVertexProperty.properties().forEachRemaining(p -> vertexProperty.property(p.key(), p.value()));
                 return vertexProperty;
             }
@@ -329,8 +329,8 @@ public interface Attachable<V> {
         public static VertexProperty createVertexProperty(final Attachable<VertexProperty> attachableVertexProperty, final Vertex hostVertex) {
             final VertexProperty<Object> baseVertexProperty = attachableVertexProperty.get();
             final VertexProperty vertexProperty = hostVertex.graph().features().vertex().properties().supportsUserSuppliedIds() ?
-                    hostVertex.property(VertexProperty.Cardinality.list, baseVertexProperty.key(), baseVertexProperty.value(), T.id, baseVertexProperty.id()) :
-                    hostVertex.property(VertexProperty.Cardinality.list, baseVertexProperty.key(), baseVertexProperty.value());
+                    hostVertex.property(hostVertex.graph().features().vertex().getCardinality(baseVertexProperty.key()), baseVertexProperty.key(), baseVertexProperty.value(), T.id, baseVertexProperty.id()) :
+                    hostVertex.property(hostVertex.graph().features().vertex().getCardinality(baseVertexProperty.key()), baseVertexProperty.key(), baseVertexProperty.value());
             baseVertexProperty.properties().forEachRemaining(p -> vertexProperty.property(p.key(), p.value()));
             return vertexProperty;
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1bed8324/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGraphSONSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGraphSONSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGraphSONSerializer.java
index a3916c8..3dd80e5 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGraphSONSerializer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGraphSONSerializer.java
@@ -212,7 +212,6 @@ public class StarGraphGraphSONSerializer extends StdSerializer<StarGraphGraphSON
             final Map<String, List<Map<String, Object>>> properties = (Map<String, List<Map<String, Object>>>) vertexData.get(GraphSONTokens.PROPERTIES);
             for (Map.Entry<String, List<Map<String, Object>>> property : properties.entrySet()) {
                 for (Map<String, Object> p : property.getValue()) {
-                    // todo: cardinality - same as gryo right now???
                     final StarGraph.StarVertexProperty vp = (StarGraph.StarVertexProperty) starGraph.getStarVertex().property(VertexProperty.Cardinality.list, property.getKey(), p.get(GraphSONTokens.VALUE), T.id, p.get(GraphSONTokens.ID));
                     if (p.containsKey(GraphSONTokens.PROPERTIES)) {
                         final Map<String, Object> edgePropertyData = (Map<String, Object>) p.get(GraphSONTokens.PROPERTIES);


[4/4] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master'

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master'


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/74731152
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/74731152
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/74731152

Branch: refs/heads/master
Commit: 7473115268f594e204cc5dc170bfad31e1502221
Parents: f3b1c09 a095eed
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue May 5 16:03:52 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue May 5 16:03:52 2015 -0400

----------------------------------------------------------------------
 .../AdjacentToIncidentStrategy.java             | 41 ++++++++++++--------
 1 file changed, 25 insertions(+), 16 deletions(-)
----------------------------------------------------------------------



[2/4] incubator-tinkerpop git commit: Update changelog.

Posted by sp...@apache.org.
Update changelog.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/e7ef7907
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/e7ef7907
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/e7ef7907

Branch: refs/heads/master
Commit: e7ef79078051490c5f033a8008cfb8c43ff6b05f
Parents: 1bed832
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue May 5 16:01:33 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue May 5 16:01:33 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e7ef7907/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 1fd624d..f4fae8b 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,7 @@ image::http://www.tinkerpop.com/docs/current/images/gremlin-hindu.png[width=225]
 TinkerPop 3.0.0.M9 (NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added `VertexFeature.getCardinality`.
 * Added `AdjacentToIncidentStrategy` which rewrites `out().count()` to `outE().count()` (and similar such patterns).
 * `GryoPool` now takes a `Configuration` object which allows setting the size of the pool and the `IoRegistry` instance.
 * Added `PersistResultGraphAware` interface which is used by `OutputFormats` to specify persistence possibilities for a Hadoop `GraphComputer`.


[3/4] incubator-tinkerpop git commit: Update javadoc.

Posted by sp...@apache.org.
Update javadoc.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/f3b1c096
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/f3b1c096
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/f3b1c096

Branch: refs/heads/master
Commit: f3b1c096b0e13ce8d5c620e19fc9603fc8cc3fac
Parents: e7ef790
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue May 5 16:03:33 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue May 5 16:03:33 2015 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/tinkerpop/gremlin/structure/Graph.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f3b1c096/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 79ab87e..6765524 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
@@ -440,7 +440,9 @@ public interface Graph extends AutoCloseable, Host {
 
             /**
              * Gets the {@link VertexProperty.Cardinality} for a key.  By default, this method will return
-             * {@link VertexProperty.Cardinality#list}.
+             * {@link VertexProperty.Cardinality#list}.  Implementations that employ a schema can consult it to
+             * determine the {@link VertexProperty.Cardinality}.  Those that do no have a schema can return their
+             * default {@link VertexProperty.Cardinality} for every key.
              */
             public default VertexProperty.Cardinality getCardinality(final String key) {
                 return VertexProperty.Cardinality.list;