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/09/03 17:33:21 UTC

[01/31] incubator-tinkerpop git commit: Add new feature: GraphFeature.supportsConcurrentAccess().

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master bb78a643e -> 016694dde


Add new feature: GraphFeature.supportsConcurrentAccess().


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

Branch: refs/heads/master
Commit: 7a9b07543526a7ff41362f337be4b8094d84474d
Parents: 649442c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Aug 21 12:02:58 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Aug 21 12:02:58 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                     |  1 +
 .../org/apache/tinkerpop/gremlin/structure/Graph.java  | 13 +++++++++++++
 .../tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java  |  5 +++++
 .../gremlin/tinkergraph/structure/TinkerGraph.java     |  5 +++++
 4 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7a9b0754/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ec39683..234d431 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.1 (NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added `GraphFeatures.supportsConcurrentAccess()` to allows `Graph` implementations to signify if multiple instances can access the same data.
 * Clarified semantics of `Transaction.close()` in unit tests - now refers only to closing the current transaction in the current thread.
 * `Neo4jGraph` no longer uses `OptOut` on `TransactionTest.shouldRollbackOnCloseWhenConfigured` (formerly `shouldRollbackOnShutdownWhenConfigured`)
 * Gremlin Server initialization scripts can now return a `Map` of values that will become global bindings for the server.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7a9b0754/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 355f824..97d067c 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
@@ -397,6 +397,7 @@ public interface Graph extends AutoCloseable, Host {
             public static final String FEATURE_TRANSACTIONS = "Transactions";
             public static final String FEATURE_PERSISTENCE = "Persistence";
             public static final String FEATURE_THREADED_TRANSACTIONS = "ThreadedTransactions";
+            public static final String FEATURE_CONCURRENT_ACCESS = "ConcurrentAccess";
 
             /**
              * Determines if the {@code Graph} implementation supports
@@ -419,6 +420,18 @@ public interface Graph extends AutoCloseable, Host {
             }
 
             /**
+             * Determines if the {@code Graph} implementation supports more than one connection to the same instance
+             * at the same time.  For example, Neo4j embedded does not support this feature because concurrent
+             * access to the same database files by multiple instances is not possible.  However, Neo4j HA could
+             * support this feature as each new {@code Graph} instance coordinates with the Neo4j cluster allowing
+             * multiple instances to operate on the same database.
+             */
+            @FeatureDescriptor(name = FEATURE_CONCURRENT_ACCESS)
+            public default boolean supportsConcurrentAccess() {
+                return true;
+            }
+
+            /**
              * Determines if the {@code Graph} implementations supports transactions.
              */
             @FeatureDescriptor(name = FEATURE_TRANSACTIONS)

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7a9b0754/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
index 17b9976..0f36ae2 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
@@ -396,6 +396,11 @@ public final class Neo4jGraph implements Graph, WrappedGraph<Neo4jGraphAPI> {
             }
 
             @Override
+            public boolean supportsConcurrentAccess() {
+                return false;
+            }
+
+            @Override
             public boolean supportsComputer() {
                 return false;
             }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7a9b0754/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 37bafb5..54be94d 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -344,6 +344,11 @@ public final class TinkerGraph implements Graph {
         }
 
         @Override
+        public boolean supportsConcurrentAccess() {
+            return false;
+        }
+
+        @Override
         public boolean supportsTransactions() {
             return false;
         }


[05/31] incubator-tinkerpop git commit: fixed configuration issue

Posted by sp...@apache.org.
fixed configuration issue


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

Branch: refs/heads/master
Commit: 08b57f8c5d8a6ea4ea15cf15405954327180d580
Parents: 1464db9
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Aug 24 16:51:35 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Mon Aug 24 16:51:35 2015 +0200

----------------------------------------------------------------------
 .../process/computer/bulkloading/BulkLoaderVertexProgram.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/08b57f8c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 047455a..8ff404b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -258,7 +258,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
             this.configuration.setProperty(BULK_LOADER_CLASS, bulkLoaderClass.getCanonicalName());
             if (configuration != null) {
                 configuration.getKeys().forEachRemaining(key -> this.configuration.addProperty(
-                        BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + "." + key, configuration.getProperty(key)
+                        BULK_LOADER_CFG_PREFIX + "." + key, configuration.getProperty(key)
                 ));
             }
             return this;


[27/31] incubator-tinkerpop git commit: Removed blvp reference from changelog.

Posted by sp...@apache.org.
Removed blvp reference from changelog.

It is not yet documented for public promotion.


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

Branch: refs/heads/master
Commit: 04ba481facf9234669092467b73c05eb9b4c0301
Parents: 688ebc6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 2 10:41:49 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 2 10:41:49 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/04ba481f/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index c051d87..87360e3 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,7 +25,6 @@ image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
 TinkerPop 3.0.1 (Release Date: September 2, 2015)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-* Added `BulkLoaderVertexProgram` and a default bulk loader implementation: `IncrementalBulkLoader`
 * `Compare` now uses `BigDecimal` internally to ensure that precision is not lost on standard number comparisons.
 * Renamed `ComputerVerificationStrategy` to `VerificationStrategy` so all the verification strategies can use it.
 * Added `StandardVerificationStrategy` that throws exceptions for illegal traversal patterns on the standard engine (which extends to `GraphComputer`).
@@ -67,7 +66,6 @@ Bugs
 Improvements
 ^^^^^^^^^^^^
 
-* [TINKERPOP3-319] - BulkLoaderVertexProgram for generalized batch loading across graphs
 * [TINKERPOP3-576] - Gremlin Server Authentication
 * [TINKERPOP3-582] - Remove Groovy Sandbox Dependency
 * [TINKERPOP3-610] - General graph concept names in test schema


[17/31] incubator-tinkerpop git commit: again some BLVP configuration tweaking as requested by @okram

Posted by sp...@apache.org.
again some BLVP configuration tweaking as requested by @okram


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

Branch: refs/heads/master
Commit: 9546e4493320e194e40e812c88e3710bca0fa157
Parents: b1191e7
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Aug 31 23:14:25 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Mon Aug 31 23:14:25 2015 +0200

----------------------------------------------------------------------
 .../bulkloading/BulkLoaderVertexProgram.java    | 59 +++++++++++---------
 1 file changed, 33 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9546e449/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index eaebd53..962edd0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -58,12 +58,12 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     private static final Logger LOGGER = LoggerFactory.getLogger(BulkLoaderVertexProgram.class);
 
     public static final String BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX = "gremlin.bulkLoaderVertexProgram";
-    public static final String GRAPH_CFG_KEY = "graph";
-    public static final String BULK_LOADER_CFG_KEY = "loader";
-    public final static String USER_SUPPLIED_IDS_CFG_KEY = "userSuppliedIds";
-    public final static String KEEP_ORIGINAL_IDS_CFG_KEY = "keepOriginalIds";
-    public static final String INTERMEDIATE_BATCH_SIZE_CFG_KEY = "intermediateBatchSize";
-    public static final String BULK_LOADER_VERTEX_ID_CFG_KEY = "vertexIdProperty";
+    public static final String BULK_LOADER_CLASS_CFG_KEY = String.join(".", BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX, "class");
+    public static final String BULK_LOADER_VERTEX_ID_CFG_KEY = String.join(".", BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX, "vertexIdProperty");
+    public static final String INTERMEDIATE_BATCH_SIZE_CFG_KEY = String.join(".", BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX, "intermediateBatchSize");
+    public static final String KEEP_ORIGINAL_IDS_CFG_KEY = String.join(".", BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX, "keepOriginalIds");
+    public static final String USER_SUPPLIED_IDS_CFG_KEY = String.join(".", BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX, "userSuppliedIds");
+    public static final String WRITE_GRAPH_CFG_KEY = String.join(".", BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX, "writeGraph");
     public static final String DEFAULT_BULK_LOADER_VERTEX_ID = "bulkLoader.vertex.id";
 
     private final MessageScope messageScope;
@@ -73,7 +73,8 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     private Graph graph;
     private GraphTraversalSource g;
     private long intermediateBatchSize;
-    private static ThreadLocal<AtomicLong> counter = new ThreadLocal<AtomicLong>() {
+
+    private static final ThreadLocal<AtomicLong> counter = new ThreadLocal<AtomicLong>() {
         @Override
         protected AtomicLong initialValue() {
             return new AtomicLong();
@@ -87,7 +88,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     private BulkLoader createBulkLoader() {
         final BulkLoader loader;
-        final Configuration config = configuration.subset(BULK_LOADER_CFG_KEY);
+        final Configuration config = configuration.subset(BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX);
         if (config.containsKey("class")) {
             final String className = config.getString("class");
             config.clearProperty("class");
@@ -104,7 +105,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
         } else {
             loader = new IncrementalBulkLoader();
         }
-        loader.configure(config);
+        loader.configure(configuration);
         return loader;
     }
 
@@ -152,13 +153,8 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
         if (config != null) {
             ConfigurationUtils.copy(config, configuration);
         }
-        if (!configuration.subset(BULK_LOADER_CFG_KEY).containsKey(BULK_LOADER_VERTEX_ID_CFG_KEY)) {
-            configuration.addProperty(
-                    String.join(".", BULK_LOADER_CFG_KEY, BULK_LOADER_VERTEX_ID_CFG_KEY),
-                    DEFAULT_BULK_LOADER_VERTEX_ID);
-        }
         intermediateBatchSize = configuration.getLong(INTERMEDIATE_BATCH_SIZE_CFG_KEY, 0L);
-        elementComputeKeys.add(configuration.subset(BULK_LOADER_CFG_KEY).getString(BULK_LOADER_VERTEX_ID_CFG_KEY));
+        elementComputeKeys.add(configuration.getString(BULK_LOADER_VERTEX_ID_CFG_KEY, DEFAULT_BULK_LOADER_VERTEX_ID));
         bulkLoader = createBulkLoader();
     }
 
@@ -173,7 +169,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     @Override
     public void workerIterationStart(final Memory memory) {
         if (null == graph) {
-            graph = GraphFactory.open(configuration.subset(GRAPH_CFG_KEY));
+            graph = GraphFactory.open(configuration.subset(WRITE_GRAPH_CFG_KEY));
             LOGGER.info("Opened Graph instance: {}", graph);
             try {
                 if (!graph.features().graph().supportsConcurrentAccess()) {
@@ -316,22 +312,18 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
         @Override
         public BulkLoaderVertexProgram create(final Graph graph) {
             ConfigurationUtils.append(graph.configuration().subset(BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX), configuration);
-            return (BulkLoaderVertexProgram) VertexProgram.createVertexProgram(graph, this.configuration);
-        }
-
-        private void setLoaderConfigurationProperty(final String key, final Object value) {
-            configuration.setProperty(String.join(".", BULK_LOADER_CFG_KEY, key), value);
+            return (BulkLoaderVertexProgram) VertexProgram.createVertexProgram(graph, configuration);
         }
 
         private void setGraphConfigurationProperty(final String key, final Object value) {
-            configuration.setProperty(String.join(".", GRAPH_CFG_KEY, key), value);
+            configuration.setProperty(String.join(".", WRITE_GRAPH_CFG_KEY, key), value);
         }
 
         /**
          * Sets the class name of the BulkLoader implementation to be used.
          */
         public Builder bulkLoader(final String className) {
-            setLoaderConfigurationProperty(Graph.GRAPH, className);
+            configuration.setProperty(BULK_LOADER_CLASS_CFG_KEY, className);
             return this;
         }
 
@@ -346,7 +338,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
          * Sets the name of the property that is used to store the original vertex identifiers in the target graph.
          */
         public Builder vertexIdProperty(final String name) {
-            setLoaderConfigurationProperty(BULK_LOADER_VERTEX_ID_CFG_KEY, name);
+            configuration.setProperty(BULK_LOADER_VERTEX_ID_CFG_KEY, name);
             return this;
         }
 
@@ -355,7 +347,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
          * target graph.
          */
         public Builder userSuppliedIds(final boolean useUserSuppliedIds) {
-            setLoaderConfigurationProperty(USER_SUPPLIED_IDS_CFG_KEY, useUserSuppliedIds);
+            configuration.setProperty(USER_SUPPLIED_IDS_CFG_KEY, useUserSuppliedIds);
             return this;
         }
 
@@ -365,7 +357,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
          * the data for further incremental bulk loads.
          */
         public Builder keepOriginalIds(final boolean keepOriginalIds) {
-            setLoaderConfigurationProperty(KEEP_ORIGINAL_IDS_CFG_KEY, keepOriginalIds);
+            configuration.setProperty(KEEP_ORIGINAL_IDS_CFG_KEY, keepOriginalIds);
             return this;
         }
 
@@ -387,4 +379,19 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
             return this;
         }
     }
+
+    @Override
+    public Features getFeatures() {
+        return new Features() {
+            @Override
+            public boolean requiresLocalMessageScopes() {
+                return true;
+            }
+
+            @Override
+            public boolean requiresVertexPropertyAddition() {
+                return true;
+            }
+        };
+    }
 }


[10/31] incubator-tinkerpop git commit: removed unnecessary code to make BLVP thread safe

Posted by sp...@apache.org.
removed unnecessary code to make BLVP thread safe


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

Branch: refs/heads/master
Commit: 99a85aee46535e2f26f24178153e9b3e207ba1a2
Parents: abb9a73
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Aug 27 20:03:10 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Aug 27 20:03:10 2015 +0200

----------------------------------------------------------------------
 .../bulkloading/BulkLoaderVertexProgram.java       | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/99a85aee/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 67d8da0..bfa88fd 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -46,7 +46,6 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * @author Daniel Kuppitz (http://gremlin.guru)
@@ -68,8 +67,8 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     private BulkLoader bulkLoader;
     private Graph graph;
     private GraphTraversalSource g;
-    private Long intermediateBatchSize;
-    private AtomicLong counter = new AtomicLong();
+    private long intermediateBatchSize;
+    private long counter;
 
     private BulkLoaderVertexProgram() {
         messageScope = MessageScope.Local.of(__::inE);
@@ -107,14 +106,14 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     }
 
     private void commit(final boolean force) {
-        if (!force && (intermediateBatchSize == 0L || counter.incrementAndGet() % intermediateBatchSize != 0)) return;
+        if (!force && (intermediateBatchSize == 0L || ++counter % intermediateBatchSize != 0)) return;
         if (null != graph) {
             if (graph.features().graph().supportsTransactions()) {
                 LOGGER.info("Committing transaction on Graph instance: {}", graph);
                 try {
                     graph.tx().commit(); // TODO will Giraph/MR restart the program and re-run execute if this fails?
                     LOGGER.debug("Committed transaction on Graph instance: {}", graph);
-                    counter.set(0L);
+                    counter = 0L;
                 } catch (Exception e) {
                     LOGGER.error("Failed to commit transaction on Graph instance: {}", graph);
                     graph.tx().rollback();
@@ -148,13 +147,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
                     DEFAULT_BULK_LOADER_VERTEX_ID);
         }
         intermediateBatchSize = configuration.getLong(INTERMEDIATE_BATCH_SIZE_CFG_KEY, 0L);
-        final String bulkLoaderVertexIdProperty = configuration.subset(BULK_LOADER_CFG_KEY)
-                .getString(BULK_LOADER_VERTEX_ID_CFG_KEY);
-        if (!elementComputeKeys.contains(bulkLoaderVertexIdProperty)) {
-            synchronized (elementComputeKeys) {
-                elementComputeKeys.add(bulkLoaderVertexIdProperty);
-            }
-        }
+        elementComputeKeys.add(configuration.subset(BULK_LOADER_CFG_KEY).getString(BULK_LOADER_VERTEX_ID_CFG_KEY));
     }
 
     @Override


[02/31] incubator-tinkerpop git commit: implemented BulkLoaderVertexProgram and 2 default BulkLoader implementations

Posted by sp...@apache.org.
implemented BulkLoaderVertexProgram and 2 default BulkLoader implementations


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

Branch: refs/heads/master
Commit: 048fcdc9caa4467aa7e065f525f386db3991ad75
Parents: 7a9b075
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Aug 24 02:28:55 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Mon Aug 24 02:28:55 2015 +0200

----------------------------------------------------------------------
 .../computer/bulkloading/BulkLoader.java        | 105 ++++++++
 .../bulkloading/BulkLoaderVertexProgram.java    | 267 +++++++++++++++++++
 .../computer/bulkloading/DefaultBulkLoader.java |  89 +++++++
 .../bulkloading/IncrementalBulkLoader.java      |  78 ++++++
 .../gremlin/structure/io/gryo/GryoMapper.java   |  19 +-
 .../structure/io/gryo/PairSerializer.java       |  42 +++
 6 files changed, 591 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/048fcdc9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
new file mode 100644
index 0000000..c6a3cc1
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+public interface BulkLoader {
+
+    /**
+     * Gets or creates a clone of the given vertex in the given graph.
+     *
+     * @param vertex The vertex to be cloned.
+     * @param graph  The graph that holds the cloned vertex after this method was called.
+     * @param g      A standard traversal source for the given graph.
+     * @return The cloned vertex.
+     */
+    public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g);
+
+    /**
+     * Gets or creates a clone of the given edge between the given in- and out-vertices.
+     *
+     * @param edge      The edge to be cloned.
+     * @param outVertex The out-vertex in the given graph..
+     * @param inVertex  The in-vertex in the given graph.
+     * @param graph     The graph that holds the cloned edge after this method was called.
+     * @param g         A standard traversal source for the given graph.
+     * @return The cloned edge.
+     */
+    public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g);
+
+    /**
+     * Gets or creates a clone of the given property for the given vertex.
+     *
+     * @param property The property to be cloned.
+     * @param vertex   The vertex in the given graph..
+     * @param graph    The graph that holds the given vertex.
+     * @param g        A standard traversal source for the given graph.
+     * @return The cloned property.
+     */
+    public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g);
+
+    /**
+     * Get a vertex that matches the given vertex from the given graph.
+     *
+     * @param vertex The vertex to be matched.
+     * @param graph  The graph that holds the given vertex.
+     * @param g      A standard traversal source for the given graph.
+     * @return The matched vertex.
+     */
+    public default Vertex getVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+        return useUserSuppliedIds()
+                ? getVertexById(vertex.id(), graph, g)
+                : g.V().has(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id()).next();
+    }
+
+    /**
+     * Gets a vertex by its ID from the given graph.
+     *
+     * @param id    The vertex ID.
+     * @param graph The graph that holds the vertex with the given ID.
+     * @param g     A standard traversal source for the given graph.
+     * @return The vertex with the given ID.
+     */
+    public default Vertex getVertexById(final Object id, final Graph graph, final GraphTraversalSource g) {
+        return graph.vertices(id).next();
+    }
+
+    /**
+     * @return Whether to use user supplied identifiers or not.
+     */
+    public boolean useUserSuppliedIds();
+
+    /**
+     * @return Whether original vertex identifiers are stored in the target graph or not.
+     */
+    public default boolean storeOriginalIds() {
+        return !useUserSuppliedIds();
+    }
+
+    public void configure(final Configuration configuration);
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/048fcdc9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
new file mode 100644
index 0000000..4fd017e
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -0,0 +1,267 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
+
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.computer.Memory;
+import org.apache.tinkerpop.gremlin.process.computer.MessageScope;
+import org.apache.tinkerpop.gremlin.process.computer.Messenger;
+import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.util.AbstractVertexProgramBuilder;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.javatuples.Pair;
+import org.javatuples.Tuple;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.FileInputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(BulkLoaderVertexProgram.class);
+
+    private static final String BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX = "bulkloader.conf";
+    private static final String BULK_LOADER_CLASS = BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + ".class";
+    private static final String BULK_LOADER_CFG_PREFIX = BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + ".loader";
+
+    public static final String BULK_LOADER_VERTEX_ID = BulkLoaderVertexProgram.class.getCanonicalName() + "bulkloader.vertex-id";
+
+    private MessageScope messageScope = MessageScope.Local.of(__::inE);
+    private Configuration configuration;
+    private Graph graph;
+    private GraphTraversalSource g;
+    private BulkLoader bulkLoader;
+    private Set<String> elementComputeKeys = new HashSet<String>() {{
+        add(BULK_LOADER_VERTEX_ID);
+    }};
+
+    private BulkLoaderVertexProgram() {
+
+    }
+
+    @Override
+    public void setup(final Memory memory) {
+
+    }
+
+    @Override
+    public void loadState(final Graph graph, final Configuration config) {
+        configuration = new BaseConfiguration();
+        if (config != null) {
+            final Iterator<String> keys = config.getKeys();
+            while (keys.hasNext()) {
+                final String key = keys.next();
+                configuration.setProperty(key, config.getProperty(key));
+            }
+        }
+        final Configuration blvpConfiguration = graph.configuration().subset(BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX);
+        blvpConfiguration.getKeys().forEachRemaining(key -> configuration.setProperty(key, blvpConfiguration.getProperty(key)));
+    }
+
+    @Override
+    public void storeState(final Configuration config) {
+        VertexProgram.super.storeState(config);
+        if (configuration != null) {
+            configuration.getKeys().forEachRemaining(key -> config.setProperty(key, configuration.getProperty(key)));
+        }
+    }
+
+    @Override
+    public void workerIterationStart(final Memory memory) {
+        if (null == graph) {
+            graph = GraphFactory.open(configuration);
+            LOGGER.info("Opened Graph instance: {}", graph);
+            if (!graph.features().graph().supportsConcurrentAccess()) {
+                throw new IllegalStateException("The given graph instance does not allow concurrent access.");
+            }
+            if (graph.features().graph().supportsTransactions()) {
+                if (!graph.features().graph().supportsThreadedTransactions()) {
+                    throw new IllegalStateException("The given graph instance does not support threaded transactions.");
+                }
+            }
+            g = graph.traversal();
+            final String bulkLoaderClassName = configuration.getString(BULK_LOADER_CLASS, DefaultBulkLoader.class.getCanonicalName());
+            try {
+                final Class<?> bulkLoaderClass = Class.forName(bulkLoaderClassName);
+                bulkLoader = (BulkLoader) bulkLoaderClass.getConstructor().newInstance();
+            } catch (ClassNotFoundException e) {
+                LOGGER.error("Unable to find custom bulk loader class: {}", bulkLoaderClassName);
+                throw new IllegalStateException(e);
+            } catch (Exception e) {
+                LOGGER.error("Unable to create an instance of the given bulk loader class: {}", bulkLoaderClassName);
+                throw new IllegalStateException(e);
+            }
+            bulkLoader.configure(configuration.subset(BULK_LOADER_CFG_PREFIX));
+        } else {
+            LOGGER.warn("Leaked Graph instance: {}", graph);
+        }
+    }
+
+    @Override
+    public void workerIterationEnd(final Memory memory) {
+        if (null != graph) {
+            if (graph.features().graph().supportsTransactions()) {
+                LOGGER.info("Committing transaction on Graph instance: {}", graph);
+                graph.tx().commit(); // TODO will Giraph/MR restart the program and re-run execute if this fails?
+                LOGGER.debug("Committed transaction on Graph instance: {}", graph);
+            }
+            try {
+                graph.close();
+                LOGGER.info("Closed Graph instance: {}", graph);
+                graph = null;
+            } catch (Exception e) {
+                LOGGER.warn("Failed to close Graph instance", e);
+            }
+        }
+    }
+
+    @Override
+    public void execute(final Vertex sourceVertex, final Messenger<Tuple> messenger, final Memory memory) {
+        if (memory.isInitialIteration()) {
+            // get or create the vertex
+            final Vertex targetVertex = bulkLoader.getOrCreateVertex(sourceVertex, graph, g);
+            // write all the properties of the vertex to the newly created vertex
+            final Iterator<VertexProperty<Object>> vpi = sourceVertex.properties();
+            while (vpi.hasNext()) {
+                bulkLoader.getOrCreateVertexProperty(vpi.next(), targetVertex, graph, g);
+            }
+            if (!bulkLoader.useUserSuppliedIds()) {
+                // create an id pair and send it to all the vertex's incoming adjacent vertices
+                sourceVertex.property(BULK_LOADER_VERTEX_ID, targetVertex.id());
+                messenger.sendMessage(this.messageScope, Pair.with(sourceVertex.id(), targetVertex.id()));
+            }
+        } else {
+            if (bulkLoader.useUserSuppliedIds()) {
+                final Vertex outV = bulkLoader.getVertex(sourceVertex, graph, g);
+                sourceVertex.edges(Direction.OUT).forEachRemaining(edge -> {
+                    final Vertex inV = bulkLoader.getVertex(edge.inVertex(), graph, g);
+                    bulkLoader.getOrCreateEdge(edge, outV, inV, graph, g);
+                });
+            } else {
+                // create an id map and populate it with all the incoming messages
+                final Map<Object, Object> idPairs = new HashMap<>();
+                final Iterator<Tuple> idi = messenger.receiveMessages();
+                while (idi.hasNext()) {
+                    final Tuple idPair = idi.next();
+                    idPairs.put(idPair.getValue(0), idPair.getValue(1));
+                }
+                // get the vertex given the dummy id property
+                final Long outVId = sourceVertex.value(BULK_LOADER_VERTEX_ID);
+                final Vertex outV = bulkLoader.getVertexById(outVId, graph, g);
+                // for all the incoming edges of the vertex, get the incoming adjacent vertex and write the edge and its properties
+                sourceVertex.edges(Direction.OUT).forEachRemaining(edge -> {
+                    final Object inVId = idPairs.get(edge.inVertex().id());
+                    final Vertex inV = bulkLoader.getVertexById(inVId, graph, g);
+                    bulkLoader.getOrCreateEdge(edge, outV, inV, graph, g);
+                });
+            }
+        }
+    }
+
+    @Override
+    public boolean terminate(final Memory memory) {
+        return memory.getIteration() >= 1;
+    }
+
+    @Override
+    public Set<String> getElementComputeKeys() {
+        return elementComputeKeys;
+    }
+
+    @Override
+    public Set<MessageScope> getMessageScopes(final Memory memory) {
+        return new HashSet<MessageScope>() {{
+            add(messageScope);
+        }};
+    }
+
+    @Override
+    public VertexProgram<Tuple> clone() {
+        return this;
+    }
+
+    @Override
+    public GraphComputer.ResultGraph getPreferredResultGraph() {
+        return GraphComputer.ResultGraph.NEW;
+    }
+
+    @Override
+    public GraphComputer.Persist getPreferredPersist() {
+        return GraphComputer.Persist.EDGES;
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.vertexProgramString(this, "");
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static class Builder extends AbstractVertexProgramBuilder<Builder> {
+
+        private Builder() {
+            super(BulkLoaderVertexProgram.class);
+        }
+
+        public Builder graphConfiguration(final String propertiesFileLocation) {
+            try {
+                final Properties properties = new Properties();
+                properties.load(new FileInputStream(propertiesFileLocation));
+                properties.forEach((key, value) -> configuration.setProperty(BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + "." + key, value));
+                return this;
+            } catch (final Exception e) {
+                throw new IllegalArgumentException(e.getMessage(), e);
+            }
+        }
+
+        public Builder bulkLoaderClass(final Class<? extends BulkLoader> bulkLoaderClass) {
+            return bulkLoaderClass(bulkLoaderClass, null);
+        }
+
+        public Builder bulkLoaderClass(final Class<? extends BulkLoader> bulkLoaderClass, final Configuration configuration) {
+            this.configuration.setProperty(BULK_LOADER_CLASS, bulkLoaderClass.getCanonicalName());
+            if (configuration != null) {
+                configuration.getKeys().forEachRemaining(key -> this.configuration.addProperty(
+                        BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + "." + key, configuration.getProperty(key)
+                ));
+            }
+            return this;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/048fcdc9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
new file mode 100644
index 0000000..a1aaf92
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+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;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+public class DefaultBulkLoader implements BulkLoader {
+
+    private boolean storeOriginalIds = false;
+    private boolean useUserSuppliedIds = false;
+
+    @Override
+    public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+        if (useUserSuppliedIds()) {
+            return graph.addVertex(T.id, vertex.id(), T.label, vertex.label());
+        }
+        final Vertex v = graph.addVertex(T.label, vertex.label());
+        if (storeOriginalIds()) {
+            v.property(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id());
+        }
+        return v;
+    }
+
+    @Override
+    public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g) {
+        final Edge e = outVertex.addEdge(edge.label(), inVertex);
+        edge.properties().forEachRemaining(property -> e.property(property.key(), property.value()));
+        return e;
+    }
+
+    @Override
+    public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+        final VertexProperty<?> vp = vertex.property(property.key(), property.value());
+        vp.properties().forEachRemaining(metaProperty -> property.property(metaProperty.key(), metaProperty.value()));
+        return vp;
+    }
+
+    @Override
+    public Vertex getVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+        return useUserSuppliedIds()
+                ? getVertexById(vertex.id(), graph, g)
+                : g.V().has(vertex.label(), BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id()).next();
+    }
+
+    @Override
+    public boolean useUserSuppliedIds() {
+        return useUserSuppliedIds;
+    }
+
+    @Override
+    public boolean storeOriginalIds() {
+        return storeOriginalIds;
+    }
+
+    @Override
+    public void configure(final Configuration configuration) {
+        if (configuration.containsKey("use-user-supplied-ids")) {
+            useUserSuppliedIds = configuration.getBoolean("use-user-supplied-ids");
+        }
+        if (configuration.containsKey("store-original-ids")) {
+            storeOriginalIds = configuration.getBoolean("store-original-ids");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/048fcdc9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
new file mode 100644
index 0000000..23af2e2
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.NoSuchElementException;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+public class IncrementalBulkLoader extends DefaultBulkLoader {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(IncrementalBulkLoader.class);
+
+    @Override
+    public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+        if (useUserSuppliedIds()) {
+            try {
+                return getVertexById(vertex.id(), graph, g);
+            } catch (NoSuchElementException ignored) {
+            }
+        } else {
+            final Traversal<Vertex, Vertex> t = g.V().has(vertex.label(), BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id());
+            if (t.hasNext()) return t.next();
+        }
+        return super.getOrCreateVertex(vertex, graph, g);
+    }
+
+    @Override
+    public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g) {
+        final Traversal<Vertex, Edge> t = g.V(outVertex).outE(edge.label()).filter(__.inV().is(inVertex));
+        if (t.hasNext()) {
+            final Edge e = t.next();
+            edge.properties().forEachRemaining(property -> e.property(property.key(), property.value()));
+            return e;
+        }
+        return super.getOrCreateEdge(edge, outVertex, inVertex, graph, g);
+    }
+
+    @Override
+    public boolean storeOriginalIds() {
+        return !useUserSuppliedIds();
+    }
+
+    @Override
+    public void configure(final Configuration configuration) {
+        super.configure(configuration);
+        if (configuration.containsKey("store-original-ids")) {
+            LOGGER.warn("{} automatically determines whether original identifiers should be stored or not, hence the " +
+                    "configuration setting 'store-original-ids' will be ignored.", this.getClass());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/048fcdc9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
index 8b96052..0dc5d44 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.structure.io.gryo;
 
 import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
 import org.apache.tinkerpop.gremlin.process.computer.util.MapMemory;
+import org.apache.tinkerpop.gremlin.process.traversal.Contains;
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
@@ -31,7 +32,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSe
 import org.apache.tinkerpop.gremlin.process.traversal.util.DependantMutableMetrics;
 import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics;
 import org.apache.tinkerpop.gremlin.process.traversal.util.StandardTraversalMetrics;
-import org.apache.tinkerpop.gremlin.process.traversal.Contains;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -96,12 +96,12 @@ import java.util.stream.Collectors;
  * serializers in one of three ways:
  * <p/>
  * <ol>
- *     <li>Register just the custom class with a {@code null} {@link Serializer} implementation</li>
- *     <li>Register the custom class with a {@link Serializer} implementation</li>
- *     <li>
- *         Register the custom class with a {@code Function<Kryo, Serializer>} for those cases where the
- *         {@link Serializer} requires the {@link Kryo} instance to get constructed.
- *     </li>
+ * <li>Register just the custom class with a {@code null} {@link Serializer} implementation</li>
+ * <li>Register the custom class with a {@link Serializer} implementation</li>
+ * <li>
+ * Register the custom class with a {@code Function<Kryo, Serializer>} for those cases where the
+ * {@link Serializer} requires the {@link Kryo} instance to get constructed.
+ * </li>
  * </ol>
  * <p/>
  * For example:
@@ -223,7 +223,7 @@ public final class GryoMapper implements Mapper<Kryo> {
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ReferenceVertex.class, null, 84));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ReferencePath.class, null, 85));
 
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StarGraph.class, kryo -> StarGraphGryoSerializer.with(Direction.BOTH), 86)); // ***LAST ID**
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StarGraph.class, kryo -> StarGraphGryoSerializer.with(Direction.BOTH), 86));
 
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Edge.class, kryo -> new GryoSerializers.EdgeSerializer(), 65));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Vertex.class, kryo -> new GryoSerializers.VertexSerializer(), 66));
@@ -246,6 +246,7 @@ public final class GryoMapper implements Mapper<Kryo> {
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MapReduce.NullObject.class, null, 74));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(AtomicLong.class, null, 79));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DependantMutableMetrics.class, null, 80));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Pair.class, kryo -> new PairSerializer(), 87)); // ***LAST ID**
         }};
 
         private List<IoRegistry> registries = new ArrayList<>();
@@ -300,7 +301,7 @@ public final class GryoMapper implements Mapper<Kryo> {
          */
         public GryoMapper create() {
             // consult the registry if provided and inject registry entries as custom classes.
-            registries.forEach(registry-> {
+            registries.forEach(registry -> {
                 final List<Pair<Class, Object>> serializers = registry.find(GryoIo.class);
                 serializers.forEach(p -> {
                     if (null == p.getValue1())

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/048fcdc9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/PairSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/PairSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/PairSerializer.java
new file mode 100644
index 0000000..e5e92e7
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/PairSerializer.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.structure.io.gryo;
+
+import org.apache.tinkerpop.shaded.kryo.Kryo;
+import org.apache.tinkerpop.shaded.kryo.Serializer;
+import org.apache.tinkerpop.shaded.kryo.io.Input;
+import org.apache.tinkerpop.shaded.kryo.io.Output;
+import org.javatuples.Pair;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+final class PairSerializer extends Serializer<Pair> {
+
+    @Override
+    public void write(final Kryo kryo, final Output output, final Pair pair) {
+        kryo.writeClassAndObject(output, pair.getValue0());
+        kryo.writeClassAndObject(output, pair.getValue1());
+    }
+
+    @Override
+    public Pair read(final Kryo kryo, final Input input, final Class<Pair> pairClass) {
+        return Pair.with(kryo.readClassAndObject(input), kryo.readClassAndObject(input));
+    }
+}


[26/31] incubator-tinkerpop git commit: TinkerPop 3.0.1-incubating release

Posted by sp...@apache.org.
TinkerPop 3.0.1-incubating release


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

Branch: refs/heads/master
Commit: 688ebc6bdf179f549bcc030e7b907c2fb49944b0
Parents: 65d60f9
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 2 08:04:12 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 2 08:04:12 2015 -0400

----------------------------------------------------------------------
 gremlin-console/pom.xml     | 2 +-
 gremlin-core/pom.xml        | 2 +-
 gremlin-driver/pom.xml      | 2 +-
 gremlin-groovy-test/pom.xml | 2 +-
 gremlin-groovy/pom.xml      | 2 +-
 gremlin-server/pom.xml      | 2 +-
 gremlin-shaded/pom.xml      | 2 +-
 gremlin-test/pom.xml        | 2 +-
 hadoop-gremlin/pom.xml      | 2 +-
 neo4j-gremlin/pom.xml       | 2 +-
 pom.xml                     | 2 +-
 tinkergraph-gremlin/pom.xml | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/gremlin-console/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-console/pom.xml b/gremlin-console/pom.xml
index 5e3210a..d7bca3d 100644
--- a/gremlin-console/pom.xml
+++ b/gremlin-console/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
     <parent>
         <artifactId>tinkerpop</artifactId>
         <groupId>org.apache.tinkerpop</groupId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>gremlin-console</artifactId>
     <name>Apache TinkerPop :: Gremlin Console</name>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/gremlin-core/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-core/pom.xml b/gremlin-core/pom.xml
index f60f15a..7660f63 100644
--- a/gremlin-core/pom.xml
+++ b/gremlin-core/pom.xml
@@ -20,7 +20,7 @@ limitations under the License.
     <parent>
         <groupId>org.apache.tinkerpop</groupId>
         <artifactId>tinkerpop</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>gremlin-core</artifactId>
     <name>Apache TinkerPop :: Gremlin Core</name>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/gremlin-driver/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-driver/pom.xml b/gremlin-driver/pom.xml
index c158ce5..b7c5744 100644
--- a/gremlin-driver/pom.xml
+++ b/gremlin-driver/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
     <parent>
         <groupId>org.apache.tinkerpop</groupId>
         <artifactId>tinkerpop</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>gremlin-driver</artifactId>
     <name>Apache TinkerPop :: Gremlin Driver</name>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/gremlin-groovy-test/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/pom.xml b/gremlin-groovy-test/pom.xml
index 7230e10..1ec7af8 100644
--- a/gremlin-groovy-test/pom.xml
+++ b/gremlin-groovy-test/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
     <parent>
         <groupId>org.apache.tinkerpop</groupId>
         <artifactId>tinkerpop</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>gremlin-groovy-test</artifactId>
     <name>Apache TinkerPop :: Gremlin Groovy Test</name>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/gremlin-groovy/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-groovy/pom.xml b/gremlin-groovy/pom.xml
index 69b5e0c..0b53252 100644
--- a/gremlin-groovy/pom.xml
+++ b/gremlin-groovy/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
     <parent>
         <groupId>org.apache.tinkerpop</groupId>
         <artifactId>tinkerpop</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>gremlin-groovy</artifactId>
     <name>Apache TinkerPop :: Gremlin Groovy</name>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/gremlin-server/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-server/pom.xml b/gremlin-server/pom.xml
index 9a9a110..40ab863 100644
--- a/gremlin-server/pom.xml
+++ b/gremlin-server/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
     <parent>
         <groupId>org.apache.tinkerpop</groupId>
         <artifactId>tinkerpop</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>gremlin-server</artifactId>
     <name>Apache TinkerPop :: Gremlin Server</name>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/gremlin-shaded/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-shaded/pom.xml b/gremlin-shaded/pom.xml
index 056f694..d6b8dc5 100644
--- a/gremlin-shaded/pom.xml
+++ b/gremlin-shaded/pom.xml
@@ -20,7 +20,7 @@ limitations under the License.
     <parent>
         <groupId>org.apache.tinkerpop</groupId>
         <artifactId>tinkerpop</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>gremlin-shaded</artifactId>
     <name>Apache TinkerPop :: Gremlin Shaded</name>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/gremlin-test/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-test/pom.xml b/gremlin-test/pom.xml
index 1a412a1..a35bdb1 100644
--- a/gremlin-test/pom.xml
+++ b/gremlin-test/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
     <parent>
         <groupId>org.apache.tinkerpop</groupId>
         <artifactId>tinkerpop</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>gremlin-test</artifactId>
     <name>Apache TinkerPop :: Gremlin Test</name>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/hadoop-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/pom.xml b/hadoop-gremlin/pom.xml
index f0651d9..e527f79 100644
--- a/hadoop-gremlin/pom.xml
+++ b/hadoop-gremlin/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
     <parent>
         <groupId>org.apache.tinkerpop</groupId>
         <artifactId>tinkerpop</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>hadoop-gremlin</artifactId>
     <name>Apache TinkerPop :: Hadoop Gremlin</name>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/neo4j-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/pom.xml b/neo4j-gremlin/pom.xml
index c6349b4..fd17cbe 100644
--- a/neo4j-gremlin/pom.xml
+++ b/neo4j-gremlin/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
     <parent>
         <groupId>org.apache.tinkerpop</groupId>
         <artifactId>tinkerpop</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>neo4j-gremlin</artifactId>
     <name>Apache TinkerPop :: Neo4j Gremlin</name>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a9b34e5..d82bc68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@ limitations under the License.
     </parent>
     <groupId>org.apache.tinkerpop</groupId>
     <artifactId>tinkerpop</artifactId>
-    <version>3.0.1-SNAPSHOT</version>
+    <version>3.0.1-incubating</version>
     <packaging>pom</packaging>
     <name>Apache TinkerPop</name>
     <description>A Graph Computing Framework</description>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/688ebc6b/tinkergraph-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/pom.xml b/tinkergraph-gremlin/pom.xml
index 4f271bc..b4353d3 100644
--- a/tinkergraph-gremlin/pom.xml
+++ b/tinkergraph-gremlin/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
     <parent>
         <groupId>org.apache.tinkerpop</groupId>
         <artifactId>tinkerpop</artifactId>
-        <version>3.0.1-SNAPSHOT</version>
+        <version>3.0.1-incubating</version>
     </parent>
     <artifactId>tinkergraph-gremlin</artifactId>
     <name>Apache TinkerPop :: TinkerGraph Gremlin</name>


[03/31] incubator-tinkerpop git commit: minor code cleanup

Posted by sp...@apache.org.
minor code cleanup


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

Branch: refs/heads/master
Commit: 7c50e733632b3f0367b731be87bae2753deb7d99
Parents: 048fcdc
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Aug 24 04:26:08 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Mon Aug 24 04:26:08 2015 +0200

----------------------------------------------------------------------
 .../computer/bulkloading/BulkLoader.java        |  5 +++
 .../bulkloading/BulkLoaderVertexProgram.java    | 14 ++++-----
 .../computer/bulkloading/DefaultBulkLoader.java | 32 +++++++++++++++++---
 .../bulkloading/IncrementalBulkLoader.java      | 32 ++++++++++++--------
 4 files changed, 59 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c50e733/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
index c6a3cc1..268c0cc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
@@ -101,5 +101,10 @@ public interface BulkLoader {
         return !useUserSuppliedIds();
     }
 
+    /**
+     * Configures the BulkLoader instance.
+     *
+     * @param configuration The BulkLoader configuration.
+     */
     public void configure(final Configuration configuration);
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c50e733/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 4fd017e..047455a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -40,6 +40,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.FileInputStream;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -58,19 +59,18 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     private static final String BULK_LOADER_CLASS = BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + ".class";
     private static final String BULK_LOADER_CFG_PREFIX = BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + ".loader";
 
-    public static final String BULK_LOADER_VERTEX_ID = BulkLoaderVertexProgram.class.getCanonicalName() + "bulkloader.vertex-id";
+    public static final String BULK_LOADER_VERTEX_ID = "bulkloader.vertex-id";
 
-    private MessageScope messageScope = MessageScope.Local.of(__::inE);
+    private final MessageScope messageScope;
+    private final Set<String> elementComputeKeys;
     private Configuration configuration;
+    private BulkLoader bulkLoader;
     private Graph graph;
     private GraphTraversalSource g;
-    private BulkLoader bulkLoader;
-    private Set<String> elementComputeKeys = new HashSet<String>() {{
-        add(BULK_LOADER_VERTEX_ID);
-    }};
 
     private BulkLoaderVertexProgram() {
-
+        messageScope = MessageScope.Local.of(__::inE);
+        elementComputeKeys = Collections.singleton(BULK_LOADER_VERTEX_ID);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c50e733/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
index a1aaf92..601079d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
@@ -31,9 +31,15 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
  */
 public class DefaultBulkLoader implements BulkLoader {
 
+    public final static String USE_USER_SUPPLIED_IDS_CFG_KEY = "use-user-supplied-ids";
+    public final static String STORE_ORIGINAL_IDS_CFG_KEY = "store-original-ids";
+
     private boolean storeOriginalIds = false;
     private boolean useUserSuppliedIds = false;
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
         if (useUserSuppliedIds()) {
@@ -46,6 +52,9 @@ public class DefaultBulkLoader implements BulkLoader {
         return v;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g) {
         final Edge e = outVertex.addEdge(edge.label(), inVertex);
@@ -53,6 +62,9 @@ public class DefaultBulkLoader implements BulkLoader {
         return e;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
         final VertexProperty<?> vp = vertex.property(property.key(), property.value());
@@ -60,6 +72,9 @@ public class DefaultBulkLoader implements BulkLoader {
         return vp;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public Vertex getVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
         return useUserSuppliedIds()
@@ -67,23 +82,32 @@ public class DefaultBulkLoader implements BulkLoader {
                 : g.V().has(vertex.label(), BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id()).next();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public boolean useUserSuppliedIds() {
         return useUserSuppliedIds;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public boolean storeOriginalIds() {
         return storeOriginalIds;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void configure(final Configuration configuration) {
-        if (configuration.containsKey("use-user-supplied-ids")) {
-            useUserSuppliedIds = configuration.getBoolean("use-user-supplied-ids");
+        if (configuration.containsKey(USE_USER_SUPPLIED_IDS_CFG_KEY)) {
+            useUserSuppliedIds = configuration.getBoolean(USE_USER_SUPPLIED_IDS_CFG_KEY);
         }
-        if (configuration.containsKey("store-original-ids")) {
-            storeOriginalIds = configuration.getBoolean("store-original-ids");
+        if (configuration.containsKey(STORE_ORIGINAL_IDS_CFG_KEY)) {
+            storeOriginalIds = configuration.getBoolean(STORE_ORIGINAL_IDS_CFG_KEY);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c50e733/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
index 23af2e2..d87df73 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
@@ -28,7 +28,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.NoSuchElementException;
+import java.util.Iterator;
 
 /**
  * @author Daniel Kuppitz (http://gremlin.guru)
@@ -37,20 +37,20 @@ public class IncrementalBulkLoader extends DefaultBulkLoader {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(IncrementalBulkLoader.class);
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
-        if (useUserSuppliedIds()) {
-            try {
-                return getVertexById(vertex.id(), graph, g);
-            } catch (NoSuchElementException ignored) {
-            }
-        } else {
-            final Traversal<Vertex, Vertex> t = g.V().has(vertex.label(), BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id());
-            if (t.hasNext()) return t.next();
-        }
-        return super.getOrCreateVertex(vertex, graph, g);
+        final Iterator<Vertex> iterator = useUserSuppliedIds()
+                ? graph.vertices(vertex.id())
+                : g.V().has(vertex.label(), BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id());
+        return iterator.hasNext() ? iterator.next() : super.getOrCreateVertex(vertex, graph, g);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g) {
         final Traversal<Vertex, Edge> t = g.V(outVertex).outE(edge.label()).filter(__.inV().is(inVertex));
@@ -62,17 +62,23 @@ public class IncrementalBulkLoader extends DefaultBulkLoader {
         return super.getOrCreateEdge(edge, outVertex, inVertex, graph, g);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public boolean storeOriginalIds() {
         return !useUserSuppliedIds();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void configure(final Configuration configuration) {
         super.configure(configuration);
-        if (configuration.containsKey("store-original-ids")) {
+        if (configuration.containsKey(STORE_ORIGINAL_IDS_CFG_KEY)) {
             LOGGER.warn("{} automatically determines whether original identifiers should be stored or not, hence the " +
-                    "configuration setting 'store-original-ids' will be ignored.", this.getClass());
+                    "configuration setting '{}' will be ignored.", this.getClass(), STORE_ORIGINAL_IDS_CFG_KEY);
         }
     }
 }


[11/31] incubator-tinkerpop git commit: fixed and optimized IncrementalBulkLoader

Posted by sp...@apache.org.
fixed and optimized IncrementalBulkLoader


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

Branch: refs/heads/master
Commit: 4978e331bdb339a48be4f42d75f584caab766e94
Parents: 99a85ae
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Aug 27 23:58:23 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Aug 27 23:58:23 2015 +0200

----------------------------------------------------------------------
 .../bulkloading/BulkLoaderVertexProgram.java    | 24 ++++++++++------
 .../bulkloading/IncrementalBulkLoader.java      | 30 +++++++++++++++++++-
 2 files changed, 45 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4978e331/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index bfa88fd..2f36a6e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -105,8 +105,14 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
         return loader;
     }
 
-    private void commit(final boolean force) {
-        if (!force && (intermediateBatchSize == 0L || ++counter % intermediateBatchSize != 0)) return;
+    /**
+     * Eventually commits the current transaction and closes the current graph instance. commit() will be called
+     * if close is set true, otherwise it will only be called if the intermediate batch size is set and reached.
+     *
+     * @param close Whether to close the current graph instance after calling commit() or not.
+     */
+    private void commit(final boolean close) {
+        if (!close && (intermediateBatchSize == 0L || ++counter % intermediateBatchSize != 0)) return;
         if (null != graph) {
             if (graph.features().graph().supportsTransactions()) {
                 LOGGER.info("Committing transaction on Graph instance: {}", graph);
@@ -120,12 +126,14 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
                     throw e;
                 }
             }
-            try {
-                graph.close();
-                LOGGER.info("Closed Graph instance: {}", graph);
-                graph = null;
-            } catch (Exception e) {
-                LOGGER.warn("Failed to close Graph instance", e);
+            if (close) {
+                try {
+                    graph.close();
+                    LOGGER.info("Closed Graph instance: {}", graph);
+                    graph = null;
+                } catch (Exception e) {
+                    LOGGER.warn("Failed to close Graph instance", e);
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4978e331/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
index c4e0737..7822c2d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
@@ -24,7 +24,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Property;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,7 +58,12 @@ public class IncrementalBulkLoader extends DefaultBulkLoader {
         final Traversal<Vertex, Edge> t = g.V(outVertex).outE(edge.label()).filter(__.inV().is(inVertex));
         if (t.hasNext()) {
             final Edge e = t.next();
-            edge.properties().forEachRemaining(property -> e.property(property.key(), property.value()));
+            edge.properties().forEachRemaining(property -> {
+                final Property<?> existing = e.property(property.key());
+                if (!existing.isPresent() || !existing.value().equals(property.value())) {
+                    e.property(property.key(), property.value());
+                }
+            });
             return e;
         }
         return super.getOrCreateEdge(edge, outVertex, inVertex, graph, g);
@@ -66,6 +73,27 @@ public class IncrementalBulkLoader extends DefaultBulkLoader {
      * {@inheritDoc}
      */
     @Override
+    public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+        final VertexProperty<?> vp;
+        final VertexProperty<?> existing = vertex.property(property.key());
+        if (!existing.isPresent() || !existing.value().equals(property.value())) {
+            vp = vertex.property(property.key(), property.value());
+        } else {
+            vp = existing;
+        }
+        property.properties().forEachRemaining(metaProperty -> {
+            final Property<?> existing2 = vp.property(metaProperty.key());
+            if (!existing2.isPresent() || !existing2.value().equals(metaProperty.value())) {
+                vp.property(metaProperty.key(), metaProperty.value());
+            }
+        });
+        return vp;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public boolean storeOriginalIds() {
         return !useUserSuppliedIds();
     }


[14/31] incubator-tinkerpop git commit: tweaked the commit logs (added a counter for processed elements per iteration per thread)

Posted by sp...@apache.org.
tweaked the commit logs (added a counter for processed elements per iteration per thread)


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

Branch: refs/heads/master
Commit: 9ec8c96dad4d68463386b272815553f640d93ea9
Parents: 9cc985d
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Sun Aug 30 14:48:36 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Sun Aug 30 14:48:36 2015 +0200

----------------------------------------------------------------------
 .../bulkloading/BulkLoaderVertexProgram.java        | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9ec8c96d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index b8219fb..9ab21c2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -46,6 +46,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * @author Daniel Kuppitz (http://gremlin.guru)
@@ -68,7 +69,12 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     private Graph graph;
     private GraphTraversalSource g;
     private long intermediateBatchSize;
-    private long counter;
+    private static ThreadLocal<AtomicLong> counter = new ThreadLocal<AtomicLong>() {
+        @Override
+        protected AtomicLong initialValue() {
+            return new AtomicLong();
+        }
+    };
 
     private BulkLoaderVertexProgram() {
         messageScope = MessageScope.Local.of(__::inE);
@@ -99,7 +105,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
                 throw new IllegalStateException(e);
             }
         } else {
-            loader = new DefaultBulkLoader();
+            loader = new IncrementalBulkLoader();
         }
         loader.configure(config);
         return loader;
@@ -112,10 +118,11 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
      * @param close Whether to close the current graph instance after calling commit() or not.
      */
     private void commit(final boolean close) {
-        if (!close && (intermediateBatchSize == 0L || ++counter % intermediateBatchSize != 0)) return;
+        if (!close && (counter.get().incrementAndGet() % intermediateBatchSize != 0 || intermediateBatchSize == 0L))
+            return;
         if (null != graph) {
             if (graph.features().graph().supportsTransactions()) {
-                LOGGER.info("Committing transaction on Graph instance: {}", graph);
+                LOGGER.info("Committing transaction on Graph instance: {} [{}]", graph, counter.get().get());
                 try {
                     graph.tx().commit();
                     LOGGER.debug("Committed transaction on Graph instance: {}", graph);
@@ -139,6 +146,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     @Override
     public void setup(final Memory memory) {
+        counter.get().set(0L);
     }
 
     @Override


[22/31] incubator-tinkerpop git commit: disallow vertices/edges for GraphStartStep in computer mode

Posted by sp...@apache.org.
disallow vertices/edges for GraphStartStep in computer mode


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

Branch: refs/heads/master
Commit: 167e419a9bd16fb743ff5ef006770404951d4041
Parents: 18adacd
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Tue Sep 1 22:53:12 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Tue Sep 1 22:53:12 2015 +0200

----------------------------------------------------------------------
 .../strategy/verification/ComputerVerificationStrategy.java   | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/167e419a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
index a56afd4..8923372 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
@@ -46,7 +46,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierS
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.SupplyingBarrierStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
 
 import java.util.Arrays;
 import java.util.HashSet;
@@ -79,6 +81,11 @@ public final class ComputerVerificationStrategy extends AbstractTraversalStrateg
         if (traversal.getParent() instanceof EmptyStep) {
             if (!(traversal.getStartStep() instanceof GraphStep))
                 throw new VerificationException("GraphComputer does not support traversals starting from a non-GraphStep: " + traversal.getStartStep(), traversal);
+            for (final Object id : ((GraphStep) traversal.getStartStep()).getIds()) {
+                if (id instanceof Vertex || id instanceof Edge) {
+                    throw new VerificationException("GraphComputer does not support traversals starting from a particular vertex or edge.", traversal);
+                }
+            }
             ///
             if (endStep instanceof CollectingBarrierStep && endStep instanceof TraversalParent) {
                 if (((TraversalParent) endStep).getLocalChildren().stream().filter(t ->


[25/31] incubator-tinkerpop git commit: Fix broken image in changelog.

Posted by sp...@apache.org.
Fix broken image in 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/65d60f9f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/65d60f9f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/65d60f9f

Branch: refs/heads/master
Commit: 65d60f9f5a45a2989cdc1d2cc057480a613b9dba
Parents: 8e71d2e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 2 07:55:04 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 2 07:55:04 2015 -0400

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


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/65d60f9f/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 11bd6df..c051d87 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -20,7 +20,7 @@ TinkerPop3 CHANGELOG
 TinkerPop 3.0.0 (A Gremlin Rāga in 7/16 Time)
 ---------------------------------------------
 
-image::http://www.tinkerpop.com/docs/current/images/gremlin-hindu.png[width=225]
+image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/static/images/gremlin-hindu.png[width=225]
 
 TinkerPop 3.0.1 (Release Date: September 2, 2015)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


[29/31] incubator-tinkerpop git commit: Updates to binary LICENSE/NOTICE.

Posted by sp...@apache.org.
Updates to binary LICENSE/NOTICE.

Not sure why there were so many reference to libs that weren't actually bundled.  Also did some alphabetizing according to how file name in the binary distribution /lib directory.


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

Branch: refs/heads/master
Commit: 5a381391031c2756bf0927f4246e20e220306f8d
Parents: bce3e8b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 3 06:50:26 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Sep 3 06:50:26 2015 -0400

----------------------------------------------------------------------
 gremlin-console/src/main/LICENSE | 36 ++++++--------
 gremlin-console/src/main/NOTICE  | 59 +++++++----------------
 gremlin-server/src/main/LICENSE  | 33 +++++--------
 gremlin-server/src/main/NOTICE   | 90 ++++++++---------------------------
 4 files changed, 62 insertions(+), 156 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5a381391/gremlin-console/src/main/LICENSE
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/LICENSE b/gremlin-console/src/main/LICENSE
index 7b7a146..e124a3a 100644
--- a/gremlin-console/src/main/LICENSE
+++ b/gremlin-console/src/main/LICENSE
@@ -207,35 +207,30 @@ Apache 2.0 Licenses
 
 The Apache TinkerPop project bundles the following components under the Apache 2.0 License:
 
-     HPPC Collections (com.carrotsearch:hppc - http://labs.carrotsearch.com/hppc.html/hppc)
-     JUnitBenchmarks (com.carrotsearch:junit-benchmarks - http://labs.carrotsearch.com/junit-benchmarks.html)
-     Metrics Core (com.codahale.metrics:metrics-core - http://metrics.codahale.com/metrics-core/)
-     Ganglia Integration for Metrics (com.codahale.metrics:metrics-ganglia - http://metrics.codahale.com/metrics-ganglia/)
-     Graphite Integration for Metrics (com.codahale.metrics:metrics-graphite - http://metrics.codahale.com/metrics-graphite/)
-     Jackson-annotations (com.fasterxml.jackson.core:jackson-annotations - http://wiki.fasterxml.com/JacksonHome)
-     Jackson-core (com.fasterxml.jackson.core:jackson-core - http://wiki.fasterxml.com/JacksonHome)
-     jackson-databind (com.fasterxml.jackson.core:jackson-databind - http://wiki.fasterxml.com/JacksonHome)
      Commons BeanUtils (commons-beanutils:commons-beanutils - http://commons.apache.org/beanutils/)
      Commons Codec (commons-codec:commons-codec - http://commons.apache.org/codec/)
      Commons Collections (commons-collections:commons-collections - http://commons.apache.org/collections/)
      Apache Commons Configuration (commons-configuration:commons-configuration - http://commons.apache.org/configuration/)
-     Commons IO (commons-io:commons-io - http://commons.apache.org/io/)
      Commons Lang (commons-lang:commons-lang - http://commons.apache.org/lang/)
+     Apache Commons Lang (org.apache.commons:commons-lang3 - http://commons.apache.org/proper/commons-lang/)
      Commons Logging (commons-logging:commons-logging - http://commons.apache.org/logging)
-     Netty/All-in-One (io.netty:netty-all - http://netty.io/netty-all/)
-     Apache Log4j (log4j:log4j - http://logging.apache.org/log4j/1.2/)
      ezmorph (net.sf.ezmorph:ezmorph - http://ezmorph.sourceforge.net)
-     json-lib (net.sf.json-lib:json-lib - http://json-lib.sourceforge.net)
-     Neko HTML (net.sourceforge.nekohtml:nekohtml - http://nekohtml.sourceforge.net/)
-     Apache Commons Lang (org.apache.commons:commons-lang3 - http://commons.apache.org/proper/commons-lang/)
+     GBench (org.gperfutils:gbench - https://github.com/gperfutils/gbench)
+     GProf (org.gperfutils:gprof - https://github.com/gperfutils/gprof)
+     Groovy (org.codehaus.groovy:groovy-all - http://groovy.codehaus.org/)
+     HPPC Collections (com.carrotsearch:hppc - http://labs.carrotsearch.com/hppc.html/hppc)
      HttpClient (org.apache.httpcomponents:httpclient - http://hc.apache.org/httpcomponents-client)
      HttpCore (org.apache.httpcomponents:httpcore - http://hc.apache.org/httpcomponents-core-ga)
-     Apache Ivy (org.apache.ivy:ivy - http://ant.apache.org/ivy/)
-     Groovy (org.codehaus.groovy:groovy-all - http://groovy.codehaus.org/)
      HTTP client framework for Groovy (org.codehaus.groovy.modules.http-builder:http-builder - http://groovy.codehaus.org/modules/http-builder/)
-     GBench (org.gperfutils:gbench - https://github.com/gperfutils/gbench)
-     GProf (org.gperfutils:gprof - https://github.com/gperfutils/gprof)
+     Apache Ivy (org.apache.ivy:ivy - http://ant.apache.org/ivy/)
+     Jackson-annotations (com.fasterxml.jackson.core:jackson-annotations - http://wiki.fasterxml.com/JacksonHome)
+     Jackson-core (com.fasterxml.jackson.core:jackson-core - http://wiki.fasterxml.com/JacksonHome)
+     jackson-databind (com.fasterxml.jackson.core:jackson-databind - http://wiki.fasterxml.com/JacksonHome)
      javatuples (org.javatuples:javatuples - http://www.javatuples.org)
+     json-lib (net.sf.json-lib:json-lib - http://json-lib.sourceforge.net)
+     Apache Log4j (log4j:log4j - http://logging.apache.org/log4j/1.2/)
+     Neko HTML (net.sourceforge.nekohtml:nekohtml - http://nekohtml.sourceforge.net/)
+     Netty/All-in-One (io.netty:netty-all - http://netty.io/netty-all/)
      SnakeYAML (org.yaml:snakeyaml - http://www.snakeyaml.org)
      Xerces2 Java Parser (xerces:xercesImpl - http://xerces.apache.org/xerces2-j)
      XML Commons External Components XML APIs (xml-apis:xml-apis - http://xml.apache.org/commons/components/external/)
@@ -247,8 +242,7 @@ BSD-style Licenses
 
 The Apache TinkerPop project bundles the following components under the BSD License:
 
-     Hamcrest All (org.hamcrest:hamcrest-all - https://github.com/hamcrest/JavaHamcrest/hamcrest-all)
-     Hamcrest Core (org.hamcrest:hamcrest-core - https://github.com/hamcrest/JavaHamcrest/hamcrest-core)
+     jBCrypt (org.mindrot:jbcrypt - https://github.com/jeremyh/jBCrypt)
      jcabi-log (com.jcabi:jcabi-log - http://www.jcabi.com/jcabi-log)
      jcabi-manifests (com.jcabi:jcabi-manifests - http://www.jcabi.com/jcabi-manifests)
      JLine (jline:jline - http://nexus.sonatype.org/oss-repository-hosting.html/jline)
@@ -286,11 +280,9 @@ MIT Licenses
 
 The Apache TinkerPop project bundles the following components under the MIT License:
 
-     Mockito (org.mockito:mockito-all - http://www.mockito.org)
      JCL 1.1.1 implemented over SLF4J (org.slf4j:jcl-over-slf4j - http://www.slf4j.org)
      SLF4J API Module (org.slf4j:slf4j-api - http://www.slf4j.org)
      SLF4J LOG4J-12 Binding (org.slf4j:slf4j-log4j12 - http://www.slf4j.org)
-     gmetric4j (info.ganglia.gmetric4j:gmetric4j - http://github.com/ganglia/gmetric4j)
 
 All rights reserved.
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5a381391/gremlin-console/src/main/NOTICE
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/NOTICE b/gremlin-console/src/main/NOTICE
index c9a45e7..9900dd7 100644
--- a/gremlin-console/src/main/NOTICE
+++ b/gremlin-console/src/main/NOTICE
@@ -67,15 +67,6 @@ This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
 
 ------------------------------------------------------------------------
-Commons IO
-------------------------------------------------------------------------
-Apache Commons IO
-Copyright 2002-2014 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-------------------------------------------------------------------------
 Commons Lang
 ------------------------------------------------------------------------
 Apache Commons Lang
@@ -97,6 +88,17 @@ This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
 
 ------------------------------------------------------------------------
+Groovy
+------------------------------------------------------------------------
+Groovy Language
+Copyright 2003-2015 The respective authors and developers
+Developers and Contributors are listed in the project POM file
+and Gradle build file
+
+This product includes software developed by
+The Groovy community (http://groovy.codehaus.org/).
+
+------------------------------------------------------------------------
 Http Components Client
 ------------------------------------------------------------------------
 Apache HttpComponents Client
@@ -118,17 +120,6 @@ This project contains annotations derived from JCIP-ANNOTATIONS
 Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
 
 ------------------------------------------------------------------------
-Groovy
-------------------------------------------------------------------------
-Groovy Language
-Copyright 2003-2015 The respective authors and developers
-Developers and Contributors are listed in the project POM file
-and Gradle build file
-
-This product includes software developed by
-The Groovy community (http://groovy.codehaus.org/).
-
-------------------------------------------------------------------------
 Java Tuples
 ------------------------------------------------------------------------
 Copyright (c) 2010, The JAVATUPLES team (http://www.javatuples.org)
@@ -146,12 +137,6 @@ See the License for the specific language governing permissions and
 limitations under the License.
 
 ------------------------------------------------------------------------
-Hamcrest
-------------------------------------------------------------------------
-Copyright (c) 2000-2015 www.hamcrest.org
-All rights reserved.
-
-------------------------------------------------------------------------
 Log4j
 ------------------------------------------------------------------------
 This product includes software developed by
@@ -195,23 +180,17 @@ Copyright (c) 2002-2012, the original author or authors.
 All rights reserved.
 
 ------------------------------------------------------------------------
-Mockito
-------------------------------------------------------------------------
-Copyright (c) 2007 Mockito contributors
-
-------------------------------------------------------------------------
-gmetric4j
-------------------------------------------------------------------------
-Copyright (C) 2010-2015 Daniel Pocock <da...@pocock.com.au>
-Copyright (c) 2008-2011 Jasper Humphrey <ja...@gmail.com>
-
-------------------------------------------------------------------------
 SLF4j
 ------------------------------------------------------------------------
 Copyright (c) 2004-2007 QOS.ch
 All rights reserved.
 
 ------------------------------------------------------------------------
+jBCrypt
+------------------------------------------------------------------------
+Copyright (c) 2006 Damien Miller <dj...@mindrot.org>
+
+------------------------------------------------------------------------
 Xerces
 ------------------------------------------------------------------------
 Apache Xerces Java
@@ -435,8 +414,4 @@ Netty/All-in-One (io.netty:netty-all - http://netty.io/netty-all/)
        * LICENSE:
          * license/LICENSE.aalto-xml.txt (Apache License 2.0)
        * HOMEPAGE:
-         * http://wiki.fasterxml.com/AaltoHome
-
-
-
-
+         * http://wiki.fasterxml.com/AaltoHome
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5a381391/gremlin-server/src/main/LICENSE
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/LICENSE b/gremlin-server/src/main/LICENSE
index 1d41e61..e4e5bca 100644
--- a/gremlin-server/src/main/LICENSE
+++ b/gremlin-server/src/main/LICENSE
@@ -207,28 +207,22 @@ Apache 2.0 Licenses
 
 The Apache TinkerPop project bundles the following components under the Apache 2.0 License:
 
-     HPPC Collections (com.carrotsearch:hppc - http://labs.carrotsearch.com/hppc.html/hppc)
-     JUnitBenchmarks (com.carrotsearch:junit-benchmarks - http://labs.carrotsearch.com/junit-benchmarks.html)
-     Metrics Core (com.codahale.metrics:metrics-core - http://metrics.codahale.com/metrics-core/)
-     Ganglia Integration for Metrics (com.codahale.metrics:metrics-ganglia - http://metrics.codahale.com/metrics-ganglia/)
-     Graphite Integration for Metrics (com.codahale.metrics:metrics-graphite - http://metrics.codahale.com/metrics-graphite/)
-     Jackson-annotations (com.fasterxml.jackson.core:jackson-annotations - http://wiki.fasterxml.com/JacksonHome)
-     Jackson-core (com.fasterxml.jackson.core:jackson-core - http://wiki.fasterxml.com/JacksonHome)
-     jackson-databind (com.fasterxml.jackson.core:jackson-databind - http://wiki.fasterxml.com/JacksonHome)
-     Commons Codec (commons-codec:commons-codec - http://commons.apache.org/codec/)
      Commons Collections (commons-collections:commons-collections - http://commons.apache.org/collections/)
      Apache Commons Configuration (commons-configuration:commons-configuration - http://commons.apache.org/configuration/)
-     Commons IO (commons-io:commons-io - http://commons.apache.org/io/)
      Commons Lang (commons-lang:commons-lang - http://commons.apache.org/lang/)
-     Commons Logging (commons-logging:commons-logging - http://commons.apache.org/logging)
-     Netty/All-in-One (io.netty:netty-all - http://netty.io/netty-all/)
-     Apache Log4j (log4j:log4j - http://logging.apache.org/log4j/1.2/)
      Apache Commons Lang (org.apache.commons:commons-lang3 - http://commons.apache.org/proper/commons-lang/)
-     HttpClient (org.apache.httpcomponents:httpclient - http://hc.apache.org/httpcomponents-client)
-     HttpCore (org.apache.httpcomponents:httpcore - http://hc.apache.org/httpcomponents-core-ga)
-     Apache Ivy (org.apache.ivy:ivy - http://ant.apache.org/ivy/)
      Groovy (org.codehaus.groovy:groovy-all - http://groovy.codehaus.org/)
+     HPPC Collections (com.carrotsearch:hppc - http://labs.carrotsearch.com/hppc.html/hppc)
+     Apache Ivy (org.apache.ivy:ivy - http://ant.apache.org/ivy/)
+     Jackson-annotations (com.fasterxml.jackson.core:jackson-annotations - http://wiki.fasterxml.com/JacksonHome)
+     Jackson-core (com.fasterxml.jackson.core:jackson-core - http://wiki.fasterxml.com/JacksonHome)
+     jackson-databind (com.fasterxml.jackson.core:jackson-databind - http://wiki.fasterxml.com/JacksonHome)
      javatuples (org.javatuples:javatuples - http://www.javatuples.org)
+     Apache Log4j (log4j:log4j - http://logging.apache.org/log4j/1.2/)
+     Metrics Core (com.codahale.metrics:metrics-core - http://metrics.codahale.com/metrics-core/)
+     Ganglia Integration for Metrics (com.codahale.metrics:metrics-ganglia - http://metrics.codahale.com/metrics-ganglia/)
+     Graphite Integration for Metrics (com.codahale.metrics:metrics-graphite - http://metrics.codahale.com/metrics-graphite/)
+     Netty/All-in-One (io.netty:netty-all - http://netty.io/netty-all/)
      SnakeYAML (org.yaml:snakeyaml - http://www.snakeyaml.org)
 
 ========================================================================
@@ -237,12 +231,10 @@ BSD-style Licenses
 
 The Apache TinkerPop project bundles the following components under the BSD License:
 
-     Hamcrest All (org.hamcrest:hamcrest-all - https://github.com/hamcrest/JavaHamcrest/hamcrest-all)
-     Hamcrest Core (org.hamcrest:hamcrest-core - https://github.com/hamcrest/JavaHamcrest/hamcrest-core)
+     jBCrypt (org.mindrot:jbcrypt - https://github.com/jeremyh/jBCrypt)
      jcabi-log (com.jcabi:jcabi-log - http://www.jcabi.com/jcabi-log)
      jcabi-manifests (com.jcabi:jcabi-manifests - http://www.jcabi.com/jcabi-manifests)
      JLine (jline:jline - http://nexus.sonatype.org/oss-repository-hosting.html/jline)
-     jBCrypt (org.mindrot:jbcrypt - https://github.com/jeremyh/jBCrypt)
 
 All rights reserved.
 
@@ -277,11 +269,10 @@ MIT Licenses
 
 The Apache TinkerPop project bundles the following components under the MIT License:
 
-     Mockito (org.mockito:mockito-all - http://www.mockito.org)
+     gmetric4j (info.ganglia.gmetric4j:gmetric4j - http://github.com/ganglia/gmetric4j)
      JCL 1.1.1 implemented over SLF4J (org.slf4j:jcl-over-slf4j - http://www.slf4j.org)
      SLF4J API Module (org.slf4j:slf4j-api - http://www.slf4j.org)
      SLF4J LOG4J-12 Binding (org.slf4j:slf4j-log4j12 - http://www.slf4j.org)
-     gmetric4j (info.ganglia.gmetric4j:gmetric4j - http://github.com/ganglia/gmetric4j)
 
 All rights reserved.
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5a381391/gremlin-server/src/main/NOTICE
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/NOTICE b/gremlin-server/src/main/NOTICE
index cb533dd..4ad5e46 100644
--- a/gremlin-server/src/main/NOTICE
+++ b/gremlin-server/src/main/NOTICE
@@ -19,36 +19,6 @@ their respective licenses.
 ========================================================================
 
 ------------------------------------------------------------------------
-commons-beanutils
-------------------------------------------------------------------------
-Apache Commons BeanUtils
-Copyright 2000-2014 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-------------------------------------------------------------------------
-commons-codec
-------------------------------------------------------------------------
-Apache Commons Codec
-Copyright 2002-2015 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java
-contains test data from http://aspell.net/test/orig/batch0.tab.
-Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org)
-
-===============================================================================
-
-The content of package org.apache.commons.codec.language.bm has been translated
-from the original php source code available at http://stevemorse.org/phoneticinfo.htm
-with permission from the original authors.
-Original source copyright:
-Copyright (c) 2008 Alexander Beider & Stephen P. Morse.
-
-------------------------------------------------------------------------
 Commons Collections
 ------------------------------------------------------------------------
 Apache Commons Collections
@@ -67,15 +37,6 @@ This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
 
 ------------------------------------------------------------------------
-Commons IO
-------------------------------------------------------------------------
-Apache Commons IO
-Copyright 2002-2014 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-------------------------------------------------------------------------
 Commons Lang
 ------------------------------------------------------------------------
 Apache Commons Lang
@@ -97,27 +58,6 @@ This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
 
 ------------------------------------------------------------------------
-Http Components Client
-------------------------------------------------------------------------
-Apache HttpComponents Client
-Copyright 1999-2015 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-------------------------------------------------------------------------
-Http Components Core
-------------------------------------------------------------------------
-Apache HttpComponents Core
-Copyright 2005-2014 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-This project contains annotations derived from JCIP-ANNOTATIONS
-Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
-
-------------------------------------------------------------------------
 Groovy
 ------------------------------------------------------------------------
 Groovy Language
@@ -146,12 +86,6 @@ See the License for the specific language governing permissions and
 limitations under the License.
 
 ------------------------------------------------------------------------
-Hamcrest
-------------------------------------------------------------------------
-Copyright (c) 2000-2015 www.hamcrest.org
-All rights reserved.
-
-------------------------------------------------------------------------
 Log4j
 ------------------------------------------------------------------------
 This product includes software developed by
@@ -163,6 +97,25 @@ Programmer's Guide and Specification" and freely available
 to the public at http://java.sun.com/docs/books/jni.
 
 ------------------------------------------------------------------------
+Metrics
+------------------------------------------------------------------------
+Copyright 2010-2013 Coda Hale and Yammer, Inc., 2014-2015 Dropwizard Team
+
+This product includes software developed by Coda Hale and Yammer, Inc.
+
+This product includes code derived from the JSR-166 project (ThreadLocalRandom, Striped64,
+LongAdder), which was released with the following comments:
+
+    Written by Doug Lea with assistance from members of JCP JSR-166
+    Expert Group and released to the public domain, as explained at
+    http://creativecommons.org/publicdomain/zero/1.0/
+
+------------------------------------------------------------------------
+jBCrypt
+------------------------------------------------------------------------
+Copyright (c) 2006 Damien Miller <dj...@mindrot.org>
+
+------------------------------------------------------------------------
 jcabi-log
 ------------------------------------------------------------------------
 Copyright (c) 2012-2014, jcabi.com
@@ -181,11 +134,6 @@ Copyright (c) 2002-2012, the original author or authors.
 All rights reserved.
 
 ------------------------------------------------------------------------
-Mockito
-------------------------------------------------------------------------
-Copyright (c) 2007 Mockito contributors
-
-------------------------------------------------------------------------
 gmetric4j
 ------------------------------------------------------------------------
 Copyright (C) 2010-2015 Daniel Pocock <da...@pocock.com.au>


[12/31] incubator-tinkerpop git commit: Big cleanup after testing failure scenarios.

Posted by sp...@apache.org.
Big cleanup after testing failure scenarios.

Got rid of DefaultBulkLoader. Renamed IncrementalBulkLoader to DefaultBulkLoader.


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

Branch: refs/heads/master
Commit: 9f467c4cf8c78d28bbf914e9465c045be3b558ce
Parents: 4978e33
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Sat Aug 29 03:17:20 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Sat Aug 29 03:17:20 2015 +0200

----------------------------------------------------------------------
 .../computer/bulkloading/BulkLoader.java        |   6 +-
 .../bulkloading/BulkLoaderVertexProgram.java    |  39 ++++---
 .../computer/bulkloading/DefaultBulkLoader.java |  70 ++++++++----
 .../bulkloading/IncrementalBulkLoader.java      | 112 -------------------
 4 files changed, 76 insertions(+), 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9f467c4c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
index 5619971..dd5eaf4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
@@ -95,11 +95,9 @@ public interface BulkLoader {
     public boolean useUserSuppliedIds();
 
     /**
-     * @return Whether original vertex identifiers are stored in the target graph or not.
+     * @return Whether to keep the original vertex identifiers in the target graph or not.
      */
-    public default boolean storeOriginalIds() {
-        return !useUserSuppliedIds();
-    }
+    public boolean keepOriginalIds();
 
     /**
      * @return The name of the vertex property that is used to store the original vertex id.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9f467c4c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 2f36a6e..b8219fb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -54,10 +54,10 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(BulkLoaderVertexProgram.class);
 
-    public static final String BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX = "gremlin.bulkLoading";
-    private static final String GRAPH_CFG_KEY = "graph";
-    private static final String BULK_LOADER_CFG_KEY = "loader";
-    private static final String INTERMEDIATE_BATCH_SIZE_CFG_KEY = "intermediateBatchSize";
+    public static final String BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX = "gremlin.bulkLoaderVertexProgram";
+    public static final String GRAPH_CFG_KEY = "graph";
+    public static final String BULK_LOADER_CFG_KEY = "loader";
+    public static final String INTERMEDIATE_BATCH_SIZE_CFG_KEY = "intermediateBatchSize";
     public static final String BULK_LOADER_VERTEX_ID_CFG_KEY = "vertexIdProperty";
     public static final String DEFAULT_BULK_LOADER_VERTEX_ID = "bulkLoader.vertex.id";
 
@@ -117,9 +117,8 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
             if (graph.features().graph().supportsTransactions()) {
                 LOGGER.info("Committing transaction on Graph instance: {}", graph);
                 try {
-                    graph.tx().commit(); // TODO will Giraph/MR restart the program and re-run execute if this fails?
+                    graph.tx().commit();
                     LOGGER.debug("Committed transaction on Graph instance: {}", graph);
-                    counter = 0L;
                 } catch (Exception e) {
                     LOGGER.error("Failed to commit transaction on Graph instance: {}", graph);
                     graph.tx().rollback();
@@ -140,7 +139,6 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     @Override
     public void setup(final Memory memory) {
-
     }
 
     @Override
@@ -156,6 +154,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
         }
         intermediateBatchSize = configuration.getLong(INTERMEDIATE_BATCH_SIZE_CFG_KEY, 0L);
         elementComputeKeys.add(configuration.subset(BULK_LOADER_CFG_KEY).getString(BULK_LOADER_VERTEX_ID_CFG_KEY));
+        bulkLoader = createBulkLoader();
     }
 
     @Override
@@ -176,7 +175,6 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
                     throw new IllegalStateException("The given graph instance does not allow concurrent access.");
                 }
                 g = graph.traversal();
-                bulkLoader = createBulkLoader();
             } catch (Exception e) {
                 try {
                     graph.close();
@@ -222,12 +220,13 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
                 sourceVertex.property(bulkLoader.getVertexIdProperty(), targetVertex.id());
                 messenger.sendMessage(messageScope, Pair.with(sourceVertex.id(), targetVertex.id()));
             }
-        } else {
+        } else if (memory.getIteration() == 1) {
             if (bulkLoader.useUserSuppliedIds()) {
                 final Vertex outV = bulkLoader.getVertex(sourceVertex, graph, g);
                 sourceVertex.edges(Direction.OUT).forEachRemaining(edge -> {
                     final Vertex inV = bulkLoader.getVertex(edge.inVertex(), graph, g);
                     bulkLoader.getOrCreateEdge(edge, outV, inV, graph, g);
+                    this.commit(false);
                 });
             } else {
                 // create an id map and populate it with all the incoming messages
@@ -237,7 +236,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
                     final Tuple idPair = idi.next();
                     idPairs.put(idPair.getValue(0), idPair.getValue(1));
                 }
-                // get the vertex given the dummy id property
+                // get the vertex with given the dummy id property
                 final Long outVId = sourceVertex.value(bulkLoader.getVertexIdProperty());
                 final Vertex outV = bulkLoader.getVertexById(outVId, graph, g);
                 // for all the incoming edges of the vertex, get the incoming adjacent vertex and write the edge and its properties
@@ -248,12 +247,23 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
                     this.commit(false);
                 });
             }
+        } else if (memory.getIteration() == 2) {
+            final Long vertexId = sourceVertex.value(bulkLoader.getVertexIdProperty());
+            bulkLoader.getVertexById(vertexId, graph, g)
+                    .property(bulkLoader.getVertexIdProperty()).remove();
+            this.commit(false);
         }
     }
 
     @Override
     public boolean terminate(final Memory memory) {
-        return memory.getIteration() >= 1;
+        switch (memory.getIteration()) {
+            case 1:
+                return bulkLoader.keepOriginalIds();
+            case 2:
+                return true;
+        }
+        return false;
     }
 
     @Override
@@ -266,6 +276,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
         return Collections.singleton(messageScope);
     }
 
+    @SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException", "CloneDoesntCallSuperClone"})
     @Override
     public VertexProgram<Tuple> clone() {
         return this;
@@ -273,17 +284,17 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     @Override
     public GraphComputer.ResultGraph getPreferredResultGraph() {
-        return GraphComputer.ResultGraph.NEW;
+        return GraphComputer.ResultGraph.ORIGINAL;
     }
 
     @Override
     public GraphComputer.Persist getPreferredPersist() {
-        return GraphComputer.Persist.EDGES;
+        return GraphComputer.Persist.NOTHING;
     }
 
     @Override
     public String toString() {
-        return StringFactory.vertexProgramString(this, "");
+        return StringFactory.vertexProgramString(this, bulkLoader != null ? bulkLoader.getClass().getSimpleName() : null);
     }
 
     public static Builder build() {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9f467c4c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
index 029d379..75d3494 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
@@ -19,38 +19,43 @@
 package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Property;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 
+import java.util.Iterator;
+
 /**
  * @author Daniel Kuppitz (http://gremlin.guru)
  */
 public class DefaultBulkLoader implements BulkLoader {
 
     public final static String USER_SUPPLIED_IDS_CFG_KEY = "userSuppliedIds";
-    public final static String STORE_ORIGINAL_IDS_CFG_KEY = "storeOriginalIds";
+    public final static String KEEP_ORIGINAL_IDS_CFG_KEY = "keepOriginalIds";
 
     private String bulkLoaderVertexId = BulkLoaderVertexProgram.DEFAULT_BULK_LOADER_VERTEX_ID;
-    private boolean storeOriginalIds = false;
-    private boolean useUserSuppliedIds = false;
+    private boolean keepOriginalIds = true;
+    private boolean userSuppliedIds = false;
 
     /**
      * {@inheritDoc}
      */
     @Override
     public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
-        if (useUserSuppliedIds()) {
-            return graph.addVertex(T.id, vertex.id(), T.label, vertex.label());
-        }
-        final Vertex v = graph.addVertex(T.label, vertex.label());
-        if (storeOriginalIds()) {
-            v.property(bulkLoaderVertexId, vertex.id());
-        }
-        return v;
+        final Iterator<Vertex> iterator = useUserSuppliedIds()
+                ? graph.vertices(vertex.id())
+                : g.V().has(vertex.label(), getVertexIdProperty(), vertex.id());
+        return iterator.hasNext()
+                ? iterator.next()
+                : useUserSuppliedIds()
+                ? graph.addVertex(T.id, vertex.id(), T.label, vertex.label())
+                : graph.addVertex(T.label, vertex.label(), getVertexIdProperty(), vertex.id());
     }
 
     /**
@@ -58,8 +63,20 @@ public class DefaultBulkLoader implements BulkLoader {
      */
     @Override
     public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g) {
-        final Edge e = outVertex.addEdge(edge.label(), inVertex);
-        edge.properties().forEachRemaining(property -> e.property(property.key(), property.value()));
+        final Edge e;
+        final Traversal<Vertex, Edge> t = g.V(outVertex).outE(edge.label()).filter(__.inV().is(inVertex));
+        if (t.hasNext()) {
+            e = t.next();
+            edge.properties().forEachRemaining(property -> {
+                final Property<?> existing = e.property(property.key());
+                if (!existing.isPresent() || !existing.value().equals(property.value())) {
+                    e.property(property.key(), property.value());
+                }
+            });
+        } else {
+            e = outVertex.addEdge(edge.label(), inVertex);
+            edge.properties().forEachRemaining(property -> e.property(property.key(), property.value()));
+        }
         return e;
     }
 
@@ -68,8 +85,19 @@ public class DefaultBulkLoader implements BulkLoader {
      */
     @Override
     public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
-        final VertexProperty<?> vp = vertex.property(property.key(), property.value());
-        vp.properties().forEachRemaining(metaProperty -> property.property(metaProperty.key(), metaProperty.value()));
+        final VertexProperty<?> vp;
+        final VertexProperty<?> existing = vertex.property(property.key());
+        if (!existing.isPresent() || !existing.value().equals(property.value())) {
+            vp = vertex.property(property.key(), property.value());
+        } else {
+            vp = existing;
+        }
+        property.properties().forEachRemaining(metaProperty -> {
+            final Property<?> existing2 = vp.property(metaProperty.key());
+            if (!existing2.isPresent() || !existing2.value().equals(metaProperty.value())) {
+                vp.property(metaProperty.key(), metaProperty.value());
+            }
+        });
         return vp;
     }
 
@@ -88,15 +116,15 @@ public class DefaultBulkLoader implements BulkLoader {
      */
     @Override
     public boolean useUserSuppliedIds() {
-        return useUserSuppliedIds;
+        return userSuppliedIds;
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public boolean storeOriginalIds() {
-        return storeOriginalIds;
+    public boolean keepOriginalIds() {
+        return keepOriginalIds;
     }
 
     /**
@@ -116,10 +144,10 @@ public class DefaultBulkLoader implements BulkLoader {
             bulkLoaderVertexId = configuration.getString(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID_CFG_KEY);
         }
         if (configuration.containsKey(USER_SUPPLIED_IDS_CFG_KEY)) {
-            useUserSuppliedIds = configuration.getBoolean(USER_SUPPLIED_IDS_CFG_KEY);
+            userSuppliedIds = configuration.getBoolean(USER_SUPPLIED_IDS_CFG_KEY);
         }
-        if (configuration.containsKey(STORE_ORIGINAL_IDS_CFG_KEY)) {
-            storeOriginalIds = configuration.getBoolean(STORE_ORIGINAL_IDS_CFG_KEY);
+        if (configuration.containsKey(KEEP_ORIGINAL_IDS_CFG_KEY)) {
+            keepOriginalIds = configuration.getBoolean(KEEP_ORIGINAL_IDS_CFG_KEY);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9f467c4c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
deleted file mode 100644
index 7822c2d..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Iterator;
-
-/**
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public class IncrementalBulkLoader extends DefaultBulkLoader {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(IncrementalBulkLoader.class);
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
-        final Iterator<Vertex> iterator = useUserSuppliedIds()
-                ? graph.vertices(vertex.id())
-                : g.V().has(vertex.label(), getVertexIdProperty(), vertex.id());
-        return iterator.hasNext() ? iterator.next() : super.getOrCreateVertex(vertex, graph, g);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g) {
-        final Traversal<Vertex, Edge> t = g.V(outVertex).outE(edge.label()).filter(__.inV().is(inVertex));
-        if (t.hasNext()) {
-            final Edge e = t.next();
-            edge.properties().forEachRemaining(property -> {
-                final Property<?> existing = e.property(property.key());
-                if (!existing.isPresent() || !existing.value().equals(property.value())) {
-                    e.property(property.key(), property.value());
-                }
-            });
-            return e;
-        }
-        return super.getOrCreateEdge(edge, outVertex, inVertex, graph, g);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
-        final VertexProperty<?> vp;
-        final VertexProperty<?> existing = vertex.property(property.key());
-        if (!existing.isPresent() || !existing.value().equals(property.value())) {
-            vp = vertex.property(property.key(), property.value());
-        } else {
-            vp = existing;
-        }
-        property.properties().forEachRemaining(metaProperty -> {
-            final Property<?> existing2 = vp.property(metaProperty.key());
-            if (!existing2.isPresent() || !existing2.value().equals(metaProperty.value())) {
-                vp.property(metaProperty.key(), metaProperty.value());
-            }
-        });
-        return vp;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean storeOriginalIds() {
-        return !useUserSuppliedIds();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void configure(final Configuration configuration) {
-        super.configure(configuration);
-        if (configuration.containsKey(STORE_ORIGINAL_IDS_CFG_KEY)) {
-            LOGGER.warn("{} automatically determines whether original identifiers should be stored or not, hence the " +
-                    "configuration setting '{}' will be ignored.", this.getClass(), STORE_ORIGINAL_IDS_CFG_KEY);
-        }
-    }
-}


[28/31] incubator-tinkerpop git commit: OrderTest updated to not do an iffy situation where there is no solid defined contract on the behavior of in Map serialized vertices.

Posted by sp...@apache.org.
OrderTest updated to not do an iffy situation where there is no solid defined contract on the behavior of in Map serialized vertices.


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

Branch: refs/heads/master
Commit: bce3e8bd54cb7b7f27a2cfe11a4878d5bbcb473e
Parents: 04ba481
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Sep 2 15:49:40 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Sep 2 15:49:40 2015 -0600

----------------------------------------------------------------------
 .../traversal/step/map/GroovyOrderTest.groovy   |  4 ++--
 .../process/traversal/step/map/OrderTest.java   | 22 ++++++++++----------
 2 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bce3e8bd/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyOrderTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyOrderTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyOrderTest.groovy
index 69e354d..50eef57 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyOrderTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyOrderTest.groovy
@@ -83,8 +83,8 @@ public abstract class GroovyOrderTest {
         }
 
         @Override
-        public Traversal<Vertex, Map<String, List<Vertex>>> get_g_V_group_byXlabelX_by_byXorderXlocalX_byXname_decrXX() {
-            TraversalScriptHelper.compute("g.V.group.by(label).by.by(order(local).by('name', decr))", g)
+        public Traversal<Vertex, Map<String, List<Vertex>>> get_g_V_group_byXlabelX_byXnameX_byXorderXlocalX_byXdecrXX() {
+            TraversalScriptHelper.compute("g.V.group.by(label).by('name').by(order(local).by(decr))", g)
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bce3e8bd/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/OrderTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/OrderTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/OrderTest.java
index cd893fc..1da9969 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/OrderTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/OrderTest.java
@@ -68,7 +68,7 @@ public abstract class OrderTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Vertex> get_g_V_order_byXoutE_count__decrX();
 
-    public abstract Traversal<Vertex, Map<String, List<Vertex>>> get_g_V_group_byXlabelX_by_byXorderXlocalX_byXname_decrXX();
+    public abstract Traversal<Vertex, Map<String, List<Vertex>>> get_g_V_group_byXlabelX_byXnameX_byXorderXlocalX_byXdecrXX();
 
     @Test
     @LoadGraphWith(MODERN)
@@ -224,22 +224,22 @@ public abstract class OrderTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
-    public void g_V_group_byXlabelX_by_byXorderXlocalX_byXname_decrXX() {
-        final Traversal<Vertex, Map<String, List<Vertex>>> traversal = get_g_V_group_byXlabelX_by_byXorderXlocalX_byXname_decrXX();
+    public void g_V_group_byXlabelX_byXnameX_byXorderXlocalX_byXdecrXX() {
+        final Traversal<Vertex, Map<String, List<Vertex>>> traversal = get_g_V_group_byXlabelX_byXnameX_byXorderXlocalX_byXdecrXX();
         printTraversalForm(traversal);
         final Map<String, List<Vertex>> map = traversal.next();
         assertFalse(traversal.hasNext());
         assertEquals(2, map.size());
         List list = map.get("software");
         assertEquals(2, list.size());
-        assertEquals(convertToVertex(graph, "lop"), list.get(1));
-        assertEquals(convertToVertex(graph, "ripple"), list.get(0));
+        assertEquals("lop", list.get(1));
+        assertEquals("ripple", list.get(0));
         list = map.get("person");
         assertEquals(4, list.size());
-        assertEquals(convertToVertex(graph, "josh"), list.get(3));
-        assertEquals(convertToVertex(graph, "marko"), list.get(2));
-        assertEquals(convertToVertex(graph, "peter"), list.get(1));
-        assertEquals(convertToVertex(graph, "vadas"), list.get(0));
+        assertEquals("josh", list.get(3));
+        assertEquals("marko", list.get(2));
+        assertEquals("peter", list.get(1));
+        assertEquals("vadas", list.get(0));
     }
 
     public static class Traversals extends OrderTest {
@@ -299,8 +299,8 @@ public abstract class OrderTest extends AbstractGremlinProcessTest {
         }
 
         @Override
-        public Traversal<Vertex, Map<String, List<Vertex>>> get_g_V_group_byXlabelX_by_byXorderXlocalX_byXname_decrXX() {
-            return g.V().<String, List<Vertex>>group().by(T.label).by().by(__.order(Scope.local).by("name", Order.decr));
+        public Traversal<Vertex, Map<String, List<Vertex>>> get_g_V_group_byXlabelX_byXnameX_byXorderXlocalX_byXdecrXX() {
+            return g.V().<String, List<Vertex>>group().by(T.label).by("name").by(__.order(Scope.local).by(Order.decr));
         }
 
     }


[16/31] incubator-tinkerpop git commit: tweaked BLVP configuration

Posted by sp...@apache.org.
tweaked BLVP configuration


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

Branch: refs/heads/master
Commit: b1191e743a2b574a7bcc990ad27d99ab9df21f8f
Parents: e5d5192
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Aug 31 20:38:27 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Mon Aug 31 20:38:27 2015 +0200

----------------------------------------------------------------------
 .../gremlin/process/computer/VertexProgram.java |  4 +
 .../bulkloading/BulkLoaderVertexProgram.java    | 83 +++++++++++++++++---
 .../bulkloading/IncrementalBulkLoader.java      | 11 +--
 .../util/AbstractVertexProgramBuilder.java      |  5 +-
 .../BulkLoaderVertexProgramTest.java            | 17 +---
 5 files changed, 90 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b1191e74/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/VertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/VertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/VertexProgram.java
index 4fd9e82..37ff8e7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/VertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/VertexProgram.java
@@ -223,6 +223,10 @@ public interface VertexProgram<M> extends Cloneable {
 
     public interface Builder {
 
+        /**
+         * This method should only be used by the underlying compute engine. For VertexProgram configurations, please
+         * use specific fluent methods off the builder.
+         */
         public Builder configure(final Object... keyValues);
 
         public <P extends VertexProgram> P create(final Graph graph);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b1191e74/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 9ab21c2..eaebd53 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -20,7 +20,9 @@ package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
 
 import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.ConfigurationUtils;
+import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.computer.Memory;
 import org.apache.tinkerpop.gremlin.process.computer.MessageScope;
@@ -58,6 +60,8 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     public static final String BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX = "gremlin.bulkLoaderVertexProgram";
     public static final String GRAPH_CFG_KEY = "graph";
     public static final String BULK_LOADER_CFG_KEY = "loader";
+    public final static String USER_SUPPLIED_IDS_CFG_KEY = "userSuppliedIds";
+    public final static String KEEP_ORIGINAL_IDS_CFG_KEY = "keepOriginalIds";
     public static final String INTERMEDIATE_BATCH_SIZE_CFG_KEY = "intermediateBatchSize";
     public static final String BULK_LOADER_VERTEX_ID_CFG_KEY = "vertexIdProperty";
     public static final String DEFAULT_BULK_LOADER_VERTEX_ID = "bulkLoader.vertex.id";
@@ -81,13 +85,6 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
         elementComputeKeys = new HashSet<>();
     }
 
-    private Configuration getGraphConfiguration() {
-        final Configuration config = configuration.subset(GRAPH_CFG_KEY);
-        config.setProperty(Graph.GRAPH, config.getString("class"));
-        config.clearProperty("class");
-        return config;
-    }
-
     private BulkLoader createBulkLoader() {
         final BulkLoader loader;
         final Configuration config = configuration.subset(BULK_LOADER_CFG_KEY);
@@ -118,7 +115,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
      * @param close Whether to close the current graph instance after calling commit() or not.
      */
     private void commit(final boolean close) {
-        if (!close && (counter.get().incrementAndGet() % intermediateBatchSize != 0 || intermediateBatchSize == 0L))
+        if (!close && (intermediateBatchSize == 0L || counter.get().incrementAndGet() % intermediateBatchSize != 0))
             return;
         if (null != graph) {
             if (graph.features().graph().supportsTransactions()) {
@@ -176,7 +173,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     @Override
     public void workerIterationStart(final Memory memory) {
         if (null == graph) {
-            graph = GraphFactory.open(getGraphConfiguration());
+            graph = GraphFactory.open(configuration.subset(GRAPH_CFG_KEY));
             LOGGER.info("Opened Graph instance: {}", graph);
             try {
                 if (!graph.features().graph().supportsConcurrentAccess()) {
@@ -321,5 +318,73 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
             ConfigurationUtils.append(graph.configuration().subset(BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX), configuration);
             return (BulkLoaderVertexProgram) VertexProgram.createVertexProgram(graph, this.configuration);
         }
+
+        private void setLoaderConfigurationProperty(final String key, final Object value) {
+            configuration.setProperty(String.join(".", BULK_LOADER_CFG_KEY, key), value);
+        }
+
+        private void setGraphConfigurationProperty(final String key, final Object value) {
+            configuration.setProperty(String.join(".", GRAPH_CFG_KEY, key), value);
+        }
+
+        /**
+         * Sets the class name of the BulkLoader implementation to be used.
+         */
+        public Builder bulkLoader(final String className) {
+            setLoaderConfigurationProperty(Graph.GRAPH, className);
+            return this;
+        }
+
+        /**
+         * Sets the class of the BulkLoader implementation to be used.
+         */
+        public Builder bulkLoader(final Class<? extends BulkLoader> clazz) {
+            return bulkLoader(clazz.getCanonicalName());
+        }
+
+        /**
+         * Sets the name of the property that is used to store the original vertex identifiers in the target graph.
+         */
+        public Builder vertexIdProperty(final String name) {
+            setLoaderConfigurationProperty(BULK_LOADER_VERTEX_ID_CFG_KEY, name);
+            return this;
+        }
+
+        /**
+         * Specifies whether user supplied identifiers should be used when the bulk loader creates vertices in the
+         * target graph.
+         */
+        public Builder userSuppliedIds(final boolean useUserSuppliedIds) {
+            setLoaderConfigurationProperty(USER_SUPPLIED_IDS_CFG_KEY, useUserSuppliedIds);
+            return this;
+        }
+
+        /**
+         * Specifies whether the original vertex identifiers should be kept in the target graph or not. In case of false
+         * BulkLoaderVertexProgram will add another iteration to remove the properties and it won't be possible to use
+         * the data for further incremental bulk loads.
+         */
+        public Builder keepOriginalIds(final boolean keepOriginalIds) {
+            setLoaderConfigurationProperty(KEEP_ORIGINAL_IDS_CFG_KEY, keepOriginalIds);
+            return this;
+        }
+
+        /**
+         * The batch size for a single transaction (number of vertices in the vertex loading stage; number of edges in
+         * the edge loading stage).
+         */
+        public Builder intermediateBatchSize(final int batchSize) {
+            configuration.setProperty(INTERMEDIATE_BATCH_SIZE_CFG_KEY, batchSize);
+            return this;
+        }
+
+        /**
+         * A configuration for the target graph that can be passed to GraphFactory.open().
+         */
+        public Builder writeGraph(final String configurationFile) throws ConfigurationException {
+            final Configuration conf = new PropertiesConfiguration(configurationFile);
+            conf.getKeys().forEachRemaining(key -> setGraphConfigurationProperty(key, conf.getProperty(key)));
+            return this;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b1191e74/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
index 2177d0b..f03cd18 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
@@ -36,9 +36,6 @@ import java.util.Iterator;
  */
 public class IncrementalBulkLoader implements BulkLoader {
 
-    public final static String USER_SUPPLIED_IDS_CFG_KEY = "userSuppliedIds";
-    public final static String KEEP_ORIGINAL_IDS_CFG_KEY = "keepOriginalIds";
-
     private String bulkLoaderVertexId = BulkLoaderVertexProgram.DEFAULT_BULK_LOADER_VERTEX_ID;
     private boolean keepOriginalIds = true;
     private boolean userSuppliedIds = false;
@@ -143,11 +140,11 @@ public class IncrementalBulkLoader implements BulkLoader {
         if (configuration.containsKey(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID_CFG_KEY)) {
             bulkLoaderVertexId = configuration.getString(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID_CFG_KEY);
         }
-        if (configuration.containsKey(USER_SUPPLIED_IDS_CFG_KEY)) {
-            userSuppliedIds = configuration.getBoolean(USER_SUPPLIED_IDS_CFG_KEY);
+        if (configuration.containsKey(BulkLoaderVertexProgram.USER_SUPPLIED_IDS_CFG_KEY)) {
+            userSuppliedIds = configuration.getBoolean(BulkLoaderVertexProgram.USER_SUPPLIED_IDS_CFG_KEY);
         }
-        if (configuration.containsKey(KEEP_ORIGINAL_IDS_CFG_KEY)) {
-            keepOriginalIds = configuration.getBoolean(KEEP_ORIGINAL_IDS_CFG_KEY);
+        if (configuration.containsKey(BulkLoaderVertexProgram.KEEP_ORIGINAL_IDS_CFG_KEY)) {
+            keepOriginalIds = configuration.getBoolean(BulkLoaderVertexProgram.KEEP_ORIGINAL_IDS_CFG_KEY);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b1191e74/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/AbstractVertexProgramBuilder.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/AbstractVertexProgramBuilder.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/AbstractVertexProgramBuilder.java
index 035b685..50e5157 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/AbstractVertexProgramBuilder.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/AbstractVertexProgramBuilder.java
@@ -18,8 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.process.computer.util;
 
-import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
 import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 
 /**
@@ -44,6 +44,9 @@ public abstract class AbstractVertexProgramBuilder<B extends VertexProgram.Build
         return (B) this;
     }*/
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public B configure(final Object... keyValues) {
         VertexProgramHelper.legalConfigurationKeyValueArray(keyValues);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b1191e74/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
index 3584c00..d3e42f7 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
@@ -22,7 +22,6 @@ import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
-import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
 import org.junit.Test;
@@ -38,11 +37,7 @@ import static org.junit.Assert.assertTrue;
  */
 public class BulkLoaderVertexProgramTest extends AbstractGremlinProcessTest {
 
-    private BulkLoader getBulkLoader(final Configuration configuration) throws Exception {
-        final VertexProgram.Builder builder = BulkLoaderVertexProgram.build();
-        if (configuration != null)
-            configuration.getKeys().forEachRemaining(key -> builder.configure(key, configuration.getProperty(key)));
-        BulkLoaderVertexProgram blvp = builder.create(graph);
+    private BulkLoader getBulkLoader(final BulkLoaderVertexProgram blvp) throws Exception {
         final Field field = BulkLoaderVertexProgram.class.getDeclaredField("bulkLoader");
         field.setAccessible(true);
         return (BulkLoader) field.get(blvp);
@@ -56,7 +51,7 @@ public class BulkLoaderVertexProgramTest extends AbstractGremlinProcessTest {
 
     @Test
     public void shouldUseIncrementalBulkLoaderByDefault() throws Exception {
-        final BulkLoader loader = getBulkLoader(null);
+        final BulkLoader loader = getBulkLoader(BulkLoaderVertexProgram.build().create(graph));
         assertTrue(loader instanceof IncrementalBulkLoader);
         assertTrue(loader.keepOriginalIds());
         assertFalse(loader.useUserSuppliedIds());
@@ -65,9 +60,7 @@ public class BulkLoaderVertexProgramTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void shouldStoreOriginalIds() throws Exception {
-        final Configuration configuration = new BaseConfiguration();
-        configuration.setProperty("loader.userSuppliedIds", false);
-        final BulkLoader loader = getBulkLoader(configuration);
+        final BulkLoader loader = getBulkLoader(BulkLoaderVertexProgram.build().userSuppliedIds(false).create(graph));
         assertFalse(loader.useUserSuppliedIds());
         final Graph target = getTargetGraph();
         graph.vertices().forEachRemaining(v -> loader.getOrCreateVertex(v, target, target.traversal()));
@@ -77,9 +70,7 @@ public class BulkLoaderVertexProgramTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void shouldNotStoreOriginalIds() throws Exception {
-        final Configuration configuration = new BaseConfiguration();
-        configuration.setProperty("loader.userSuppliedIds", true);
-        final BulkLoader loader = getBulkLoader(configuration);
+        final BulkLoader loader = getBulkLoader(BulkLoaderVertexProgram.build().userSuppliedIds(true).create(graph));
         assertTrue(loader.useUserSuppliedIds());
         final Graph target = getTargetGraph();
         graph.vertices().forEachRemaining(v -> loader.getOrCreateVertex(v, target, target.traversal()));


[19/31] incubator-tinkerpop git commit: Removed an "optimization" that caused TINKERPOP3-822

Posted by sp...@apache.org.
Removed an "optimization" that caused TINKERPOP3-822

When calling g.V(v).has(), the has() portion would get ignored.


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

Branch: refs/heads/master
Commit: 0c826bb15b13addba29af34165198a08023780bc
Parents: 19923ff
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Sep 1 08:10:11 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Sep 1 08:10:11 2015 -0400

----------------------------------------------------------------------
 .../traversal/step/filter/GroovyHasTest.groovy  |  5 +++++
 .../process/traversal/step/filter/HasTest.java  | 20 ++++++++++++++------
 .../step/sideEffect/Neo4jGraphStep.java         |  4 +---
 .../step/sideEffect/TinkerGraphStep.java        |  4 +---
 4 files changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0c826bb1/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
index 3d71644..73e6b79 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
@@ -70,6 +70,11 @@ public abstract class GroovyHasTest {
         }
 
         @Override
+        public Traversal<Vertex, Vertex> get_g_VXv1X_hasXage_gt_30X(final Object v1Id) {
+            TraversalScriptHelper.compute("g.V(g.V(v1Id).next()).has('age', gt(30))", g, "v1Id", v1Id);
+        }
+
+        @Override
         public Traversal<Vertex, Vertex> get_g_VX1X_out_hasIdX2X(final Object v1Id, final Object v2Id) {
             TraversalScriptHelper.compute(" g.V(v1Id).out.hasId(v2Id)", g, "v1Id", v1Id, "v2Id", v2Id);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0c826bb1/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
index f7aac61..29c00f7 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
@@ -63,6 +63,8 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Vertex> get_g_VX1X_hasXage_gt_30X(final Object v1Id);
 
+    public abstract Traversal<Vertex, Vertex> get_g_VXv1X_hasXage_gt_30X(final Object v1Id);
+
     public abstract Traversal<Vertex, Vertex> get_g_VX1X_out_hasXid_lt_3X(final Object v1Id, final Object v3Id);
 
     public abstract Traversal<Vertex, Vertex> get_g_VX1X_out_hasIdX2X(final Object v1Id, final Object v2Id);
@@ -155,12 +157,13 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void g_VX1X_hasXage_gt_30X() {
-        Traversal<Vertex, Vertex> traversal = get_g_VX1X_hasXage_gt_30X(convertToVertexId("marko"));
-        printTraversalForm(traversal);
-        assertFalse(traversal.hasNext());
-        traversal = get_g_VX1X_hasXage_gt_30X(convertToVertexId("josh"));
-        printTraversalForm(traversal);
-        assertTrue(traversal.hasNext());
+        Arrays.asList(get_g_VX1X_hasXage_gt_30X(convertToVertexId("marko")), get_g_VXv1X_hasXage_gt_30X(convertToVertexId("marko"))).forEach(traversal -> {
+            printTraversalForm(traversal);
+            assertFalse(traversal.hasNext());
+            traversal = get_g_VX1X_hasXage_gt_30X(convertToVertexId("josh"));
+            printTraversalForm(traversal);
+            assertTrue(traversal.hasNext());
+        });
     }
 
     @Test
@@ -386,6 +389,11 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
         }
 
         @Override
+        public Traversal<Vertex, Vertex> get_g_VXv1X_hasXage_gt_30X(final Object v1Id) {
+            return g.V(g.V(v1Id).next()).has("age", P.gt(30));
+        }
+
+        @Override
         public Traversal<Vertex, Vertex> get_g_VX1X_out_hasXid_lt_3X(final Object v1Id, final Object v3Id) {
             return g.V(v1Id).out().has(T.id, P.lt(v3Id));
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0c826bb1/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/process/traversal/step/sideEffect/Neo4jGraphStep.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/process/traversal/step/sideEffect/Neo4jGraphStep.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/process/traversal/step/sideEffect/Neo4jGraphStep.java
index b2bfbb6..488f0d2 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/process/traversal/step/sideEffect/Neo4jGraphStep.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/process/traversal/step/sideEffect/Neo4jGraphStep.java
@@ -46,9 +46,7 @@ public final class Neo4jGraphStep<S extends Element> extends GraphStep<S> implem
     public Neo4jGraphStep(final GraphStep<S> originalGraphStep) {
         super(originalGraphStep.getTraversal(), originalGraphStep.getReturnClass(), originalGraphStep.getIds());
         originalGraphStep.getLabels().forEach(this::addLabel);
-        //No need to do anything if the first element is an Element, all elements are guaranteed to be an element and will be return as is
-        if ((this.ids.length == 0 || !(this.ids[0] instanceof Element)))
-            this.setIteratorSupplier(() -> (Iterator<S>) (Vertex.class.isAssignableFrom(this.returnClass) ? this.vertices() : this.edges()));
+        this.setIteratorSupplier(() -> (Iterator<S>) (Vertex.class.isAssignableFrom(this.returnClass) ? this.vertices() : this.edges()));
     }
 
     private Iterator<? extends Edge> edges() {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0c826bb1/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
index 56bac20..052120c 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
@@ -48,9 +48,7 @@ public final class TinkerGraphStep<S extends Element> extends GraphStep<S> imple
     public TinkerGraphStep(final GraphStep<S> originalGraphStep) {
         super(originalGraphStep.getTraversal(), originalGraphStep.getReturnClass(), originalGraphStep.getIds());
         originalGraphStep.getLabels().forEach(this::addLabel);
-        //No need to do anything if the first element is an Element, all elements are guaranteed to be an element and will be return as is
-        if ((this.ids.length == 0 || !(this.ids[0] instanceof Element)))
-            this.setIteratorSupplier(() -> (Iterator<S>) (Vertex.class.isAssignableFrom(this.returnClass) ? this.vertices() : this.edges()));
+        this.setIteratorSupplier(() -> (Iterator<S>) (Vertex.class.isAssignableFrom(this.returnClass) ? this.vertices() : this.edges()));
     }
 
     private Iterator<? extends Edge> edges() {


[13/31] incubator-tinkerpop git commit: Renamed DefaultBulkLoader to IncrementalBulkLoader as requested by @okram.

Posted by sp...@apache.org.
Renamed DefaultBulkLoader to IncrementalBulkLoader as requested by @okram.


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

Branch: refs/heads/master
Commit: 9cc985da58ac17eda88f4347310f03d8a69883bc
Parents: 9f467c4
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Sun Aug 30 14:46:31 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Sun Aug 30 14:46:31 2015 +0200

----------------------------------------------------------------------
 .../computer/bulkloading/DefaultBulkLoader.java | 153 -------------------
 .../bulkloading/IncrementalBulkLoader.java      | 153 +++++++++++++++++++
 2 files changed, 153 insertions(+), 153 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9cc985da/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
deleted file mode 100644
index 75d3494..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-
-import java.util.Iterator;
-
-/**
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public class DefaultBulkLoader implements BulkLoader {
-
-    public final static String USER_SUPPLIED_IDS_CFG_KEY = "userSuppliedIds";
-    public final static String KEEP_ORIGINAL_IDS_CFG_KEY = "keepOriginalIds";
-
-    private String bulkLoaderVertexId = BulkLoaderVertexProgram.DEFAULT_BULK_LOADER_VERTEX_ID;
-    private boolean keepOriginalIds = true;
-    private boolean userSuppliedIds = false;
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
-        final Iterator<Vertex> iterator = useUserSuppliedIds()
-                ? graph.vertices(vertex.id())
-                : g.V().has(vertex.label(), getVertexIdProperty(), vertex.id());
-        return iterator.hasNext()
-                ? iterator.next()
-                : useUserSuppliedIds()
-                ? graph.addVertex(T.id, vertex.id(), T.label, vertex.label())
-                : graph.addVertex(T.label, vertex.label(), getVertexIdProperty(), vertex.id());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g) {
-        final Edge e;
-        final Traversal<Vertex, Edge> t = g.V(outVertex).outE(edge.label()).filter(__.inV().is(inVertex));
-        if (t.hasNext()) {
-            e = t.next();
-            edge.properties().forEachRemaining(property -> {
-                final Property<?> existing = e.property(property.key());
-                if (!existing.isPresent() || !existing.value().equals(property.value())) {
-                    e.property(property.key(), property.value());
-                }
-            });
-        } else {
-            e = outVertex.addEdge(edge.label(), inVertex);
-            edge.properties().forEachRemaining(property -> e.property(property.key(), property.value()));
-        }
-        return e;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
-        final VertexProperty<?> vp;
-        final VertexProperty<?> existing = vertex.property(property.key());
-        if (!existing.isPresent() || !existing.value().equals(property.value())) {
-            vp = vertex.property(property.key(), property.value());
-        } else {
-            vp = existing;
-        }
-        property.properties().forEachRemaining(metaProperty -> {
-            final Property<?> existing2 = vp.property(metaProperty.key());
-            if (!existing2.isPresent() || !existing2.value().equals(metaProperty.value())) {
-                vp.property(metaProperty.key(), metaProperty.value());
-            }
-        });
-        return vp;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Vertex getVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
-        return useUserSuppliedIds()
-                ? getVertexById(vertex.id(), graph, g)
-                : g.V().has(vertex.label(), bulkLoaderVertexId, vertex.id()).next();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean useUserSuppliedIds() {
-        return userSuppliedIds;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean keepOriginalIds() {
-        return keepOriginalIds;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getVertexIdProperty() {
-        return bulkLoaderVertexId;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void configure(final Configuration configuration) {
-        if (configuration.containsKey(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID_CFG_KEY)) {
-            bulkLoaderVertexId = configuration.getString(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID_CFG_KEY);
-        }
-        if (configuration.containsKey(USER_SUPPLIED_IDS_CFG_KEY)) {
-            userSuppliedIds = configuration.getBoolean(USER_SUPPLIED_IDS_CFG_KEY);
-        }
-        if (configuration.containsKey(KEEP_ORIGINAL_IDS_CFG_KEY)) {
-            keepOriginalIds = configuration.getBoolean(KEEP_ORIGINAL_IDS_CFG_KEY);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9cc985da/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
new file mode 100644
index 0000000..2177d0b
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+
+import java.util.Iterator;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+public class IncrementalBulkLoader implements BulkLoader {
+
+    public final static String USER_SUPPLIED_IDS_CFG_KEY = "userSuppliedIds";
+    public final static String KEEP_ORIGINAL_IDS_CFG_KEY = "keepOriginalIds";
+
+    private String bulkLoaderVertexId = BulkLoaderVertexProgram.DEFAULT_BULK_LOADER_VERTEX_ID;
+    private boolean keepOriginalIds = true;
+    private boolean userSuppliedIds = false;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+        final Iterator<Vertex> iterator = useUserSuppliedIds()
+                ? graph.vertices(vertex.id())
+                : g.V().has(vertex.label(), getVertexIdProperty(), vertex.id());
+        return iterator.hasNext()
+                ? iterator.next()
+                : useUserSuppliedIds()
+                ? graph.addVertex(T.id, vertex.id(), T.label, vertex.label())
+                : graph.addVertex(T.label, vertex.label(), getVertexIdProperty(), vertex.id());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g) {
+        final Edge e;
+        final Traversal<Vertex, Edge> t = g.V(outVertex).outE(edge.label()).filter(__.inV().is(inVertex));
+        if (t.hasNext()) {
+            e = t.next();
+            edge.properties().forEachRemaining(property -> {
+                final Property<?> existing = e.property(property.key());
+                if (!existing.isPresent() || !existing.value().equals(property.value())) {
+                    e.property(property.key(), property.value());
+                }
+            });
+        } else {
+            e = outVertex.addEdge(edge.label(), inVertex);
+            edge.properties().forEachRemaining(property -> e.property(property.key(), property.value()));
+        }
+        return e;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+        final VertexProperty<?> vp;
+        final VertexProperty<?> existing = vertex.property(property.key());
+        if (!existing.isPresent() || !existing.value().equals(property.value())) {
+            vp = vertex.property(property.key(), property.value());
+        } else {
+            vp = existing;
+        }
+        property.properties().forEachRemaining(metaProperty -> {
+            final Property<?> existing2 = vp.property(metaProperty.key());
+            if (!existing2.isPresent() || !existing2.value().equals(metaProperty.value())) {
+                vp.property(metaProperty.key(), metaProperty.value());
+            }
+        });
+        return vp;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Vertex getVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+        return useUserSuppliedIds()
+                ? getVertexById(vertex.id(), graph, g)
+                : g.V().has(vertex.label(), bulkLoaderVertexId, vertex.id()).next();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean useUserSuppliedIds() {
+        return userSuppliedIds;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean keepOriginalIds() {
+        return keepOriginalIds;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getVertexIdProperty() {
+        return bulkLoaderVertexId;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void configure(final Configuration configuration) {
+        if (configuration.containsKey(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID_CFG_KEY)) {
+            bulkLoaderVertexId = configuration.getString(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID_CFG_KEY);
+        }
+        if (configuration.containsKey(USER_SUPPLIED_IDS_CFG_KEY)) {
+            userSuppliedIds = configuration.getBoolean(USER_SUPPLIED_IDS_CFG_KEY);
+        }
+        if (configuration.containsKey(KEEP_ORIGINAL_IDS_CFG_KEY)) {
+            keepOriginalIds = configuration.getBoolean(KEEP_ORIGINAL_IDS_CFG_KEY);
+        }
+    }
+}


[23/31] incubator-tinkerpop git commit: Update release process a bit and cover release candidates.

Posted by sp...@apache.org.
Update release process a bit and cover release candidates.


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

Branch: refs/heads/master
Commit: 64a6436bb3948b50be97fee5b6ce36196aefba4a
Parents: 167e419
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 2 07:42:07 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 2 07:42:07 2015 -0400

----------------------------------------------------------------------
 RELEASE.asciidoc | 46 ++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/64a6436b/RELEASE.asciidoc
----------------------------------------------------------------------
diff --git a/RELEASE.asciidoc b/RELEASE.asciidoc
index c3d8d78..abd282e 100644
--- a/RELEASE.asciidoc
+++ b/RELEASE.asciidoc
@@ -17,7 +17,36 @@ limitations under the License.
 Release Process
 ---------------
 
-The following instructions represent the steps required to release TinkerPop:
+This document describes the steps required to release a version of TinkerPop.  The process is multi-phased and can therefore take several weeks to complete given the time needed for Apache voting and community feedback.  Once a release point has been identified, the following phases represent the flow of "release":
+
+* Optionally, produce a release candidate for community feedback.
+* Submit the official release for PMC vote.
+* Submit the official release for Incubator vote.
+* Release and promote.
+
+Release Candidate
+~~~~~~~~~~~~~~~~~
+
+A release candidate is an unofficial release that is represented by a tagged version in the Git repository.  It is offered in cases where there is significant change in a particular version and the potential for upgrades and problems might be high.
+
+. `mvn clean install -DincludeNeo4j`
+.. `mvn verify -DskipIntegrationTests=false -DincludeNeo4j`
+.. `mvn verify -DskipPerformanceTests=false`
+. `bin/publish-docs.sh <username>` - note that under a release candidate the documentation is published as SNAPSHOT
+. `bin/bump.sh "version"` to update the project files to reference a non-SNAPSHOT `rc` version (e.g. `x.y.z-incubating-rc1)
+. `git diff` and review the updated files (expect all `pom.xml` files and this README)
+. `git commit -a -m "TinkerPop x.y.z release"` and `git push`
+. `git tag -a -m "TinkerPop x.y.z release" x.y.z` and `git push --tags`
+. `mvn clean install -Dmaven.test.skip=true`
+. `bin/bump.sh "version"` to go back to SNAPSHOT
+. `git commit -a -m "Returned to x.y.z-SNAPSHOT"` and `git push`
+. Announce the release candidate to `dev` mailing list and await feedback
+. Repeat as required or proceed to the next phase
+
+PMC Vote
+~~~~~~~~
+
+A positive vote for a particular release from the TinkerPop PMC is required to move to the following phase.
 
 . `mvn clean install`
 .. `mvn verify -DskipIntegrationTests=false -DincludeNeo4j`
@@ -43,8 +72,21 @@ The following instructions represent the steps required to release TinkerPop:
 .. `cp ~/.m2/repository/org/apache/tinkerpop/tinkerpop/x.y.z/tinkerpop-x.y.z-source-release.zip* dev/x.y.z`
 .. `cd dev/x.y.z` and `for f in *.zip*; do  mv "$f" "apache-$f"; done`
 .. `cd ..; svn add x.y.z/; svn ci -m "TinkerPop x.y.z release"`
+. Submit for `[VOTE]` at `dev@tinkerpop.incubator.apache.org` (see email template below).
+. *Wait for vote acceptance* (72 hours).
+
+Incubator Vote
+~~~~~~~~~~~~~~
+
+A positive vote for a particular release from the Apache Incubator is required to move to the following phase.
+
 . Submit for `[VOTE]` at `general@incubator.apache.org` (see email template below).
+.. Include the vote tally: "Apache TinkerPop (http://tinkerpop.incubator.apache.org/) would like to release TinkerPop x.y.z. We had a dev@ VOTE which resulted in a tally of +1 (3), 0 (0), and -1 (0). We now present our artifacts for vote by Incubator."
 . *Wait for vote acceptance* (72 hours).
+
+Release & Promote
+~~~~~~~~~~~~~~~~~
+
 . `mvn clean install -Dmaven.test.skip=true; bin/process-docs.sh` - rebuild source and docs of tagged release
 . `mvn deploy -Papache-release -DcreateChecksum=true -Dmaven.test.skip=true`- deploy signed artifacts with checksums to Apache Nexus
 . Review and close the staging repository (Apache Nexus at link:https://repository.apache.org/[https://repository.apache.org/])
@@ -90,4 +132,4 @@ My vote is +1.
 
 Thank you very much,
 <TinkerPop Committer Name>
-```
+```
\ No newline at end of file


[08/31] incubator-tinkerpop git commit: tweaked configuration handling in BLVP

Posted by sp...@apache.org.
tweaked configuration handling in BLVP


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

Branch: refs/heads/master
Commit: cf088c49180dbf3804933278a913c944723ddc95
Parents: e3bfeec
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Wed Aug 26 18:25:59 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Wed Aug 26 18:25:59 2015 +0200

----------------------------------------------------------------------
 .../process/computer/bulkloading/BulkLoaderVertexProgram.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/cf088c49/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 5fa8c74..65f6697 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -57,6 +57,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     private static final String BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX = "bulkloader.conf";
     private static final String BULK_LOADER_CLASS = BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + ".class";
+    private static final String BULK_LOADER_GRAPH_CFG_PREFIX = BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + ".graph";
     private static final String BULK_LOADER_CFG_PREFIX = BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + ".loader";
 
     public static final String BULK_LOADER_VERTEX_ID = "bulkloader.vertex-id";
@@ -103,7 +104,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     @Override
     public void workerIterationStart(final Memory memory) {
         if (null == graph) {
-            graph = GraphFactory.open(configuration);
+            graph = GraphFactory.open(configuration.subset(BULK_LOADER_GRAPH_CFG_PREFIX));
             LOGGER.info("Opened Graph instance: {}", graph);
             try {
                 if (!graph.features().graph().supportsConcurrentAccess()) {
@@ -269,7 +270,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
             try {
                 final Properties properties = new Properties();
                 properties.load(new FileInputStream(propertiesFileLocation));
-                properties.forEach((key, value) -> configuration.setProperty(BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + "." + key, value));
+                properties.forEach((key, value) -> configuration.setProperty(BULK_LOADER_GRAPH_CFG_PREFIX + "." + key, value));
                 return this;
             } catch (final Exception e) {
                 throw new IllegalArgumentException(e.getMessage(), e);


[30/31] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/tp30'

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

Conflicts:
	gremlin-console/pom.xml
	gremlin-core/pom.xml
	gremlin-driver/pom.xml
	gremlin-groovy-test/pom.xml
	gremlin-groovy/pom.xml
	gremlin-server/pom.xml
	gremlin-shaded/pom.xml
	gremlin-test/pom.xml
	hadoop-gremlin/pom.xml
	neo4j-gremlin/pom.xml
	neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/process/traversal/step/sideEffect/Neo4jGraphStep.java
	pom.xml
	tinkergraph-gremlin/pom.xml
	tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java


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

Branch: refs/heads/master
Commit: 9fd5129369927d15d25860e7b992044b912609ba
Parents: 2253c67 5a38139
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 3 11:20:24 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Sep 3 11:20:24 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  35 +-
 RELEASE.asciidoc                                |  46 ++-
 gremlin-console/src/main/LICENSE                |  36 +-
 gremlin-console/src/main/NOTICE                 |  59 +--
 .../gremlin/process/computer/VertexProgram.java |   4 +
 .../computer/bulkloading/BulkLoader.java        | 115 ++++++
 .../bulkloading/BulkLoaderVertexProgram.java    | 407 +++++++++++++++++++
 .../bulkloading/IncrementalBulkLoader.java      | 150 +++++++
 .../util/AbstractVertexProgramBuilder.java      |   5 +-
 .../ComputerVerificationStrategy.java           |   7 +
 .../tinkerpop/gremlin/structure/Graph.java      |  13 +
 .../gremlin/structure/io/gryo/GryoMapper.java   |   3 +-
 .../structure/io/gryo/PairSerializer.java       |  42 ++
 .../traversal/step/filter/GroovyHasTest.groovy  |   5 +
 .../traversal/step/map/GroovyOrderTest.groovy   |   4 +-
 .../process/GroovyProcessComputerSuite.java     |  24 +-
 .../AbstractImportCustomizerProvider.java       |   2 +
 gremlin-server/src/main/LICENSE                 |  33 +-
 gremlin-server/src/main/NOTICE                  |  90 +---
 .../gremlin/process/ProcessComputerSuite.java   |   2 +
 .../BulkLoaderVertexProgramTest.java            |  82 ++++
 .../process/traversal/step/filter/HasTest.java  |  20 +-
 .../process/traversal/step/map/OrderTest.java   |  22 +-
 hadoop-gremlin/pom.xml                          |   6 +
 .../step/sideEffect/Neo4jGraphStep.java         |   4 +-
 .../gremlin/neo4j/structure/Neo4jGraph.java     |   5 +
 .../step/sideEffect/TinkerGraphStep.java        |   4 +-
 .../tinkergraph/structure/TinkerGraph.java      |   5 +
 28 files changed, 1042 insertions(+), 188 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9fd51293/CHANGELOG.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9fd51293/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9fd51293/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9fd51293/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
----------------------------------------------------------------------
diff --cc gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
index dfde060,47301e7..6382ced
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
@@@ -42,7 -43,26 +43,27 @@@ import org.apache.tinkerpop.gremlin.pro
  import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovySimplePathTest;
  import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyTailTest;
  import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyWhereTest;
- import org.apache.tinkerpop.gremlin.process.traversal.step.map.*;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyAddEdgeTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyCoalesceTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyConstantTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyCountTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyFoldTest;
++import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyLoopsTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapKeysTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapValuesTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMatchTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMaxTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMeanTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMinTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyOrderTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyPathTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyPropertiesTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovySelectTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovySumTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyUnfoldTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyValueMapTest;
+ import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyVertexTest;
  import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyAggregateTest;
  import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyGroupCountTest;
  import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyGroupTest;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9fd51293/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9fd51293/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9fd51293/hadoop-gremlin/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9fd51293/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9fd51293/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------


[21/31] incubator-tinkerpop git commit: added tinkergraph-gremlin dependency (scope: test) to hadoop-gremlin in order to be able to execute BLVP tests properly

Posted by sp...@apache.org.
added tinkergraph-gremlin dependency (scope: test) to hadoop-gremlin in order to be able to execute BLVP tests properly


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

Branch: refs/heads/master
Commit: 18adacd4ae37747bba4611e55c99fa0f988095e4
Parents: f0992f2
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Tue Sep 1 19:41:46 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Tue Sep 1 19:41:46 2015 +0200

----------------------------------------------------------------------
 .../computer/bulkloading/BulkLoaderVertexProgramTest.java      | 1 +
 hadoop-gremlin/pom.xml                                         | 6 ++++++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/18adacd4/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
index d3e42f7..9905da9 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
@@ -78,4 +78,5 @@ public class BulkLoaderVertexProgramTest extends AbstractGremlinProcessTest {
     }
 
     // TODO: once Neo4j supports concurrent connections, write a real integration test that leverages BLVP
+    // TODO: also, once Neo4j can be used, remove the tinkergraph-gremlin dependency from hadoop-gremlin and clean up the existing tests
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/18adacd4/hadoop-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/pom.xml b/hadoop-gremlin/pom.xml
index ff094c4..f0651d9 100644
--- a/hadoop-gremlin/pom.xml
+++ b/hadoop-gremlin/pom.xml
@@ -200,6 +200,12 @@ limitations under the License.
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.tinkerpop</groupId>
+            <artifactId>tinkergraph-gremlin</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <repositories>
         <repository>


[15/31] incubator-tinkerpop git commit: added a few unit tests for BulkLoaderVertexProgram and IncrementalBulkLoader

Posted by sp...@apache.org.
added a few unit tests for BulkLoaderVertexProgram and IncrementalBulkLoader


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

Branch: refs/heads/master
Commit: e5d519234a2cab1ed9e44591cfb391e435fee7a6
Parents: 9ec8c96
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Aug 31 02:31:18 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Mon Aug 31 02:31:18 2015 +0200

----------------------------------------------------------------------
 .../process/GroovyProcessComputerSuite.java     | 23 ++++-
 .../gremlin/process/ProcessComputerSuite.java   |  2 +
 .../BulkLoaderVertexProgramTest.java            | 90 ++++++++++++++++++++
 3 files changed, 114 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e5d51923/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
index 6a24469..47301e7 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.GraphManager;
 import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
 import org.apache.tinkerpop.gremlin.groovy.util.SugarTestHelper;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.computer.bulkloading.BulkLoaderVertexProgramTest;
 import org.apache.tinkerpop.gremlin.process.computer.ranking.PageRankVertexProgramTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyBranchTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyChooseTest;
@@ -42,7 +43,26 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovySampleTe
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovySimplePathTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyTailTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyWhereTest;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.*;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyAddEdgeTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyCoalesceTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyConstantTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyCountTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyFoldTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapKeysTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapValuesTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMatchTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMaxTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMeanTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMinTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyOrderTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyPathTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyPropertiesTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovySelectTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovySumTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyUnfoldTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyValueMapTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyVertexTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyAggregateTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyGroupCountTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyGroupTest;
@@ -138,6 +158,7 @@ public class GroovyProcessComputerSuite extends ProcessComputerSuite {
 
             // algorithms
             PageRankVertexProgramTest.class,
+            BulkLoaderVertexProgramTest.class,
     };
 
     public GroovyProcessComputerSuite(final Class<?> klass, final RunnerBuilder builder) throws InitializationError {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e5d51923/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
index a14fc25..83d017a 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.process;
 import org.apache.tinkerpop.gremlin.AbstractGremlinSuite;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputerTest;
+import org.apache.tinkerpop.gremlin.process.computer.bulkloading.BulkLoaderVertexProgramTest;
 import org.apache.tinkerpop.gremlin.process.computer.ranking.PageRankVertexProgramTest;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.BranchTest;
@@ -163,6 +164,7 @@ public class ProcessComputerSuite extends AbstractGremlinSuite {
 
             // algorithms
             PageRankVertexProgramTest.class,
+            BulkLoaderVertexProgramTest.class,
 
             // strategy
             ComputerVerificationStrategyProcessTest.ComputerTraversals.class,

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e5d51923/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
new file mode 100644
index 0000000..3584c00
--- /dev/null
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgramTest.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
+
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
+import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
+
+import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+public class BulkLoaderVertexProgramTest extends AbstractGremlinProcessTest {
+
+    private BulkLoader getBulkLoader(final Configuration configuration) throws Exception {
+        final VertexProgram.Builder builder = BulkLoaderVertexProgram.build();
+        if (configuration != null)
+            configuration.getKeys().forEachRemaining(key -> builder.configure(key, configuration.getProperty(key)));
+        BulkLoaderVertexProgram blvp = builder.create(graph);
+        final Field field = BulkLoaderVertexProgram.class.getDeclaredField("bulkLoader");
+        field.setAccessible(true);
+        return (BulkLoader) field.get(blvp);
+    }
+
+    private Graph getTargetGraph() {
+        final Configuration configuration = new BaseConfiguration();
+        configuration.setProperty(Graph.GRAPH, "org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph");
+        return GraphFactory.open(configuration);
+    }
+
+    @Test
+    public void shouldUseIncrementalBulkLoaderByDefault() throws Exception {
+        final BulkLoader loader = getBulkLoader(null);
+        assertTrue(loader instanceof IncrementalBulkLoader);
+        assertTrue(loader.keepOriginalIds());
+        assertFalse(loader.useUserSuppliedIds());
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void shouldStoreOriginalIds() throws Exception {
+        final Configuration configuration = new BaseConfiguration();
+        configuration.setProperty("loader.userSuppliedIds", false);
+        final BulkLoader loader = getBulkLoader(configuration);
+        assertFalse(loader.useUserSuppliedIds());
+        final Graph target = getTargetGraph();
+        graph.vertices().forEachRemaining(v -> loader.getOrCreateVertex(v, target, target.traversal()));
+        target.vertices().forEachRemaining(v -> assertTrue(v.property(loader.getVertexIdProperty()).isPresent()));
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void shouldNotStoreOriginalIds() throws Exception {
+        final Configuration configuration = new BaseConfiguration();
+        configuration.setProperty("loader.userSuppliedIds", true);
+        final BulkLoader loader = getBulkLoader(configuration);
+        assertTrue(loader.useUserSuppliedIds());
+        final Graph target = getTargetGraph();
+        graph.vertices().forEachRemaining(v -> loader.getOrCreateVertex(v, target, target.traversal()));
+        target.vertices().forEachRemaining(v -> assertFalse(v.property(loader.getVertexIdProperty()).isPresent()));
+    }
+
+    // TODO: once Neo4j supports concurrent connections, write a real integration test that leverages BLVP
+}
\ No newline at end of file


[09/31] incubator-tinkerpop git commit: cleaned up the BLVP configuration system and added a new configuration option to support intermediate commits (experimental)

Posted by sp...@apache.org.
cleaned up the BLVP configuration system and added a new configuration option to support intermediate commits (experimental)


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

Branch: refs/heads/master
Commit: abb9a73b6aa247ac6a2911563a27a3fef1da0d8a
Parents: cf088c4
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Aug 27 19:38:17 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Aug 27 19:38:17 2015 +0200

----------------------------------------------------------------------
 .../computer/bulkloading/BulkLoader.java        |   9 +-
 .../bulkloading/BulkLoaderVertexProgram.java    | 177 ++++++++++---------
 .../computer/bulkloading/DefaultBulkLoader.java |  24 ++-
 .../bulkloading/IncrementalBulkLoader.java      |   2 +-
 4 files changed, 121 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/abb9a73b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
index 268c0cc..5619971 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoader.java
@@ -74,7 +74,7 @@ public interface BulkLoader {
     public default Vertex getVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
         return useUserSuppliedIds()
                 ? getVertexById(vertex.id(), graph, g)
-                : g.V().has(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id()).next();
+                : g.V().has(getVertexIdProperty(), vertex.id()).next();
     }
 
     /**
@@ -102,6 +102,13 @@ public interface BulkLoader {
     }
 
     /**
+     * @return The name of the vertex property that is used to store the original vertex id.
+     */
+    public default String getVertexIdProperty() {
+        return BulkLoaderVertexProgram.DEFAULT_BULK_LOADER_VERTEX_ID;
+    }
+
+    /**
      * Configures the BulkLoader instance.
      *
      * @param configuration The BulkLoader configuration.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/abb9a73b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 65f6697..67d8da0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.process.computer.bulkloading;
 
 import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationUtils;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.computer.Memory;
 import org.apache.tinkerpop.gremlin.process.computer.MessageScope;
@@ -39,14 +40,13 @@ import org.javatuples.Tuple;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.FileInputStream;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * @author Daniel Kuppitz (http://gremlin.guru)
@@ -55,12 +55,12 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(BulkLoaderVertexProgram.class);
 
-    private static final String BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX = "bulkloader.conf";
-    private static final String BULK_LOADER_CLASS = BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + ".class";
-    private static final String BULK_LOADER_GRAPH_CFG_PREFIX = BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + ".graph";
-    private static final String BULK_LOADER_CFG_PREFIX = BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX + ".loader";
-
-    public static final String BULK_LOADER_VERTEX_ID = "bulkloader.vertex-id";
+    public static final String BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX = "gremlin.bulkLoading";
+    private static final String GRAPH_CFG_KEY = "graph";
+    private static final String BULK_LOADER_CFG_KEY = "loader";
+    private static final String INTERMEDIATE_BATCH_SIZE_CFG_KEY = "intermediateBatchSize";
+    public static final String BULK_LOADER_VERTEX_ID_CFG_KEY = "vertexIdProperty";
+    public static final String DEFAULT_BULK_LOADER_VERTEX_ID = "bulkLoader.vertex.id";
 
     private final MessageScope messageScope;
     private final Set<String> elementComputeKeys;
@@ -68,10 +68,67 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     private BulkLoader bulkLoader;
     private Graph graph;
     private GraphTraversalSource g;
+    private Long intermediateBatchSize;
+    private AtomicLong counter = new AtomicLong();
 
     private BulkLoaderVertexProgram() {
         messageScope = MessageScope.Local.of(__::inE);
-        elementComputeKeys = Collections.singleton(BULK_LOADER_VERTEX_ID);
+        elementComputeKeys = new HashSet<>();
+    }
+
+    private Configuration getGraphConfiguration() {
+        final Configuration config = configuration.subset(GRAPH_CFG_KEY);
+        config.setProperty(Graph.GRAPH, config.getString("class"));
+        config.clearProperty("class");
+        return config;
+    }
+
+    private BulkLoader createBulkLoader() {
+        final BulkLoader loader;
+        final Configuration config = configuration.subset(BULK_LOADER_CFG_KEY);
+        if (config.containsKey("class")) {
+            final String className = config.getString("class");
+            config.clearProperty("class");
+            try {
+                final Class<?> bulkLoaderClass = Class.forName(className);
+                loader = (BulkLoader) bulkLoaderClass.getConstructor().newInstance();
+            } catch (ClassNotFoundException e) {
+                LOGGER.error("Unable to find custom bulk loader class: {}", className);
+                throw new IllegalStateException(e);
+            } catch (Exception e) {
+                LOGGER.error("Unable to create an instance of the given bulk loader class: {}", className);
+                throw new IllegalStateException(e);
+            }
+        } else {
+            loader = new DefaultBulkLoader();
+        }
+        loader.configure(config);
+        return loader;
+    }
+
+    private void commit(final boolean force) {
+        if (!force && (intermediateBatchSize == 0L || counter.incrementAndGet() % intermediateBatchSize != 0)) return;
+        if (null != graph) {
+            if (graph.features().graph().supportsTransactions()) {
+                LOGGER.info("Committing transaction on Graph instance: {}", graph);
+                try {
+                    graph.tx().commit(); // TODO will Giraph/MR restart the program and re-run execute if this fails?
+                    LOGGER.debug("Committed transaction on Graph instance: {}", graph);
+                    counter.set(0L);
+                } catch (Exception e) {
+                    LOGGER.error("Failed to commit transaction on Graph instance: {}", graph);
+                    graph.tx().rollback();
+                    throw e;
+                }
+            }
+            try {
+                graph.close();
+                LOGGER.info("Closed Graph instance: {}", graph);
+                graph = null;
+            } catch (Exception e) {
+                LOGGER.warn("Failed to close Graph instance", e);
+            }
+        }
     }
 
     @Override
@@ -83,51 +140,42 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
     public void loadState(final Graph graph, final Configuration config) {
         configuration = new BaseConfiguration();
         if (config != null) {
-            final Iterator<String> keys = config.getKeys();
-            while (keys.hasNext()) {
-                final String key = keys.next();
-                configuration.setProperty(key, config.getProperty(key));
+            ConfigurationUtils.copy(config, configuration);
+        }
+        if (!configuration.subset(BULK_LOADER_CFG_KEY).containsKey(BULK_LOADER_VERTEX_ID_CFG_KEY)) {
+            configuration.addProperty(
+                    String.join(".", BULK_LOADER_CFG_KEY, BULK_LOADER_VERTEX_ID_CFG_KEY),
+                    DEFAULT_BULK_LOADER_VERTEX_ID);
+        }
+        intermediateBatchSize = configuration.getLong(INTERMEDIATE_BATCH_SIZE_CFG_KEY, 0L);
+        final String bulkLoaderVertexIdProperty = configuration.subset(BULK_LOADER_CFG_KEY)
+                .getString(BULK_LOADER_VERTEX_ID_CFG_KEY);
+        if (!elementComputeKeys.contains(bulkLoaderVertexIdProperty)) {
+            synchronized (elementComputeKeys) {
+                elementComputeKeys.add(bulkLoaderVertexIdProperty);
             }
         }
-        final Configuration blvpConfiguration = graph.configuration().subset(BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX);
-        blvpConfiguration.getKeys().forEachRemaining(key -> configuration.setProperty(key, blvpConfiguration.getProperty(key)));
     }
 
     @Override
     public void storeState(final Configuration config) {
         VertexProgram.super.storeState(config);
         if (configuration != null) {
-            configuration.getKeys().forEachRemaining(key -> config.setProperty(key, configuration.getProperty(key)));
+            ConfigurationUtils.copy(configuration, config);
         }
     }
 
     @Override
     public void workerIterationStart(final Memory memory) {
         if (null == graph) {
-            graph = GraphFactory.open(configuration.subset(BULK_LOADER_GRAPH_CFG_PREFIX));
+            graph = GraphFactory.open(getGraphConfiguration());
             LOGGER.info("Opened Graph instance: {}", graph);
             try {
                 if (!graph.features().graph().supportsConcurrentAccess()) {
                     throw new IllegalStateException("The given graph instance does not allow concurrent access.");
                 }
-                if (graph.features().graph().supportsTransactions()) {
-                    if (!graph.features().graph().supportsThreadedTransactions()) {
-                        throw new IllegalStateException("The given graph instance does not support threaded transactions.");
-                    }
-                }
                 g = graph.traversal();
-                final String bulkLoaderClassName = configuration.getString(BULK_LOADER_CLASS, DefaultBulkLoader.class.getCanonicalName());
-                try {
-                    final Class<?> bulkLoaderClass = Class.forName(bulkLoaderClassName);
-                    bulkLoader = (BulkLoader) bulkLoaderClass.getConstructor().newInstance();
-                } catch (ClassNotFoundException e) {
-                    LOGGER.error("Unable to find custom bulk loader class: {}", bulkLoaderClassName);
-                    throw new IllegalStateException(e);
-                } catch (Exception e) {
-                    LOGGER.error("Unable to create an instance of the given bulk loader class: {}", bulkLoaderClassName);
-                    throw new IllegalStateException(e);
-                }
-                bulkLoader.configure(configuration.subset(BULK_LOADER_CFG_PREFIX));
+                bulkLoader = createBulkLoader();
             } catch (Exception e) {
                 try {
                     graph.close();
@@ -143,26 +191,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     @Override
     public void workerIterationEnd(final Memory memory) {
-        if (null != graph) {
-            if (graph.features().graph().supportsTransactions()) {
-                LOGGER.info("Committing transaction on Graph instance: {}", graph);
-                try {
-                    graph.tx().commit(); // TODO will Giraph/MR restart the program and re-run execute if this fails?
-                    LOGGER.debug("Committed transaction on Graph instance: {}", graph);
-                } catch (Exception e) {
-                    LOGGER.error("Failed to commit transaction on Graph instance: {}", graph);
-                    graph.tx().rollback();
-                    throw e;
-                }
-            }
-            try {
-                graph.close();
-                LOGGER.info("Closed Graph instance: {}", graph);
-                graph = null;
-            } catch (Exception e) {
-                LOGGER.warn("Failed to close Graph instance", e);
-            }
-        }
+        this.commit(true);
     }
 
     @Override
@@ -186,10 +215,11 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
             while (vpi.hasNext()) {
                 bulkLoader.getOrCreateVertexProperty(vpi.next(), targetVertex, graph, g);
             }
+            this.commit(false);
             if (!bulkLoader.useUserSuppliedIds()) {
                 // create an id pair and send it to all the vertex's incoming adjacent vertices
-                sourceVertex.property(BULK_LOADER_VERTEX_ID, targetVertex.id());
-                messenger.sendMessage(this.messageScope, Pair.with(sourceVertex.id(), targetVertex.id()));
+                sourceVertex.property(bulkLoader.getVertexIdProperty(), targetVertex.id());
+                messenger.sendMessage(messageScope, Pair.with(sourceVertex.id(), targetVertex.id()));
             }
         } else {
             if (bulkLoader.useUserSuppliedIds()) {
@@ -207,13 +237,14 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
                     idPairs.put(idPair.getValue(0), idPair.getValue(1));
                 }
                 // get the vertex given the dummy id property
-                final Long outVId = sourceVertex.value(BULK_LOADER_VERTEX_ID);
+                final Long outVId = sourceVertex.value(bulkLoader.getVertexIdProperty());
                 final Vertex outV = bulkLoader.getVertexById(outVId, graph, g);
                 // for all the incoming edges of the vertex, get the incoming adjacent vertex and write the edge and its properties
                 sourceVertex.edges(Direction.OUT).forEachRemaining(edge -> {
                     final Object inVId = idPairs.get(edge.inVertex().id());
                     final Vertex inV = bulkLoader.getVertexById(inVId, graph, g);
                     bulkLoader.getOrCreateEdge(edge, outV, inV, graph, g);
+                    this.commit(false);
                 });
             }
         }
@@ -231,9 +262,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     @Override
     public Set<MessageScope> getMessageScopes(final Memory memory) {
-        return new HashSet<MessageScope>() {{
-            add(messageScope);
-        }};
+        return Collections.singleton(messageScope);
     }
 
     @Override
@@ -266,29 +295,11 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
             super(BulkLoaderVertexProgram.class);
         }
 
-        public Builder graphConfiguration(final String propertiesFileLocation) {
-            try {
-                final Properties properties = new Properties();
-                properties.load(new FileInputStream(propertiesFileLocation));
-                properties.forEach((key, value) -> configuration.setProperty(BULK_LOADER_GRAPH_CFG_PREFIX + "." + key, value));
-                return this;
-            } catch (final Exception e) {
-                throw new IllegalArgumentException(e.getMessage(), e);
-            }
-        }
-
-        public Builder bulkLoaderClass(final Class<? extends BulkLoader> bulkLoaderClass) {
-            return bulkLoaderClass(bulkLoaderClass, null);
-        }
-
-        public Builder bulkLoaderClass(final Class<? extends BulkLoader> bulkLoaderClass, final Configuration configuration) {
-            this.configuration.setProperty(BULK_LOADER_CLASS, bulkLoaderClass.getCanonicalName());
-            if (configuration != null) {
-                configuration.getKeys().forEachRemaining(key -> this.configuration.addProperty(
-                        BULK_LOADER_CFG_PREFIX + "." + key, configuration.getProperty(key)
-                ));
-            }
-            return this;
+        @SuppressWarnings("unchecked")
+        @Override
+        public BulkLoaderVertexProgram create(final Graph graph) {
+            ConfigurationUtils.append(graph.configuration().subset(BULK_LOADER_VERTEX_PROGRAM_CFG_PREFIX), configuration);
+            return (BulkLoaderVertexProgram) VertexProgram.createVertexProgram(graph, this.configuration);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/abb9a73b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
index 601079d..029d379 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/DefaultBulkLoader.java
@@ -31,9 +31,10 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
  */
 public class DefaultBulkLoader implements BulkLoader {
 
-    public final static String USE_USER_SUPPLIED_IDS_CFG_KEY = "use-user-supplied-ids";
-    public final static String STORE_ORIGINAL_IDS_CFG_KEY = "store-original-ids";
+    public final static String USER_SUPPLIED_IDS_CFG_KEY = "userSuppliedIds";
+    public final static String STORE_ORIGINAL_IDS_CFG_KEY = "storeOriginalIds";
 
+    private String bulkLoaderVertexId = BulkLoaderVertexProgram.DEFAULT_BULK_LOADER_VERTEX_ID;
     private boolean storeOriginalIds = false;
     private boolean useUserSuppliedIds = false;
 
@@ -47,7 +48,7 @@ public class DefaultBulkLoader implements BulkLoader {
         }
         final Vertex v = graph.addVertex(T.label, vertex.label());
         if (storeOriginalIds()) {
-            v.property(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id());
+            v.property(bulkLoaderVertexId, vertex.id());
         }
         return v;
     }
@@ -79,7 +80,7 @@ public class DefaultBulkLoader implements BulkLoader {
     public Vertex getVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
         return useUserSuppliedIds()
                 ? getVertexById(vertex.id(), graph, g)
-                : g.V().has(vertex.label(), BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id()).next();
+                : g.V().has(vertex.label(), bulkLoaderVertexId, vertex.id()).next();
     }
 
     /**
@@ -102,9 +103,20 @@ public class DefaultBulkLoader implements BulkLoader {
      * {@inheritDoc}
      */
     @Override
+    public String getVertexIdProperty() {
+        return bulkLoaderVertexId;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void configure(final Configuration configuration) {
-        if (configuration.containsKey(USE_USER_SUPPLIED_IDS_CFG_KEY)) {
-            useUserSuppliedIds = configuration.getBoolean(USE_USER_SUPPLIED_IDS_CFG_KEY);
+        if (configuration.containsKey(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID_CFG_KEY)) {
+            bulkLoaderVertexId = configuration.getString(BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID_CFG_KEY);
+        }
+        if (configuration.containsKey(USER_SUPPLIED_IDS_CFG_KEY)) {
+            useUserSuppliedIds = configuration.getBoolean(USER_SUPPLIED_IDS_CFG_KEY);
         }
         if (configuration.containsKey(STORE_ORIGINAL_IDS_CFG_KEY)) {
             storeOriginalIds = configuration.getBoolean(STORE_ORIGINAL_IDS_CFG_KEY);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/abb9a73b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
index d87df73..c4e0737 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/IncrementalBulkLoader.java
@@ -44,7 +44,7 @@ public class IncrementalBulkLoader extends DefaultBulkLoader {
     public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
         final Iterator<Vertex> iterator = useUserSuppliedIds()
                 ? graph.vertices(vertex.id())
-                : g.V().has(vertex.label(), BulkLoaderVertexProgram.BULK_LOADER_VERTEX_ID, vertex.id());
+                : g.V().has(vertex.label(), getVertexIdProperty(), vertex.id());
         return iterator.hasNext() ? iterator.next() : super.getOrCreateVertex(vertex, graph, g);
     }
 


[24/31] incubator-tinkerpop git commit: Update changelog with JIRA tickets for 3.0.1.

Posted by sp...@apache.org.
Update changelog with JIRA tickets for 3.0.1.


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

Branch: refs/heads/master
Commit: 8e71d2ec9f663a11cfb2870f632bdcdcf15674cb
Parents: 64a6436
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 2 07:52:45 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 2 07:52:45 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8e71d2ec/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e7da592..11bd6df 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -22,8 +22,8 @@ TinkerPop 3.0.0 (A Gremlin Rāga in 7/16 Time)
 
 image::http://www.tinkerpop.com/docs/current/images/gremlin-hindu.png[width=225]
 
-TinkerPop 3.0.1 (NOT OFFICIALLY RELEASED YET)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+TinkerPop 3.0.1 (Release Date: September 2, 2015)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 * Added `BulkLoaderVertexProgram` and a default bulk loader implementation: `IncrementalBulkLoader`
 * `Compare` now uses `BigDecimal` internally to ensure that precision is not lost on standard number comparisons.
@@ -52,6 +52,37 @@ TinkerPop 3.0.1 (NOT OFFICIALLY RELEASED YET)
 * Removed `SecurityCustomizerProvider` class and the "sandbox" configuration on the `ScriptEngines` class - this was an experimental feature and not meant for public use.
 * Removed dependency on `groovy-sandbox` from the `gremlin-groovy` module.
 
+Bugs
+^^^^
+
+* [TINKERPOP3-770] - Exception while AddPropertyStep tries to detach vertex property
+* [TINKERPOP3-780] - Use of fold() in repeat()
+* [TINKERPOP3-782] - map(Traversal) should declare requirements of child
+* [TINKERPOP3-785] - Gremlin Server Not Properly Reporting Port Conflict
+* [TINKERPOP3-792] - select at start of match traversal on Map can fail
+* [TINKERPOP3-794] - IncidentToAdjecentStrategy malfunction
+* [TINKERPOP3-804] - Failed installing neo4j-gremlin extension on Windows 7
+* [TINKERPOP3-822] - Neo4j GraphStep with element arguments ignores has  *(breaking)*
+
+Improvements
+^^^^^^^^^^^^
+
+* [TINKERPOP3-319] - BulkLoaderVertexProgram for generalized batch loading across graphs
+* [TINKERPOP3-576] - Gremlin Server Authentication
+* [TINKERPOP3-582] - Remove Groovy Sandbox Dependency
+* [TINKERPOP3-610] - General graph concept names in test schema
+* [TINKERPOP3-656] - IoRegistry Chaining
+* [TINKERPOP3-690] - Be able to OPT_OUT for Standard, but not Computer *(breaking)*
+* [TINKERPOP3-699] - GraphSON writeGraph not producing valid json object
+* [TINKERPOP3-750] - Compare should not have special case for Number
+* [TINKERPOP3-752] - Make Gremlin Server Better Respect ACCEPT
+* [TINKERPOP3-764] - Unify semantics of Transaction.close() in tests and documentation *(breaking)*
+* [TINKERPOP3-771] - IoRegistry Instantiation With GryoPool
+* [TINKERPOP3-778] - Support GraphFactory location via annotation.
+* [TINKERPOP3-791] - Document rules for committers
+* [TINKERPOP3-797] - order() seems to only like List? *(breaking)*
+* [TINKERPOP3-808] - TraversalComparator.comparator needs a getter
+
 TinkerPop 3.0.0 (Release Date: July 9, 2015)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 


[18/31] incubator-tinkerpop git commit: extended BulkLoaderVertexProgram's toString() output; included all configuration properties except the writeGraph

Posted by sp...@apache.org.
extended BulkLoaderVertexProgram's toString() output; included all configuration properties except the writeGraph


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

Branch: refs/heads/master
Commit: f9ac298a9de569dcbff5e76f2c8de5f40081314b
Parents: 9546e44
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Tue Sep 1 02:58:47 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Tue Sep 1 02:58:47 2015 +0200

----------------------------------------------------------------------
 .../computer/bulkloading/BulkLoaderVertexProgram.java   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f9ac298a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 962edd0..d5eb835 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -295,7 +295,17 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     @Override
     public String toString() {
-        return StringFactory.vertexProgramString(this, bulkLoader != null ? bulkLoader.getClass().getSimpleName() : null);
+        final StringBuilder sb = new StringBuilder();
+        if (bulkLoader != null) {
+            sb.append("bulkLoader=").append(bulkLoader.getClass().getSimpleName()).append(",");
+            sb.append("vertexIdProperty=").append(bulkLoader.getVertexIdProperty()).append(",");
+            sb.append("userSuppliedIds=").append(bulkLoader.useUserSuppliedIds()).append(",");
+            sb.append("keepOriginalIds=").append(bulkLoader.keepOriginalIds()).append(",");
+        } else {
+            sb.append("bulkLoader=").append(bulkLoader).append(",");
+        }
+        sb.append("batchSize=").append(intermediateBatchSize);
+        return StringFactory.vertexProgramString(this, sb.toString());
     }
 
     public static Builder build() {


[06/31] incubator-tinkerpop git commit: close Graph instance in case the initialization failed

Posted by sp...@apache.org.
close Graph instance in case the initialization failed


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

Branch: refs/heads/master
Commit: 8b7f2b97cd9e3d64d444dea5846dc98cf62e4c36
Parents: 08b57f8
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Aug 24 18:09:41 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Mon Aug 24 18:09:41 2015 +0200

----------------------------------------------------------------------
 .../bulkloading/BulkLoaderVertexProgram.java    | 45 ++++++++++++--------
 1 file changed, 27 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8b7f2b97/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 8ff404b..2aa86f2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -105,27 +105,36 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
         if (null == graph) {
             graph = GraphFactory.open(configuration);
             LOGGER.info("Opened Graph instance: {}", graph);
-            if (!graph.features().graph().supportsConcurrentAccess()) {
-                throw new IllegalStateException("The given graph instance does not allow concurrent access.");
-            }
-            if (graph.features().graph().supportsTransactions()) {
-                if (!graph.features().graph().supportsThreadedTransactions()) {
-                    throw new IllegalStateException("The given graph instance does not support threaded transactions.");
-                }
-            }
-            g = graph.traversal();
-            final String bulkLoaderClassName = configuration.getString(BULK_LOADER_CLASS, DefaultBulkLoader.class.getCanonicalName());
             try {
-                final Class<?> bulkLoaderClass = Class.forName(bulkLoaderClassName);
-                bulkLoader = (BulkLoader) bulkLoaderClass.getConstructor().newInstance();
-            } catch (ClassNotFoundException e) {
-                LOGGER.error("Unable to find custom bulk loader class: {}", bulkLoaderClassName);
-                throw new IllegalStateException(e);
+                if (!graph.features().graph().supportsConcurrentAccess()) {
+                    throw new IllegalStateException("The given graph instance does not allow concurrent access.");
+                }
+                if (graph.features().graph().supportsTransactions()) {
+                    if (!graph.features().graph().supportsThreadedTransactions()) {
+                        throw new IllegalStateException("The given graph instance does not support threaded transactions.");
+                    }
+                }
+                g = graph.traversal();
+                final String bulkLoaderClassName = configuration.getString(BULK_LOADER_CLASS, DefaultBulkLoader.class.getCanonicalName());
+                try {
+                    final Class<?> bulkLoaderClass = Class.forName(bulkLoaderClassName);
+                    bulkLoader = (BulkLoader) bulkLoaderClass.getConstructor().newInstance();
+                } catch (ClassNotFoundException e) {
+                    LOGGER.error("Unable to find custom bulk loader class: {}", bulkLoaderClassName);
+                    throw new IllegalStateException(e);
+                } catch (Exception e) {
+                    LOGGER.error("Unable to create an instance of the given bulk loader class: {}", bulkLoaderClassName);
+                    throw new IllegalStateException(e);
+                }
+                bulkLoader.configure(configuration.subset(BULK_LOADER_CFG_PREFIX));
             } catch (Exception e) {
-                LOGGER.error("Unable to create an instance of the given bulk loader class: {}", bulkLoaderClassName);
-                throw new IllegalStateException(e);
+                try {
+                    graph.close();
+                } catch (Exception e2) {
+                    LOGGER.warn("Failed to close Graph instance", e2);
+                }
+                throw e;
             }
-            bulkLoader.configure(configuration.subset(BULK_LOADER_CFG_PREFIX));
         } else {
             LOGGER.warn("Leaked Graph instance: {}", graph);
         }


[07/31] incubator-tinkerpop git commit: rollback transactions in case of an error

Posted by sp...@apache.org.
rollback transactions in case of an error


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

Branch: refs/heads/master
Commit: e3bfeec66c96ef76fde26f6ad422c89cc299a184
Parents: 8b7f2b9
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Aug 24 20:52:00 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Mon Aug 24 20:52:00 2015 +0200

----------------------------------------------------------------------
 .../bulkloading/BulkLoaderVertexProgram.java    | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e3bfeec6/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 2aa86f2..5fa8c74 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -145,8 +145,14 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
         if (null != graph) {
             if (graph.features().graph().supportsTransactions()) {
                 LOGGER.info("Committing transaction on Graph instance: {}", graph);
-                graph.tx().commit(); // TODO will Giraph/MR restart the program and re-run execute if this fails?
-                LOGGER.debug("Committed transaction on Graph instance: {}", graph);
+                try {
+                    graph.tx().commit(); // TODO will Giraph/MR restart the program and re-run execute if this fails?
+                    LOGGER.debug("Committed transaction on Graph instance: {}", graph);
+                } catch (Exception e) {
+                    LOGGER.error("Failed to commit transaction on Graph instance: {}", graph);
+                    graph.tx().rollback();
+                    throw e;
+                }
             }
             try {
                 graph.close();
@@ -160,6 +166,17 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
 
     @Override
     public void execute(final Vertex sourceVertex, final Messenger<Tuple> messenger, final Memory memory) {
+        try {
+            executeInternal(sourceVertex, messenger, memory);
+        } catch (Exception e) {
+            if (graph.features().graph().supportsTransactions()) {
+                graph.tx().rollback();
+            }
+            throw e;
+        }
+    }
+
+    private void executeInternal(final Vertex sourceVertex, final Messenger<Tuple> messenger, final Memory memory) {
         if (memory.isInitialIteration()) {
             // get or create the vertex
             final Vertex targetVertex = bulkLoader.getOrCreateVertex(sourceVertex, graph, g);


[31/31] incubator-tinkerpop git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-tinkerpop

Posted by sp...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-tinkerpop


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

Branch: refs/heads/master
Commit: 016694dde00b93648f166b1526fb2e03dea9efe7
Parents: 9fd5129 bb78a64
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 3 11:21:57 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Sep 3 11:21:57 2015 -0400

----------------------------------------------------------------------
 .../traversal/VertexTraversalSideEffects.java   | 12 +++-
 .../process/traversal/SackFunctions.java        | 49 +++++++++++++
 .../gremlin/process/traversal/Traversal.java    |  2 +-
 .../process/traversal/TraversalSideEffects.java | 28 ++++++--
 .../dsl/graph/GraphTraversalSource.java         | 64 +++++++++++++----
 .../process/traversal/step/map/AddEdgeStep.java |  6 +-
 .../step/sideEffect/AddPropertyStep.java        |  9 +--
 .../step/util/CollectingBarrierStep.java        |  2 +-
 .../step/util/LambdaCollectingBarrierStep.java  | 19 ++----
 .../process/traversal/step/util/Parameters.java | 67 ++++++++++++------
 .../traverser/B_LP_O_P_S_SE_SL_Traverser.java   |  4 +-
 .../traverser/B_LP_O_S_SE_SL_Traverser.java     |  6 +-
 .../traverser/B_O_S_SE_SL_Traverser.java        | 21 ++++--
 .../util/DefaultTraversalSideEffects.java       | 20 ++++--
 .../util/EmptyTraversalSideEffects.java         | 20 ++++--
 .../step/sideEffect/AddPropertyStepTest.java    |  4 +-
 .../PartitionStrategyTraverseTest.java          |  8 +--
 .../step/map/GroovyAddVertexTest.groovy         | 10 +++
 .../step/sideEffect/GroovySackTest.groovy       |  6 ++
 .../gremlin/groovy/loaders/StepLoader.groovy    | 23 ++++---
 .../AbstractImportCustomizerProvider.java       |  4 +-
 .../groovy/function/GBinaryOperator.java        | 55 +++++++++++++++
 .../traversal/step/map/AddVertexTest.java       | 72 +++++++++++++++++++-
 .../traversal/step/sideEffect/SackTest.java     | 17 +++++
 .../tinkergraph/structure/TinkerGraphTest.java  |  4 +-
 25 files changed, 420 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/016694dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
----------------------------------------------------------------------


[04/31] incubator-tinkerpop git commit: made BulkLoaderVertexProgram package available in Console sessions

Posted by sp...@apache.org.
made BulkLoaderVertexProgram package available in Console sessions


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

Branch: refs/heads/master
Commit: 1464db913a971c54125744776b17c291c3e4905b
Parents: 7c50e73
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Aug 24 16:51:00 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Mon Aug 24 16:51:00 2015 +0200

----------------------------------------------------------------------
 .../tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1464db91/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
index f50395c..50c4980 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
@@ -24,6 +24,7 @@ import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.groovy.function.GFunction;
 import org.apache.tinkerpop.gremlin.groovy.loaders.GremlinLoader;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.computer.bulkloading.BulkLoaderVertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.PeerPressureVertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
@@ -126,6 +127,7 @@ public abstract class AbstractImportCustomizerProvider implements ImportCustomiz
         imports.add(PeerPressureVertexProgram.class.getPackage().getName() + DOT_STAR);
         imports.add(PageRankVertexProgram.class.getPackage().getName() + DOT_STAR);
         imports.add(TraversalVertexProgram.class.getPackage().getName() + DOT_STAR);
+        imports.add(BulkLoaderVertexProgram.class.getPackage().getName() + DOT_STAR);
 
         // groovy extras
         imports.add(Grape.class.getCanonicalName());


[20/31] incubator-tinkerpop git commit: Merge branch 'blvp' into tp30

Posted by sp...@apache.org.
Merge branch 'blvp' into tp30

Resolved Conflicts:
	CHANGELOG.asciidoc


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

Branch: refs/heads/master
Commit: f0992f2257ec356eac3135197f1bb3ed81db8da1
Parents: 0c826bb f9ac298
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Tue Sep 1 16:25:10 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Tue Sep 1 16:25:10 2015 +0200

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   4 +-
 .../gremlin/process/computer/VertexProgram.java |   4 +
 .../computer/bulkloading/BulkLoader.java        | 115 ++++++
 .../bulkloading/BulkLoaderVertexProgram.java    | 407 +++++++++++++++++++
 .../bulkloading/IncrementalBulkLoader.java      | 150 +++++++
 .../util/AbstractVertexProgramBuilder.java      |   5 +-
 .../tinkerpop/gremlin/structure/Graph.java      |  13 +
 .../gremlin/structure/io/gryo/GryoMapper.java   |  19 +-
 .../structure/io/gryo/PairSerializer.java       |  42 ++
 .../process/GroovyProcessComputerSuite.java     |  23 +-
 .../AbstractImportCustomizerProvider.java       |   2 +
 .../gremlin/process/ProcessComputerSuite.java   |   2 +
 .../BulkLoaderVertexProgramTest.java            |  81 ++++
 .../gremlin/neo4j/structure/Neo4jGraph.java     |   5 +
 .../tinkergraph/structure/TinkerGraph.java      |   5 +
 15 files changed, 865 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f0992f22/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index d20c2fc,234d431..e7da592
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -25,9 -25,7 +25,11 @@@ image::http://www.tinkerpop.com/docs/cu
  TinkerPop 3.0.1 (NOT OFFICIALLY RELEASED YET)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
++* Added `BulkLoaderVertexProgram` and a default bulk loader implementation: `IncrementalBulkLoader`
 +* `Compare` now uses `BigDecimal` internally to ensure that precision is not lost on standard number comparisons.
 +* Renamed `ComputerVerificationStrategy` to `VerificationStrategy` so all the verification strategies can use it.
 +* Added `StandardVerificationStrategy` that throws exceptions for illegal traversal patterns on the standard engine (which extends to `GraphComputer`).
+ * Added `GraphFeatures.supportsConcurrentAccess()` to allows `Graph` implementations to signify if multiple instances can access the same data.
  * Clarified semantics of `Transaction.close()` in unit tests - now refers only to closing the current transaction in the current thread.
  * `Neo4jGraph` no longer uses `OptOut` on `TransactionTest.shouldRollbackOnCloseWhenConfigured` (formerly `shouldRollbackOnShutdownWhenConfigured`)
  * Gremlin Server initialization scripts can now return a `Map` of values that will become global bindings for the server.
@@@ -722,4 -720,4 +724,4 @@@ TinkerPop 3.0.0.M2 (Release Date: Septe
  TinkerPop 3.0.0.M1 (Release Date: August 12, 2014)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
--* First official release of TinkerPop3 and thus, no changes.
++* First official release of TinkerPop3 and thus, no changes.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f0992f22/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------