You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2015/12/18 19:04:10 UTC
[1/8] incubator-tinkerpop git commit: store the toString() version of
vertex IDs and use it for lookups
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 529512f6e -> 4f4384bca
store the toString() version of vertex IDs and use it for lookups
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/8cc12c0b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/8cc12c0b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/8cc12c0b
Branch: refs/heads/master
Commit: 8cc12c0bdd9ac96eb0e4e4f7642c81e8055dad8c
Parents: e32a418
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Tue Dec 15 22:36:42 2015 +0100
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Tue Dec 15 22:36:42 2015 +0100
----------------------------------------------------------------------
.../gremlin/process/computer/bulkloading/BulkLoader.java | 2 +-
.../process/computer/bulkloading/BulkLoaderVertexProgram.java | 2 +-
.../process/computer/bulkloading/IncrementalBulkLoader.java | 4 +---
.../tinkerpop/gremlin/process/GroovyProcessComputerSuite.java | 4 ++--
4 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8cc12c0b/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 2640d2e..dffe11e 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
@@ -117,7 +117,7 @@ public interface BulkLoader {
* @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 g.V().hasId(id).next();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8cc12c0b/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 02e6054..2f3a0d0 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
@@ -217,7 +217,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
this.commit(false);
if (!bulkLoader.useUserSuppliedIds()) {
// create an id pair and send it to all the vertex's incoming adjacent vertices
- sourceVertex.property(bulkLoader.getVertexIdProperty(), targetVertex.id());
+ sourceVertex.property(bulkLoader.getVertexIdProperty(), targetVertex.id().toString());
messenger.sendMessage(messageScope, Pair.with(sourceVertex.id(), targetVertex.id()));
}
} else if (memory.getIteration() == 1) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8cc12c0b/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 8219515..187f72e 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
@@ -46,15 +46,13 @@ public class IncrementalBulkLoader implements BulkLoader {
@Override
public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
final Iterator<Vertex> iterator = useUserSuppliedIds()
- ? graph.vertices(vertex.id())
+ ? g.V().hasId(vertex.id())
: g.V().has(vertex.label(), getVertexIdProperty(), vertex.id());
return iterator.hasNext()
? iterator.next()
: useUserSuppliedIds()
? g.addV(vertex.label()).property(T.id, vertex.id()).next()
: g.addV(vertex.label()).property(getVertexIdProperty(), vertex.id()).next();
- //? graph.addVertex(T.id, vertex.id(), T.label, vertex.label())
- //: graph.addVertex(T.label, vertex.label(), getVertexIdProperty(), vertex.id());
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8cc12c0b/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 7187062..6264fbc 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
@@ -104,7 +104,7 @@ public class GroovyProcessComputerSuite extends ProcessComputerSuite {
* as needed to enforce tests upon implementations.
*/
private static final Class<?>[] allTests = new Class<?>[]{
-
+/*
//branch
GroovyBranchTest.Traversals.class,
GroovyChooseTest.Traversals.class,
@@ -170,7 +170,7 @@ public class GroovyProcessComputerSuite extends ProcessComputerSuite {
// algorithms
PageRankVertexProgramTest.class,
- PeerPressureVertexProgramTest.class,
+ PeerPressureVertexProgramTest.class,*/
BulkLoaderVertexProgramTest.class,
};
[8/8] incubator-tinkerpop git commit: Merge branch 'TINKERPOP-1026'
Posted by dk...@apache.org.
Merge branch 'TINKERPOP-1026'
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/4f4384bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/4f4384bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/4f4384bc
Branch: refs/heads/master
Commit: 4f4384bca5100089b56ffd82e624b8615dc8acc2
Parents: 529512f be30e2d
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Fri Dec 18 19:02:27 2015 +0100
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Fri Dec 18 19:02:27 2015 +0100
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
docs/src/reference/the-graphcomputer.asciidoc | 11 +-
.../computer/bulkloading/BulkLoader.java | 8 +-
.../bulkloading/BulkLoaderVertexProgram.java | 10 +-
.../bulkloading/IncrementalBulkLoader.java | 8 +-
.../computer/bulkloading/OneTimeBulkLoader.java | 109 +++++++++++++++++++
.../process/GroovyProcessComputerSuite.java | 1 -
.../BulkLoaderVertexProgramTest.java | 49 ++++++++-
8 files changed, 173 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4f4384bc/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index f90c92d,abac39c..4e6d849
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -26,7 -26,7 +26,8 @@@ image::https://raw.githubusercontent.co
TinkerPop 3.1.1 (NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Fixed a bug in `Graph.OptOut` when trying to opt-out of certain test cases with the `method` property set to "*".
+ * Added another `BulkLoader` implementation (`OneTimeBulkLoader`) that doesn't store temporary properties in the target graph.
* Fixed a `SparkGraphComputer` sorting bug in MapReduce that occurred when there was more than one partition.
* Added `strictTransactionManagement` to the Gremlin Server settings to indicate that the `aliases` parameter must be passed on requests and that transaction management will be scoped to the graphs provided in that argument.
* Fixed a `NullPointerException` bug in `PeerPressureVertexProgram` that occurred when an adjacency traversal was not provided.
[2/8] incubator-tinkerpop git commit: Added another `BulkLoader`
implementation (`OneTimeBulkLoader`) to verify that `id.toString()` vertex
lookups still work properly if no temporary property is written to the target
graph.
Posted by dk...@apache.org.
Added another `BulkLoader` implementation (`OneTimeBulkLoader`) to verify that `id.toString()` vertex lookups still work properly if no temporary property is written to the target graph.
This will not affect the default behavior of `BLVP`, since `IncrementalBulkLoader` will still be used by default, but it allowed to add some more test cases.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/d3ff7533
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/d3ff7533
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/d3ff7533
Branch: refs/heads/master
Commit: d3ff7533e05d210c5f6bc6ba76d0d2b4944dbde1
Parents: 8cc12c0
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Wed Dec 16 18:56:28 2015 +0100
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Wed Dec 16 18:56:28 2015 +0100
----------------------------------------------------------------------
.../computer/bulkloading/BulkLoader.java | 6 +-
.../bulkloading/BulkLoaderVertexProgram.java | 10 +-
.../bulkloading/IncrementalBulkLoader.java | 4 +-
.../computer/bulkloading/OneTimeBulkLoader.java | 108 +++++++++++++++++++
.../process/GroovyProcessComputerSuite.java | 5 +-
.../BulkLoaderVertexProgramTest.java | 49 ++++++++-
6 files changed, 165 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d3ff7533/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 dffe11e..fe1fb77 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
@@ -102,11 +102,7 @@ public interface BulkLoader {
* @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(getVertexIdProperty(), vertex.id()).next();
- }
+ public Vertex getVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g);
/**
* Gets a vertex by its ID from the given graph.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d3ff7533/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 2f3a0d0..3a10582 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
@@ -152,7 +152,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
ConfigurationUtils.copy(config, configuration);
}
intermediateBatchSize = configuration.getLong(INTERMEDIATE_BATCH_SIZE_CFG_KEY, 0L);
- elementComputeKeys.add(configuration.getString(BULK_LOADER_VERTEX_ID_CFG_KEY, DEFAULT_BULK_LOADER_VERTEX_ID));
+ elementComputeKeys.add(DEFAULT_BULK_LOADER_VERTEX_ID);
bulkLoader = createBulkLoader();
}
@@ -217,7 +217,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
this.commit(false);
if (!bulkLoader.useUserSuppliedIds()) {
// create an id pair and send it to all the vertex's incoming adjacent vertices
- sourceVertex.property(bulkLoader.getVertexIdProperty(), targetVertex.id().toString());
+ sourceVertex.property(DEFAULT_BULK_LOADER_VERTEX_ID, targetVertex.id());
messenger.sendMessage(messageScope, Pair.with(sourceVertex.id(), targetVertex.id()));
}
} else if (memory.getIteration() == 1) {
@@ -242,7 +242,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
idPairs.put(idPair.getValue(0), idPair.getValue(1));
}
// get the vertex with given the dummy id property
- final Object outVId = sourceVertex.value(bulkLoader.getVertexIdProperty());
+ final Object outVId = sourceVertex.value(DEFAULT_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 -> {
@@ -253,7 +253,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
});
}
} else if (memory.getIteration() == 2) {
- final Object vertexId = sourceVertex.value(bulkLoader.getVertexIdProperty());
+ final Object vertexId = sourceVertex.value(DEFAULT_BULK_LOADER_VERTEX_ID);
bulkLoader.getVertexById(vertexId, graph, g)
.property(bulkLoader.getVertexIdProperty()).remove();
this.commit(false);
@@ -264,7 +264,7 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
public boolean terminate(final Memory memory) {
switch (memory.getIteration()) {
case 1:
- return bulkLoader.keepOriginalIds();
+ return bulkLoader.keepOriginalIds() || bulkLoader.getVertexIdProperty() == null;
case 2:
return true;
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d3ff7533/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 187f72e..990334f 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
@@ -47,12 +47,12 @@ public class IncrementalBulkLoader implements BulkLoader {
public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
final Iterator<Vertex> iterator = useUserSuppliedIds()
? g.V().hasId(vertex.id())
- : g.V().has(vertex.label(), getVertexIdProperty(), vertex.id());
+ : g.V().has(vertex.label(), getVertexIdProperty(), vertex.id().toString());
return iterator.hasNext()
? iterator.next()
: useUserSuppliedIds()
? g.addV(vertex.label()).property(T.id, vertex.id()).next()
- : g.addV(vertex.label()).property(getVertexIdProperty(), vertex.id()).next();
+ : g.addV(vertex.label()).property(getVertexIdProperty(), vertex.id().toString()).next();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d3ff7533/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/OneTimeBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/OneTimeBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/OneTimeBulkLoader.java
new file mode 100644
index 0000000..eb0bf1a
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/OneTimeBulkLoader.java
@@ -0,0 +1,108 @@
+/*
+ * 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.GraphTraversal;
+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 OneTimeBulkLoader implements BulkLoader {
+
+ private boolean userSuppliedIds = false;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+ final GraphTraversal<Vertex, Vertex> t = g.addV(vertex.label());
+ return (useUserSuppliedIds() ? t.property(T.id, vertex.id()) : t).next();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g) {
+ return createEdge(edge, outVertex, inVertex, graph, g);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+ return createVertexProperty(property, vertex, graph, g);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Vertex getVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
+ return getVertexById(vertex.id(), graph, g);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean useUserSuppliedIds() {
+ return userSuppliedIds;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean keepOriginalIds() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getVertexIdProperty() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void configure(final Configuration configuration) {
+ if (configuration.containsKey(BulkLoaderVertexProgram.USER_SUPPLIED_IDS_CFG_KEY)) {
+ userSuppliedIds = configuration.getBoolean(BulkLoaderVertexProgram.USER_SUPPLIED_IDS_CFG_KEY);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d3ff7533/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 6264fbc..56b6b34 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
@@ -24,7 +24,6 @@ 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.clustering.peerpressure.PeerPressureVertexProgram;
import org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.PeerPressureVertexProgramTest;
import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgramTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyBranchTest;
@@ -104,7 +103,7 @@ public class GroovyProcessComputerSuite extends ProcessComputerSuite {
* as needed to enforce tests upon implementations.
*/
private static final Class<?>[] allTests = new Class<?>[]{
-/*
+
//branch
GroovyBranchTest.Traversals.class,
GroovyChooseTest.Traversals.class,
@@ -170,7 +169,7 @@ public class GroovyProcessComputerSuite extends ProcessComputerSuite {
// algorithms
PageRankVertexProgramTest.class,
- PeerPressureVertexProgramTest.class,*/
+ PeerPressureVertexProgramTest.class,
BulkLoaderVertexProgramTest.class,
};
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d3ff7533/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 aad15d4..a4d4d3a 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
@@ -40,6 +40,7 @@ import org.junit.Test;
import java.io.File;
import java.lang.reflect.Field;
import java.util.Iterator;
+import java.util.concurrent.ExecutionException;
import java.util.function.Function;
import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
@@ -134,12 +135,56 @@ public class BulkLoaderVertexProgramTest extends AbstractGremlinProcessTest {
assertGraphEquality(graph, getWriteGraph());
}
+ @Test
+ @LoadGraphWith(MODERN)
+ public void shouldUseOneTimeBulkLoader() throws Exception {
+ for (int iteration = 1; iteration <= 2; iteration++) {
+ final BulkLoaderVertexProgram blvp = BulkLoaderVertexProgram.build()
+ .bulkLoader(OneTimeBulkLoader.class)
+ .writeGraph(getWriteGraphConfiguration()).create(graph);
+ final BulkLoader loader = getBulkLoader(blvp);
+ assertTrue(loader instanceof OneTimeBulkLoader);
+ graph.compute(graphComputerClass.get()).workers(1).program(blvp).submit().get();
+ final Graph result = getWriteGraph();
+ assertEquals(6 * iteration, IteratorUtils.count(result.vertices()));
+ assertEquals(6 * iteration, IteratorUtils.count(result.edges()));
+ result.close();
+ }
+ }
+
+ @Test
+ @LoadGraphWith(MODERN)
+ public void shouldUseOneTimeBulkLoaderWithUserSuppliedIds() throws Exception {
+ for (int iteration = 1; iteration <= 2; iteration++) {
+ final BulkLoaderVertexProgram blvp = BulkLoaderVertexProgram.build()
+ .bulkLoader(OneTimeBulkLoader.class)
+ .userSuppliedIds(true)
+ .writeGraph(getWriteGraphConfiguration()).create(graph);
+ final BulkLoader loader = getBulkLoader(blvp);
+ assertTrue(loader instanceof OneTimeBulkLoader);
+ try {
+ graph.compute(graphComputerClass.get()).workers(1).program(blvp).submit().get();
+ assertEquals(1, iteration);
+ final Graph result = getWriteGraph();
+ assertEquals(6, IteratorUtils.count(result.vertices()));
+ assertEquals(6, IteratorUtils.count(result.edges()));
+ result.close();
+ } catch (ExecutionException e) {
+ assertEquals(2, iteration);
+ Throwable cause = e.getCause();
+ while (cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ assertTrue(cause.getMessage().startsWith("Vertex with id already exists"));
+ }
+ }
+ }
+
private static void assertGraphEquality(final Graph source, final Graph target) {
assertGraphEquality(source, target, Element::id);
}
private static void assertGraphEquality(final Graph source, final Graph target, final Function<Vertex, Object> idAccessor) {
- final GraphTraversalSource sg = source.traversal();
final GraphTraversalSource tg = target.traversal();
assertEquals(IteratorUtils.count(source.vertices()), IteratorUtils.count(target.vertices()));
assertEquals(IteratorUtils.count(target.edges()), IteratorUtils.count(target.edges()));
@@ -148,7 +193,7 @@ public class BulkLoaderVertexProgramTest extends AbstractGremlinProcessTest {
final Iterator<Vertex> vertexIterator = target.vertices();
while (vertexIterator.hasNext()) {
final Vertex v = vertexIterator.next();
- if (idAccessor.apply(v).equals(originalVertex.id())) {
+ if (idAccessor.apply(v).toString().equals(originalVertex.id().toString())) {
tmpVertex = v;
break;
}
[4/8] incubator-tinkerpop git commit: Added JavaDoc for
`OneTimeBulkLoader` and explained its behavior in the reference docs.
Posted by dk...@apache.org.
Added JavaDoc for `OneTimeBulkLoader` and explained its behavior in the reference docs.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/7b042c31
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/7b042c31
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/7b042c31
Branch: refs/heads/master
Commit: 7b042c317df6ed8e0e7acf4f295304f019968f1e
Parents: 2715336
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Dec 17 21:32:48 2015 +0100
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Dec 17 21:32:48 2015 +0100
----------------------------------------------------------------------
docs/src/reference/the-graphcomputer.asciidoc | 9 +++++----
.../computer/bulkloading/OneTimeBulkLoader.java | 21 ++++++++++----------
2 files changed, 16 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7b042c31/docs/src/reference/the-graphcomputer.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graphcomputer.asciidoc b/docs/src/reference/the-graphcomputer.asciidoc
index a1a6c74..2ebf2e9 100644
--- a/docs/src/reference/the-graphcomputer.asciidoc
+++ b/docs/src/reference/the-graphcomputer.asciidoc
@@ -364,10 +364,11 @@ It's recommended to tune this property for the target graph and not use the defa
|`writeGraph(String)` | Sets the path to a `GraphFactory` compatible configuration file for the target graph. | _none_
|========================================
-NOTE: `BulkLoaderVertexProgram` comes with a default `BulkLoader` implementation, namely `IncrementalBulkLoader`. It
-will work for the most use-cases, but has one limitation though: It doesn't support multi-valued properties.
-`IncrementalBulkLoader` will handle every property as a single-valued property. A custom `BulkLoader` implementation
-has to be used if the default behavior is not sufficient.
+NOTE: `BulkLoaderVertexProgram` uses the `IncrementalBulkLoader` by default. The other option is the `OneTimeBulkLoader`,
+which doesn't store any temporary IDs in the `writeGraph` and thus should only be used for initial bulk loads. Both
+implementations should cover the mahority of use-cases, but have a limitation though: They don't support multi-valued
+properties. `OneTimeBulkLoader` and `IncrementalBulkLoader` will handle every property as a single-valued property. A
+custom `BulkLoader` implementation has to be used if the default behavior is not sufficient.
NOTE: A custom `BulkLoader` implementation for incremental loading should use `GraphTraversal` methods to create/update
elements (e.g. `g.addV()` instead of `graph.addVertex()`). This way the `BulkLoaderVertexProgram` is able to efficiently
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7b042c31/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/OneTimeBulkLoader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/OneTimeBulkLoader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/OneTimeBulkLoader.java
index eb0bf1a..cf0528c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/OneTimeBulkLoader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/OneTimeBulkLoader.java
@@ -19,20 +19,21 @@
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.GraphTraversal;
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;
-
/**
+ * {@link org.apache.tinkerpop.gremlin.process.computer.bulkloading.OneTimeBulkLoader} is a
+ * {@link org.apache.tinkerpop.gremlin.process.computer.bulkloading.BulkLoader} implementation that should be used
+ * for initial bulk loads. In contrast to {@link org.apache.tinkerpop.gremlin.process.computer.bulkloading.IncrementalBulkLoader}
+ * it doesn't store temporary identifiers in the write graph nor does it attempt to find existing elements, instead it
+ * only clones each element from the source graph.
+ *
* @author Daniel Kuppitz (http://gremlin.guru)
*/
public class OneTimeBulkLoader implements BulkLoader {
@@ -40,7 +41,7 @@ public class OneTimeBulkLoader implements BulkLoader {
private boolean userSuppliedIds = false;
/**
- * {@inheritDoc}
+ * Creates a clone of the given vertex in the given graph.
*/
@Override
public Vertex getOrCreateVertex(final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
@@ -49,7 +50,7 @@ public class OneTimeBulkLoader implements BulkLoader {
}
/**
- * {@inheritDoc}
+ * Creates a clone of the given edge between the given in- and out-vertices.
*/
@Override
public Edge getOrCreateEdge(final Edge edge, final Vertex outVertex, final Vertex inVertex, final Graph graph, final GraphTraversalSource g) {
@@ -57,7 +58,7 @@ public class OneTimeBulkLoader implements BulkLoader {
}
/**
- * {@inheritDoc}
+ * Creates a clone of the given property for the given vertex.
*/
@Override
public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
@@ -81,7 +82,7 @@ public class OneTimeBulkLoader implements BulkLoader {
}
/**
- * {@inheritDoc}
+ * Always returns false.
*/
@Override
public boolean keepOriginalIds() {
@@ -89,7 +90,7 @@ public class OneTimeBulkLoader implements BulkLoader {
}
/**
- * {@inheritDoc}
+ * Always returns null.
*/
@Override
public String getVertexIdProperty() {
[7/8] incubator-tinkerpop git commit: fixed typo
Posted by dk...@apache.org.
fixed typo
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/be30e2db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/be30e2db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/be30e2db
Branch: refs/heads/master
Commit: be30e2db324c81c4aedcce8e0c848caa84610601
Parents: 2523090
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Fri Dec 18 12:41:53 2015 +0100
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Fri Dec 18 12:41:53 2015 +0100
----------------------------------------------------------------------
docs/src/reference/the-graphcomputer.asciidoc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/be30e2db/docs/src/reference/the-graphcomputer.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graphcomputer.asciidoc b/docs/src/reference/the-graphcomputer.asciidoc
index 924215d..d2a429a 100644
--- a/docs/src/reference/the-graphcomputer.asciidoc
+++ b/docs/src/reference/the-graphcomputer.asciidoc
@@ -366,7 +366,7 @@ It's recommended to tune this property for the target graph and not use the defa
NOTE: `BulkLoaderVertexProgram` uses the `IncrementalBulkLoader` by default. The other option is the `OneTimeBulkLoader`,
which doesn't store any temporary IDs in the `writeGraph` and thus should only be used for initial bulk loads. Both
-implementations should cover the mahority of use-cases, but have a limitation though: They don't support multi-valued
+implementations should cover the majority of use-cases, but have a limitation though: They don't support multi-valued
properties. `OneTimeBulkLoader` and `IncrementalBulkLoader` will handle every property as a single-valued property. A
custom `BulkLoader` implementation has to be used if the default behavior is not sufficient.
[3/8] incubator-tinkerpop git commit: updated CHANGELOG
Posted by dk...@apache.org.
updated 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/27153366
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/27153366
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/27153366
Branch: refs/heads/master
Commit: 2715336642cdb79a12c25e935402954f771dac89
Parents: d3ff753
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Wed Dec 16 19:14:48 2015 +0100
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Wed Dec 16 19:14:48 2015 +0100
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/27153366/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 4de69c1..abac39c 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
TinkerPop 3.1.1 (NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Added another `BulkLoader` implementation (`OneTimeBulkLoader`) that doesn't store temporary properties in the target graph.
* Fixed a `SparkGraphComputer` sorting bug in MapReduce that occurred when there was more than one partition.
* Added `strictTransactionManagement` to the Gremlin Server settings to indicate that the `aliases` parameter must be passed on requests and that transaction management will be scoped to the graphs provided in that argument.
* Fixed a `NullPointerException` bug in `PeerPressureVertexProgram` that occurred when an adjacency traversal was not provided.
[5/8] incubator-tinkerpop git commit: updated one BLVP sample to use
OneTimeBulkLoder
Posted by dk...@apache.org.
updated one BLVP sample to use OneTimeBulkLoder
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/2e443039
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/2e443039
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/2e443039
Branch: refs/heads/master
Commit: 2e443039ab29f3ce343f6bcdb41ffe40b77fe7c5
Parents: 7b042c3
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Dec 17 23:19:10 2015 +0100
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Dec 17 23:19:10 2015 +0100
----------------------------------------------------------------------
docs/src/reference/the-graphcomputer.asciidoc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2e443039/docs/src/reference/the-graphcomputer.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graphcomputer.asciidoc b/docs/src/reference/the-graphcomputer.asciidoc
index 2ebf2e9..924215d 100644
--- a/docs/src/reference/the-graphcomputer.asciidoc
+++ b/docs/src/reference/the-graphcomputer.asciidoc
@@ -338,7 +338,7 @@ writeGraphConf.setProperty("gremlin.tinkergraph.graphFormat", "gryo")
writeGraphConf.setProperty("gremlin.tinkergraph.graphLocation", "/tmp/tinkergraph.kryo")
modern = TinkerFactory.createModern()
blvp = BulkLoaderVertexProgram.build().
- keepOriginalIds(false).
+ bulkLoader(OneTimeBulkLoader).
writeGraph(writeGraphConf).create(modern)
modern.compute().workers(1).program(blvp).submit().get()
graph = GraphFactory.open(writeGraphConf)
[6/8] incubator-tinkerpop git commit: empty commit to retrigger
Travis build
Posted by dk...@apache.org.
empty commit to retrigger Travis build
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/25230906
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/25230906
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/25230906
Branch: refs/heads/master
Commit: 2523090657094e914dc41b6c4759d62a5d4d0fa5
Parents: 2e44303
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Fri Dec 18 02:08:20 2015 +0100
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Fri Dec 18 02:08:20 2015 +0100
----------------------------------------------------------------------
----------------------------------------------------------------------