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 2018/07/12 15:00:29 UTC
[25/26] tinkerpop git commit: TINKERPOP-1996 Added with() options for
io()
TINKERPOP-1996 Added with() options for io()
Included GraphReader and GraphWriter detection and added tests
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/28c7fad2
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/28c7fad2
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/28c7fad2
Branch: refs/heads/TINKERPOP-1996
Commit: 28c7fad2ccf2af8e21644723b85bd4fdd41a587d
Parents: 1fd43c6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jul 11 15:40:39 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:59:39 2018 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/process/traversal/IO.java | 54 ++++++
.../process/traversal/step/map/IoStep.java | 132 ++++++++++++--
.../traversal/dsl/graph/GraphTraversalTest.java | 5 +-
.../decoration/VertexProgramStrategyTest.java | 7 +-
.../Process/Traversal/GraphTraversal.cs | 18 ++
.../Process/Traversal/GraphTraversalSource.cs | 17 +-
.../groovy/jsr223/GroovyTranslatorProvider.java | 6 +
.../lib/process/graph-traversal.js | 36 ++--
.../gremlin_python/process/graph_traversal.py | 17 +-
.../gremlin/process/ProcessStandardSuite.java | 2 +
.../process/traversal/step/map/ReadTest.java | 114 ++++++++++--
.../process/traversal/step/map/WriteTest.java | 175 +++++++++++++++++++
.../ElementIdStrategyProcessTest.java | 1 -
.../gremlin/hadoop/structure/HadoopGraph.java | 10 ++
.../structure/TinkerGraphPlayTest.java | 12 +-
...ctTinkerGraphGraphSONTranslatorProvider.java | 5 +
.../gryo/TinkerGraphGryoTranslatorProvider.java | 7 +-
17 files changed, 542 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/IO.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/IO.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/IO.java
new file mode 100644
index 0000000..f76c2bc
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/IO.java
@@ -0,0 +1,54 @@
+/*
+ * 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.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.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+
+/**
+ * Fields that can be provided to the {@link GraphTraversalSource#io(String)} using the
+ * {@link GraphTraversal#with(String,Object)} step modulator to provide additional configurations.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class IO {
+
+ private IO() {}
+
+ public static final String graphson = "graphson";
+ public static final String gryo = "gryo";
+ public static final String graphml = "graphml";
+
+ /**
+ * The specific {@link GraphReader} instance to use or the name of the fully qualified classname of such an
+ * instance. If this value is not specified then {@link GraphTraversalSource#io(String)} will attempt to construct
+ * a default {@link GraphReader} based on the file extension provided to it.
+ */
+ public static final String reader = Graph.Hidden.hide("tinkerpop.io.reader");
+
+ /**
+ * The specific {@link GraphWriter} instance to use or the name of the fully qualified classname of such an
+ * instance. If this value is not specified then {@link GraphTraversalSource#io(String)} will attempt to construct
+ * a default {@link GraphWriter} based on the file extension provided to it.
+ */
+ public static final String writer = Graph.Hidden.hide("tinkerpop.io.writer");
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
index b633360..668b3dc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
@@ -18,6 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+import org.apache.tinkerpop.gremlin.process.traversal.IO;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.step.ReadWriting;
@@ -26,6 +27,12 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser;
import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
@@ -36,6 +43,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.lang.reflect.Method;
/**
* Handles read and write operations into the {@link Graph}.
@@ -43,6 +51,13 @@ import java.io.OutputStream;
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class IoStep<S> extends AbstractStep<S,S> implements ReadWriting {
+
+ private enum Format {
+ GRYO,
+ GRAPHSON,
+ GRAPHML
+ }
+
private Parameters parameters = new Parameters();
private boolean first = true;
private String file;
@@ -92,29 +107,118 @@ public class IoStep<S> extends AbstractStep<S,S> implements ReadWriting {
if (mode == Mode.READING) {
if (!file.exists()) throw new IllegalStateException(this.file + " does not exist");
+ return read(file);
+ } else if (mode == Mode.WRITING) {
+ return write(file);
+ } else {
+ throw new IllegalStateException("Invalid ReadWriting.Mode configured in IoStep: " + mode.name());
+ }
+ }
+
+ private Traverser.Admin<S> write(final File file) {
+ try (final OutputStream stream = new FileOutputStream(file)) {
+ final Graph graph = (Graph) this.traversal.getGraph().get();
+ constructWriter().writeGraph(stream, graph);
+
+ return EmptyTraverser.instance();
+ } catch (IOException ioe) {
+ throw new IllegalStateException(String.format("Could not write file %s from graph", this.file), ioe);
+ }
+ }
- try (final InputStream stream = new FileInputStream(file)) {
- final Graph graph = (Graph) this.traversal.getGraph().get();
- GryoReader.build().create().readGraph(stream, graph);
+ private Traverser.Admin<S> read(final File file) {
+ try (final InputStream stream = new FileInputStream(file)) {
+ final Graph graph = (Graph) this.traversal.getGraph().get();
+ constructReader().readGraph(stream, graph);
- return EmptyTraverser.instance();
- } catch (IOException ioe) {
- throw new IllegalStateException(String.format("Could not read file %s into graph", this.file), ioe);
+ return EmptyTraverser.instance();
+ } catch (IOException ioe) {
+ throw new IllegalStateException(String.format("Could not read file %s into graph", this.file), ioe);
+ }
+ }
+
+ /**
+ * Builds a {@link GraphReader} instance to use. Attempts to detect the file format to be read using the file
+ * extension or simply uses configurations provided by the user on the parameters given to the step.
+ */
+ private GraphReader constructReader() {
+ final Object objectOrClass = parameters.get(IO.reader, this::detectReader).get(0);
+ if (objectOrClass instanceof GraphReader)
+ return (GraphReader) objectOrClass;
+ else if (objectOrClass instanceof String) {
+ if (objectOrClass.equals(IO.graphson))
+ return GraphSONReader.build().create();
+ else if (objectOrClass.equals(IO.gryo))
+ return GryoReader.build().create();
+ else if (objectOrClass.equals(IO.graphml))
+ return GraphMLReader.build().create();
+ else {
+ try {
+ final Class<?> graphReaderClazz = Class.forName((String) objectOrClass);
+ final Method build = graphReaderClazz.getMethod("build");
+ final GraphReader.ReaderBuilder builder = (GraphReader.ReaderBuilder) build.invoke(null);
+ return builder.create();
+ } catch (Exception ex) {
+ throw new IllegalStateException(String.format("Could not construct the specified GraphReader of %s", objectOrClass), ex);
+ }
}
- } else if (mode == Mode.WRITING) {
- try (final OutputStream stream = new FileOutputStream(file)) {
- final Graph graph = (Graph) this.traversal.getGraph().get();
- GryoWriter.build().create().writeGraph(stream, graph);
+ } else {
+ throw new IllegalStateException("GraphReader could not be determined");
+ }
+ }
+
+ private GraphReader detectReader() {
+ if (file.endsWith(".kryo"))
+ return GryoReader.build().create();
+ else if (file.endsWith(".json"))
+ return GraphSONReader.build().create();
+ else if (file.endsWith(".xml"))
+ return GraphMLReader.build().create();
+ else
+ throw new IllegalStateException("Could not detect the file format - specify the reader explicitly or rename file with a standard extension");
+ }
- return EmptyTraverser.instance();
- } catch (IOException ioe) {
- throw new IllegalStateException(String.format("Could not write file %s from graph", this.file), ioe);
+ /**
+ * Builds a {@link GraphWriter} instance to use. Attempts to detect the file format to be write using the file
+ * extension or simply uses configurations provided by the user on the parameters given to the step.
+ */
+ private GraphWriter constructWriter() {
+ final Object objectOrClass = parameters.get(IO.writer, this::detectWriter).get(0);
+ if (objectOrClass instanceof GraphWriter)
+ return (GraphWriter) objectOrClass;
+ else if (objectOrClass instanceof String) {
+ if (objectOrClass.equals(IO.graphson))
+ return GraphSONWriter.build().create();
+ else if (objectOrClass.equals(IO.gryo))
+ return GryoWriter.build().create();
+ else if (objectOrClass.equals(IO.graphml))
+ return GraphMLWriter.build().create();
+ else {
+ try {
+ final Class<?> graphWriterClazz = Class.forName((String) objectOrClass);
+ final Method build = graphWriterClazz.getMethod("build");
+ final GraphWriter.WriterBuilder builder = (GraphWriter.WriterBuilder) build.invoke(null);
+ return builder.create();
+ } catch (Exception ex) {
+ throw new IllegalStateException(String.format("Could not construct the specified GraphReader of %s", objectOrClass), ex);
+ }
}
} else {
- throw new IllegalStateException("Invalid ReadWriting.Mode configured in IoStep: " + mode.name());
+ throw new IllegalStateException("GraphReader could not be determined");
}
}
+ private GraphWriter detectWriter() {
+ if (file.endsWith(".kryo"))
+ return GryoWriter.build().create();
+ else if (file.endsWith(".json"))
+ return GraphSONWriter.build().create();
+ else if (file.endsWith(".xml"))
+ return GraphMLWriter.build().create();
+ else
+ throw new IllegalStateException("Could not detect the file format - specify the writer explicitly or rename file with a standard extension");
+ }
+
@Override
public int hashCode() {
final int hash = super.hashCode() ^ this.parameters.hashCode();
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
index 9009d0b..3d9a549 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
@@ -38,13 +38,14 @@ import static org.junit.Assert.assertEquals;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class GraphTraversalTest {
private static final Logger logger = LoggerFactory.getLogger(GraphTraversalTest.class);
- private static Set<String> NO_GRAPH = new HashSet<>(Arrays.asList("asAdmin", "by", "with", "option", "iterate", "to", "from", "profile", "pageRank", "peerPressure", "program", "none"));
+ private static Set<String> NO_GRAPH = new HashSet<>(Arrays.asList("asAdmin", "by", "read", "write", "with", "option", "iterate", "to", "from", "profile", "pageRank", "peerPressure", "program", "none"));
private static Set<String> NO_ANONYMOUS = new HashSet<>(Arrays.asList("start", "__"));
- private static Set<String> IGNORES_BYTECODE = new HashSet<>(Arrays.asList("asAdmin", "iterate", "mapValues", "mapKeys"));
+ private static Set<String> IGNORES_BYTECODE = new HashSet<>(Arrays.asList("asAdmin", "read", "write", "iterate", "mapValues", "mapKeys"));
@Test
public void shouldHaveMethodsOfGraphTraversalOnAnonymousGraphTraversal() {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
index 972db9a..d3bb6ef 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
@@ -43,6 +43,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
*/
@RunWith(Parameterized.class)
public class VertexProgramStrategyTest {
@@ -68,9 +69,11 @@ public class VertexProgramStrategyTest {
final ComputerResultStep computerResultStep = new ComputerResultStep(EmptyTraversal.instance());
+ // The tests for io() need to verify that there is no change i.e. we don't want the step getting wrapped up in
+ // traversalvertexprogramstep stuff or else it won't execute properly in OLAP
return Arrays.asList(new Traversal[][]{
- { EmptyGraph.instance().traversal().io("blah.json").read(), EmptyGraph.instance().traversal().io("blah.json").read()},
- { EmptyGraph.instance().traversal().io("blah.json").write(), EmptyGraph.instance().traversal().io("blah.json").write()},
+ { EmptyGraph.instance().traversal().io("blah.json"), EmptyGraph.instance().traversal().io("blah.json")},
+ { EmptyGraph.instance().traversal().io("blah.json"), EmptyGraph.instance().traversal().io("blah.json")},
{__.V().out().count(), start().addStep(traversal(__.V().out().count())).addStep(computerResultStep)},
{__.V().pageRank().out().count(), start().pageRank().asAdmin().addStep(traversal(__.V().out().count())).addStep(computerResultStep)},
{__.V().out().pageRank(), start().addStep(traversal(__.V().out())).pageRank().asAdmin().addStep(traversal(__.identity())).addStep(computerResultStep)},
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index 537cdbe..2c1a906 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -1247,6 +1247,15 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
+ /// Adds the read step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
+ public GraphTraversal<S, E> Read ()
+ {
+ Bytecode.AddStep("read");
+ return Wrap<S, E>(this);
+ }
+
+ /// <summary>
/// Adds the repeat step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
public GraphTraversal<S, E> Repeat (ITraversal repeatTraversal)
@@ -1685,5 +1694,14 @@ namespace Gremlin.Net.Process.Traversal
return Wrap<S, E>(this);
}
+ /// <summary>
+ /// Adds the write step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
+ public GraphTraversal<S, E> Write ()
+ {
+ Bytecode.AddStep("write");
+ return Wrap<S, E>(this);
+ }
+
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
index 4292850..00a3623 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
@@ -334,24 +334,13 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the read step to that
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the io step to that
/// traversal.
/// </summary>
- public GraphTraversal<S, S> Read<S>(string file)
+ public GraphTraversal<S, S> Io<S>(string file)
{
var traversal = new GraphTraversal<S, S>(TraversalStrategies, new Bytecode(Bytecode));
- traversal.Bytecode.AddStep("read", file);
- return traversal;
- }
-
- /// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the write step to that
- /// traversal.
- /// </summary>
- public GraphTraversal<S, S> Write<S>(string file)
- {
- var traversal = new GraphTraversal<S, S>(TraversalStrategies, new Bytecode(Bytecode));
- traversal.Bytecode.AddStep("write", file);
+ traversal.Bytecode.AddStep("io", file);
return traversal;
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorProvider.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorProvider.java
index c56e7069..d83b1f7 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorProvider.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorProvider.java
@@ -24,6 +24,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionCompu
import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionTest;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProgramTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteTest;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
@@ -43,6 +45,10 @@ public class GroovyTranslatorProvider extends TinkerGraphProvider {
private static Set<String> SKIP_TESTS = new HashSet<>(Arrays.asList(
"testProfileStrategyCallback",
"testProfileStrategyCallbackSideEffect",
+ // TODO: read and write tests don't translate locally well because of calling iterate() inside read()/write() add a none() - fix????
+ ReadTest.Traversals.class.getCanonicalName(),
+ WriteTest.Traversals.class.getCanonicalName(),
+ //
GraphComputerTest.class.getCanonicalName(),
ProgramTest.Traversals.class.getCanonicalName(),
TraversalInterruptionTest.class.getCanonicalName(),
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
index 8fa51de..4f39fa5 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
@@ -173,22 +173,12 @@ class GraphTraversalSource {
}
/**
- * read GraphTraversalSource step method.
+ * io GraphTraversalSource step method.
* @param {...Object} args
* @returns {GraphTraversal}
*/
- read(...args) {
- const b = new Bytecode(this.bytecode).addStep('read', args);
- return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
- }
-
- /**
- * write GraphTraversalSource step method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
- write(...args) {
- const b = new Bytecode(this.bytecode).addStep('write', args);
+ io(...args) {
+ const b = new Bytecode(this.bytecode).addStep('io', args);
return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -913,6 +903,16 @@ class GraphTraversal extends Traversal {
}
/**
+ * Graph traversal read method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ read(...args) {
+ this.bytecode.addStep('read', args);
+ return this;
+ }
+
+ /**
* Graph traversal repeat method.
* @param {...Object} args
* @returns {GraphTraversal}
@@ -1162,6 +1162,16 @@ class GraphTraversal extends Traversal {
return this;
}
+ /**
+ * Graph traversal write method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ write(...args) {
+ this.bytecode.addStep('write', args);
+ return this;
+ }
+
}
function callOnEmptyTraversal(fnName, args) {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index e559613..6d56c5c 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -106,14 +106,9 @@ class GraphTraversalSource(object):
traversal.bytecode.add_step("inject", *args)
return traversal
- def read(self, *args):
- traversal = self.get_graph_traversal()
- traversal.bytecode.add_step("read", *args)
- return traversal
-
- def write(self, *args):
+ def io(self, *args):
traversal = self.get_graph_traversal()
- traversal.bytecode.add_step("write", *args)
+ traversal.bytecode.add_step("io", *args)
return traversal
@@ -419,6 +414,10 @@ class GraphTraversal(Traversal):
self.bytecode.add_step("range", *args)
return self
+ def read(self, *args):
+ self.bytecode.add_step("read", *args)
+ return self
+
def repeat(self, *args):
self.bytecode.add_step("repeat", *args)
return self
@@ -519,6 +518,10 @@ class GraphTraversal(Traversal):
self.bytecode.add_step("with", *args)
return self
+ def write(self, *args):
+ self.bytecode.add_step("write", *args)
+ return self
+
class __(object):
graph_traversal = GraphTraversal
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
index 43da8b7..f3eb669 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
@@ -69,6 +69,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.SumTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.map.UnfoldTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.map.ValueMapTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ExplainTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupCountTest;
@@ -159,6 +160,7 @@ public class ProcessStandardSuite extends AbstractGremlinSuite {
VertexTest.Traversals.class,
UnfoldTest.Traversals.class,
ValueMapTest.Traversals.class,
+ WriteTest.Traversals.class,
// sideEffect
AggregateTest.Traversals.class,
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
index 6b7b67e..9e53169 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
@@ -18,24 +18,22 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.map;
-import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
import org.apache.tinkerpop.gremlin.TestHelper;
import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
-import org.apache.tinkerpop.gremlin.process.IgnoreEngine;
+import org.apache.tinkerpop.gremlin.process.traversal.IO;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.io.IoTest;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLResourceAccess;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONResourceAccess;
import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoResourceAccess;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.io.File;
import java.io.IOException;
-import java.util.Map;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
/**
* @author Stephen Mallette (http://stephen.genoprime.com)
@@ -43,22 +41,112 @@ import static org.junit.Assert.assertTrue;
@RunWith(GremlinProcessRunner.class)
public abstract class ReadTest extends AbstractGremlinProcessTest {
- public abstract Traversal<Object,Object> get_g_io_read() throws IOException;
+ public abstract Traversal<Object,Object> get_g_io_readXkryoX(final String fileToRead) throws IOException;
+
+ public abstract Traversal<Object,Object> get_g_io_read_withXreader_gryoX(final String fileToRead) throws IOException;
+
+ public abstract Traversal<Object,Object> get_g_io_readXjsonX(final String fileToRead) throws IOException;
+
+ public abstract Traversal<Object,Object> get_g_io_read_withXreader_graphsonX(final String fileToRead) throws IOException;
+
+ public abstract Traversal<Object,Object> get_g_io_readXxmlX(final String fileToRead) throws IOException;
+
+ public abstract Traversal<Object,Object> get_g_io_read_withXreader_graphmlX(final String fileToRead) throws IOException;
+
+ @Test
+ @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+ public void g_readXkryoX() throws IOException {
+ final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GryoResourceAccess.class, "tinkerpop-modern-v3d0.kryo", "").getAbsolutePath().replace('\\', '/');
+ final Traversal<Object,Object> traversal = get_g_io_readXkryoX(fileToRead);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
+
+ IoTest.assertModernGraph(graph, false, true);
+ }
+
+ @Test
+ @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+ public void g_io_read_withXreader_gryoX() throws IOException {
+ final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GryoResourceAccess.class, "tinkerpop-modern-v3d0.kryo", "").getAbsolutePath().replace('\\', '/');
+ final Traversal<Object,Object> traversal = get_g_io_read_withXreader_gryoX(fileToRead);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
+
+ IoTest.assertModernGraph(graph, false, true);
+ }
@Test
- public void g_read() throws IOException {
- final Traversal<Object,Object> traversal = get_g_io_read();
+ @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+ public void g_readXjsonX() throws IOException {
+ final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GraphSONResourceAccess.class, "tinkerpop-modern-v3d0.json", "").getAbsolutePath().replace('\\', '/');
+ final Traversal<Object,Object> traversal = get_g_io_readXjsonX(fileToRead);
printTraversalForm(traversal);
- assertTrue(traversal.hasNext());
+ assertFalse(traversal.hasNext());
+
+ IoTest.assertModernGraph(graph, false, true);
+ }
+
+ @Test
+ @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+ public void g_io_read_withXreader_graphsonX() throws IOException {
+ final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GraphSONResourceAccess.class, "tinkerpop-modern-v3d0.json", "").getAbsolutePath().replace('\\', '/');
+ final Traversal<Object,Object> traversal = get_g_io_read_withXreader_graphsonX(fileToRead);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
+
+ IoTest.assertModernGraph(graph, false, true);
+ }
+
+ @Test
+ @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+ public void g_readXxmlX() throws IOException {
+ final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GraphMLResourceAccess.class, "tinkerpop-modern.xml", "").getAbsolutePath().replace('\\', '/');
+ final Traversal<Object,Object> traversal = get_g_io_readXxmlX(fileToRead);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
+
+ IoTest.assertModernGraph(graph, false, true);
+ }
+
+ @Test
+ @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+ public void g_io_read_withXreader_graphmlX() throws IOException {
+ final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GraphMLResourceAccess.class, "tinkerpop-modern.xml", "").getAbsolutePath().replace('\\', '/');
+ final Traversal<Object,Object> traversal = get_g_io_read_withXreader_graphmlX(fileToRead);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
IoTest.assertModernGraph(graph, false, true);
}
public static class Traversals extends ReadTest {
@Override
- public Traversal<Object,Object> get_g_io_read() throws IOException {
- final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GryoResourceAccess.class, "tinkerpop-modern-v3d0.kryo", "").getAbsolutePath().replace('\\', '/');
+ public Traversal<Object,Object> get_g_io_readXkryoX(final String fileToRead) throws IOException {
return g.io(fileToRead).read();
}
+
+ @Override
+ public Traversal<Object,Object> get_g_io_read_withXreader_gryoX(final String fileToRead) throws IOException {
+ return g.io(fileToRead).with(IO.reader, IO.gryo).read();
+ }
+
+ @Override
+ public Traversal<Object,Object> get_g_io_readXjsonX(final String fileToRead) throws IOException {
+ return g.io(fileToRead).read();
+ }
+
+ @Override
+ public Traversal<Object,Object> get_g_io_read_withXreader_graphsonX(final String fileToRead) throws IOException {
+ return g.io(fileToRead).with(IO.reader, IO.graphson).read();
+ }
+ @Override
+ public Traversal<Object,Object> get_g_io_readXxmlX(final String fileToRead) throws IOException {
+ return g.io(fileToRead).read();
+ }
+
+ @Override
+ public Traversal<Object,Object> get_g_io_read_withXreader_graphmlX(final String fileToRead) throws IOException {
+ return g.io(fileToRead).with(IO.reader, IO.graphml).read();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteTest.java
new file mode 100644
index 0000000..e739c0a
--- /dev/null
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteTest.java
@@ -0,0 +1,175 @@
+/*
+ * 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.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
+import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
+import org.apache.tinkerpop.gremlin.process.traversal.IO;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+@RunWith(GremlinProcessRunner.class)
+public abstract class WriteTest extends AbstractGremlinProcessTest {
+
+ public abstract Traversal<Object,Object> get_g_io_writeXkryoX(final String fileToWrite) throws IOException;
+
+ public abstract Traversal<Object,Object> get_g_io_write_withXwriter_gryoX(final String fileToWrite) throws IOException;
+
+ public abstract Traversal<Object,Object> get_g_io_writeXjsonX(final String fileToWrite) throws IOException;
+
+ public abstract Traversal<Object,Object> get_g_io_write_withXwriter_graphsonX(final String fileToWrite) throws IOException;
+
+ public abstract Traversal<Object,Object> get_g_io_writeXxmlX(final String fileToWrite) throws IOException;
+
+ public abstract Traversal<Object,Object> get_g_io_write_withXwriter_graphmlX(final String fileToWrite) throws IOException;
+
+ @Test
+ @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+ public void g_writeXkryoX() throws IOException {
+ final String fileToWrite = TestHelper.generateTempFile(WriteTest.class, "tinkerpop-modern-v3d0", ".kryo").getAbsolutePath().replace('\\', '/');
+
+ final File f = new File(fileToWrite);
+ assertThat(f.length() == 0, is(true));
+
+ final Traversal<Object,Object> traversal = get_g_io_writeXkryoX(fileToWrite);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
+
+ assertThat(f.length() > 0, is(true));
+ }
+
+ @Test
+ @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+ public void g_io_write_withXwrite_gryoX() throws IOException {
+ final String fileToWrite = TestHelper.generateTempFile(WriteTest.class, "tinkerpop-modern-v3d0", ".kryo").getAbsolutePath().replace('\\', '/');
+
+ final File f = new File(fileToWrite);
+ assertThat(f.length() == 0, is(true));
+
+ final Traversal<Object,Object> traversal = get_g_io_write_withXwriter_gryoX(fileToWrite);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
+
+ assertThat(f.length() > 0, is(true));
+ }
+
+ @Test
+ @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+ public void g_writeXjsonX() throws IOException {
+ final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern-v3d0", ".json").getAbsolutePath().replace('\\', '/');
+
+ final File f = new File(fileToWrite);
+ assertThat(f.length() == 0, is(true));
+
+ final Traversal<Object,Object> traversal = get_g_io_writeXjsonX(fileToWrite);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
+
+ assertThat(f.length() > 0, is(true));
+ }
+
+ @Test
+ @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+ public void g_io_write_withXwriter_graphsonX() throws IOException {
+ final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern-v3d0", ".json").getAbsolutePath().replace('\\', '/');
+
+ final File f = new File(fileToWrite);
+ assertThat(f.length() == 0, is(true));
+
+ final Traversal<Object,Object> traversal = get_g_io_write_withXwriter_graphsonX(fileToWrite);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
+
+ assertThat(f.length() > 0, is(true));
+ }
+
+ @Test
+ @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+ public void g_writeXxmlX() throws IOException {
+ final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern", ".xml").getAbsolutePath().replace('\\', '/');
+
+ final File f = new File(fileToWrite);
+ assertThat(f.length() == 0, is(true));
+
+ final Traversal<Object,Object> traversal = get_g_io_writeXxmlX(fileToWrite);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
+
+ assertThat(f.length() > 0, is(true));
+ }
+
+ @Test
+ @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+ public void g_io_write_withXwriter_graphmlX() throws IOException {
+ final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern", ".xml").getAbsolutePath().replace('\\', '/');
+
+ final File f = new File(fileToWrite);
+ assertThat(f.length() == 0, is(true));
+
+ final Traversal<Object,Object> traversal = get_g_io_write_withXwriter_graphmlX(fileToWrite);
+ printTraversalForm(traversal);
+ assertFalse(traversal.hasNext());
+
+ assertThat(f.length() > 0, is(true));
+ }
+
+ public static class Traversals extends WriteTest {
+ @Override
+ public Traversal<Object,Object> get_g_io_writeXkryoX(final String fileToWrite) throws IOException {
+ return g.io(fileToWrite).write();
+ }
+
+ @Override
+ public Traversal<Object,Object> get_g_io_write_withXwriter_gryoX(final String fileToWrite) throws IOException {
+ return g.io(fileToWrite).with(IO.writer, IO.gryo).write();
+ }
+
+ @Override
+ public Traversal<Object,Object> get_g_io_writeXjsonX(final String fileToWrite) throws IOException {
+ return g.io(fileToWrite).write();
+ }
+
+ @Override
+ public Traversal<Object,Object> get_g_io_write_withXwriter_graphsonX(final String fileToWrite) throws IOException {
+ return g.io(fileToWrite).with(IO.writer, IO.graphson).write();
+ }
+ @Override
+ public Traversal<Object,Object> get_g_io_writeXxmlX(final String fileToWrite) throws IOException {
+ return g.io(fileToWrite).write();
+ }
+
+ @Override
+ public Traversal<Object,Object> get_g_io_write_withXwriter_graphmlX(final String fileToWrite) throws IOException {
+ return g.io(fileToWrite).with(IO.writer, IO.graphml).write();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategyProcessTest.java
index 9acaa3f..69fa5cf 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategyProcessTest.java
@@ -22,7 +22,6 @@ import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
index 14c5360..5935ebf 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
@@ -142,6 +142,16 @@ import java.util.stream.Stream;
method = "g_V_matchXa_followedBy_count_isXgtX10XX_b__a_0followedBy_count_isXgtX10XX_bX_count",
reason = "Hadoop-Gremlin is OLAP-oriented and for OLTP operations, linear-scan joins are required. This particular tests takes many minutes to execute.",
computers = {"ALL"})
+@Graph.OptOut(
+ test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadTest$Traversals",
+ method = "*",
+ reason = "This body of tests is not configured to properly suit OLAP based testing and HadoopGraph is not designed to handle single-threaded OLTP reads/writes.",
+ computers = {"ALL"})
+@Graph.OptOut(
+ test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteTest$Traversals",
+ method = "*",
+ reason = "This body of tests is not configured to properly suit OLAP based testing and HadoopGraph is not designed to handle single-threaded OLTP reads/writes.",
+ computers = {"ALL"})
public final class HadoopGraph implements Graph {
public static final Logger LOGGER = LoggerFactory.getLogger(HadoopGraph.class);
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
index 598e434..a590835 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
@@ -19,6 +19,7 @@
package org.apache.tinkerpop.gremlin.tinkergraph.structure;
import org.apache.tinkerpop.gremlin.process.computer.Computer;
+import org.apache.tinkerpop.gremlin.process.traversal.IO;
import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
@@ -28,6 +29,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.Path
import org.apache.tinkerpop.gremlin.structure.*;
import org.apache.tinkerpop.gremlin.structure.io.IoTest;
import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
import org.apache.tinkerpop.gremlin.util.TimeUtil;
import org.junit.Ignore;
import org.junit.Test;
@@ -333,13 +336,4 @@ public class TinkerGraphPlayTest {
System.out.println(g.V().as("a").both().as("b").dedup("a", "b").by(T.label).select("a", "b").toList());
}
-
- @Test
- public void testBlah() {
- TinkerGraph graph = TinkerGraph.open();
- GraphTraversalSource g = graph.traversal();
- g.io("../data/tinkerpop-modern.kryo").read();
-
- IoTest.assertModernGraph(graph, true, false);
- }
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/AbstractTinkerGraphGraphSONTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/AbstractTinkerGraphGraphSONTranslatorProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/AbstractTinkerGraphGraphSONTranslatorProvider.java
index c20ed11..8462781 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/AbstractTinkerGraphGraphSONTranslatorProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/AbstractTinkerGraphGraphSONTranslatorProvider.java
@@ -29,6 +29,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.process.traversal.step.map.PageRankTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProgramTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteTest;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategyProcessTest;
@@ -52,6 +54,9 @@ public abstract class AbstractTinkerGraphGraphSONTranslatorProvider extends Tink
private static Set<String> SKIP_TESTS = new HashSet<>(Arrays.asList(
"testProfileStrategyCallback",
"testProfileStrategyCallbackSideEffect",
+ // TODO: read and write tests don't translate locally well because of calling iterate() inside read()/write() add a none() - fix????
+ ReadTest.Traversals.class.getCanonicalName(),
+ WriteTest.Traversals.class.getCanonicalName(),
//
ProgramTest.Traversals.class.getCanonicalName(),
TraversalInterruptionTest.class.getCanonicalName(),
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/gryo/TinkerGraphGryoTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/gryo/TinkerGraphGryoTranslatorProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/gryo/TinkerGraphGryoTranslatorProvider.java
index 91e0385..e09508f 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/gryo/TinkerGraphGryoTranslatorProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/gryo/TinkerGraphGryoTranslatorProvider.java
@@ -25,6 +25,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionCompu
import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionTest;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProgramTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteTest;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
@@ -45,6 +47,10 @@ public class TinkerGraphGryoTranslatorProvider extends TinkerGraphProvider {
"testProfileStrategyCallback",
"testProfileStrategyCallbackSideEffect",
//
+ // TODO: read and write tests don't translate locally well because of calling iterate() inside read()/write() add a none() - fix????
+ ReadTest.Traversals.class.getCanonicalName(),
+ WriteTest.Traversals.class.getCanonicalName(),
+ //
ProgramTest.Traversals.class.getCanonicalName(),
TraversalInterruptionTest.class.getCanonicalName(),
EventStrategyProcessTest.class.getCanonicalName(),
@@ -65,7 +71,6 @@ public class TinkerGraphGryoTranslatorProvider extends TinkerGraphProvider {
public GraphTraversalSource traversal(final Graph graph) {
if ((Boolean) graph.configuration().getProperty("skipTest"))
return graph.traversal();
- //throw new VerificationException("This test current does not work with Gremlin-Python", EmptyTraversal.instance());
else {
final GraphTraversalSource g = graph.traversal();
return g.withStrategies(new TranslationStrategy(g, new GryoTranslator<>(JavaTranslator.of(g))));