You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/03/16 21:02:06 UTC
incubator-tinkerpop git commit: added AddVertexStep. AddEdgeStep is
now a MapStep. Added AddPropertyStep. -- addV(), addE(),
and property() off of Traverasl. Fixed #547.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 7765bf4fd -> 4e2b979b2
added AddVertexStep. AddEdgeStep is now a MapStep. Added AddPropertyStep. -- addV(), addE(), and property() off of Traverasl. Fixed #547.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/4e2b979b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/4e2b979b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/4e2b979b
Branch: refs/heads/master
Commit: 4e2b979b279cdbd282ad435fb7fb063c466fe735
Parents: 7765bf4
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Mar 16 14:02:00 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Mar 16 14:02:00 2015 -0600
----------------------------------------------------------------------
.../process/graph/traversal/GraphTraversal.java | 40 +++---
.../gremlin/process/graph/traversal/__.java | 36 ++---
.../graph/traversal/step/map/AddEdgeStep.java | 78 +++++++++++
.../graph/traversal/step/map/AddVertexStep.java | 45 ++++++
.../traversal/step/sideEffect/AddEdgeStep.java | 77 -----------
.../step/sideEffect/AddPropertyStep.java | 43 ++++++
.../strategy/decoration/ReadOnlyStrategy.java | 2 +-
.../process/traversal/util/TraversalHelper.java | 6 +
.../decoration/ReadOnlyStrategyTest.java | 6 +-
.../traversal/step/map/GroovyAddEdgeTest.groovy | 46 +++++++
.../step/map/GroovyAddVertexTest.groovy | 41 ++++++
.../step/sideEffect/GroovyAddEdgeTest.groovy | 52 -------
.../process/GroovyProcessStandardSuite.java | 6 +-
.../gremlin/process/ProcessStandardSuite.java | 57 +++++++-
.../graph/traversal/step/map/AddEdgeTest.java | 100 ++++++++++++++
.../graph/traversal/step/map/AddVertexTest.java | 69 ++++++++++
.../traversal/step/sideEffect/AddEdgeTest.java | 137 -------------------
.../decoration/ReadOnlyStrategyTest.java | 18 ---
18 files changed, 528 insertions(+), 331 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversal.java
index b5f4f0d..9be1dcc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversal.java
@@ -48,6 +48,8 @@ import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.SampleGl
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.SimplePathStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.TimeLimitStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.WhereStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.AddEdgeStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.AddVertexStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.BackStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.CoalesceStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.CountGlobalStep;
@@ -86,7 +88,7 @@ import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.TreeStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.UnfoldStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.VertexStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.match.MatchStep;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.AddEdgeStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.AddPropertyStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.AggregateStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.GroupCountSideEffectStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.GroupSideEffectStep;
@@ -370,6 +372,26 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
return this.asAdmin().addStep(new TreeStep<>(this.asAdmin()));
}
+ public default GraphTraversal<S, Vertex> addV(final Object... keyValues) {
+ return this.asAdmin().addStep(new AddVertexStep<>(this.asAdmin(), keyValues));
+ }
+
+ public default GraphTraversal<S, Edge> addE(final Direction direction, final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
+ return this.asAdmin().addStep(new AddEdgeStep(this.asAdmin(), direction, edgeLabel, stepLabel, propertyKeyValues));
+ }
+
+ public default GraphTraversal<S, Edge> addInE(final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
+ return this.addE(Direction.IN, edgeLabel, stepLabel, propertyKeyValues);
+ }
+
+ public default GraphTraversal<S, Edge> addOutE(final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
+ return this.addE(Direction.OUT, edgeLabel, stepLabel, propertyKeyValues);
+ }
+
+ public default GraphTraversal<S, E> property(final String key, final Object value) {
+ return this.asAdmin().addStep(new AddPropertyStep(this.asAdmin(), key, value));
+ }
+
///////////////////// FILTER STEPS /////////////////////
public default GraphTraversal<S, E> filter(final Predicate<Traverser<E>> predicate) {
@@ -566,22 +588,6 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
return this.asAdmin().addStep(new GroupCountSideEffectStep<>(this.asAdmin(), sideEffectKey));
}
- public default GraphTraversal<S, Vertex> addE(final Direction direction, final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
- return this.asAdmin().addStep(new AddEdgeStep(this.asAdmin(), direction, edgeLabel, stepLabel, propertyKeyValues));
- }
-
- public default GraphTraversal<S, Vertex> addInE(final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
- return this.addE(Direction.IN, edgeLabel, stepLabel, propertyKeyValues);
- }
-
- public default GraphTraversal<S, Vertex> addOutE(final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
- return this.addE(Direction.OUT, edgeLabel, stepLabel, propertyKeyValues);
- }
-
- public default GraphTraversal<S, Vertex> addBothE(final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
- return this.addE(Direction.BOTH, edgeLabel, stepLabel, propertyKeyValues);
- }
-
public default GraphTraversal<S, E> timeLimit(final long timeLimit) {
return this.asAdmin().addStep(new TimeLimitStep<E>(this.asAdmin(), timeLimit));
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/__.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/__.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/__.java
index 572868e..49dadfc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/__.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/__.java
@@ -259,6 +259,26 @@ public class __ {
return __.<A>start().tree();
}
+ public static <A> GraphTraversal<A, Vertex> addV(final Object... propertyKeyValues) {
+ return __.<A>start().addV(propertyKeyValues);
+ }
+
+ public static <A> GraphTraversal<A, Edge> addE(final Direction direction, final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
+ return __.<A>start().addE(direction, edgeLabel, stepLabel, propertyKeyValues);
+ }
+
+ public static <A> GraphTraversal<A, Edge> addInE(final String edgeLabel, final String setLabel, final Object... propertyKeyValues) {
+ return __.<A>start().addInE(edgeLabel, setLabel, propertyKeyValues);
+ }
+
+ public static <A> GraphTraversal<A, Edge> addOutE(final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
+ return __.<A>start().addOutE(edgeLabel, stepLabel, propertyKeyValues);
+ }
+
+ public static <A> GraphTraversal<A, A> property(final String key, final Object value) {
+ return __.<A>start().property(key, value);
+ }
+
///////////////////// FILTER STEPS /////////////////////
public static <A> GraphTraversal<A, A> filter(final Predicate<Traverser<A>> predicate) {
@@ -447,22 +467,6 @@ public class __ {
return __.<A>start().groupCount(sideEffectKey);
}
- public static <A> GraphTraversal<A, Vertex> addE(final Direction direction, final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
- return __.<A>start().addE(direction, edgeLabel, stepLabel, propertyKeyValues);
- }
-
- public static <A> GraphTraversal<A, Vertex> addInE(final String edgeLabel, final String setLabel, final Object... propertyKeyValues) {
- return __.<A>start().addInE(edgeLabel, setLabel, propertyKeyValues);
- }
-
- public static <A> GraphTraversal<A, Vertex> addOutE(final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
- return __.<A>start().addOutE(edgeLabel, stepLabel, propertyKeyValues);
- }
-
- public static <A> GraphTraversal<A, Vertex> addBothE(final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
- return __.<A>start().addBothE(edgeLabel, stepLabel, propertyKeyValues);
- }
-
public static <A> GraphTraversal<A, A> timeLimit(final long timeLimit) {
return __.<A>start().timeLimit(timeLimit);
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeStep.java
new file mode 100644
index 0000000..d8ae0e8
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeStep.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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
+import java.util.EnumSet;
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class AddEdgeStep extends MapStep<Vertex, Edge> {
+
+ private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
+ TraverserRequirement.PATH,
+ TraverserRequirement.OBJECT
+ );
+
+ // TODO: Weight key based on Traverser.getCount() ?
+
+ private final Direction direction;
+ private final String edgeLabel;
+ private final String stepLabel;
+ private final Object[] propertyKeyValues;
+
+ public AddEdgeStep(final Traversal.Admin traversal, final Direction direction, final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
+ super(traversal);
+ this.direction = direction;
+ if (this.direction.equals(Direction.BOTH))
+ throw new IllegalArgumentException("Only in- and out- directions are supported by " + AddEdgeStep.class.getSimpleName());
+ this.edgeLabel = edgeLabel;
+ this.stepLabel = stepLabel;
+ this.propertyKeyValues = propertyKeyValues;
+ }
+
+ @Override
+ public String toString() {
+ return TraversalHelper.makeStepString(this, this.direction.name(), this.edgeLabel, this.stepLabel);
+ }
+
+ @Override
+ protected Edge map(Traverser.Admin<Vertex> traverser) {
+ final Vertex currentVertex = traverser.get();
+ final Vertex otherVertex = traverser.path().get(this.stepLabel);
+ if (this.direction.equals(Direction.IN))
+ return otherVertex.addEdge(edgeLabel, currentVertex, this.propertyKeyValues);
+ else
+ return currentVertex.addEdge(edgeLabel, otherVertex, this.propertyKeyValues);
+ }
+
+ @Override
+ public Set<TraverserRequirement> getRequirements() {
+ return REQUIREMENTS;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStep.java
new file mode 100644
index 0000000..0240d7a
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStep.java
@@ -0,0 +1,45 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class AddVertexStep<S> extends MapStep<S, Vertex> {
+
+ private final Object[] keyValues;
+ private final transient Graph graph;
+
+ public AddVertexStep(final Traversal.Admin traversal, final Object... keyValues) {
+ super(traversal);
+ this.keyValues = keyValues;
+ this.graph = TraversalHelper.getGraph(traversal);
+ }
+
+ @Override
+ protected Vertex map(final Traverser.Admin<S> traverser) {
+ return this.graph.addVertex(this.keyValues);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeStep.java
deleted file mode 100644
index 84d812f..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeStep.java
+++ /dev/null
@@ -1,77 +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.graph.traversal.step.sideEffect;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class AddEdgeStep extends SideEffectStep<Vertex> {
-
- private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
- TraverserRequirement.PATH,
- TraverserRequirement.OBJECT
- );
-
- // TODO: Weight key based on Traverser.getCount() ?
-
- private final Direction direction;
- private final String edgeLabel;
- private final String stepLabel;
- private final Object[] propertyKeyValues;
-
- public AddEdgeStep(final Traversal.Admin traversal, final Direction direction, final String edgeLabel, final String stepLabel, final Object... propertyKeyValues) {
- super(traversal);
- this.direction = direction;
- this.edgeLabel = edgeLabel;
- this.stepLabel = stepLabel;
- this.propertyKeyValues = propertyKeyValues;
- }
-
- @Override
- protected void sideEffect(final Traverser.Admin<Vertex> traverser) {
- final Vertex currentVertex = traverser.get();
- final Vertex otherVertex = traverser.path().get(stepLabel);
- if (direction.equals(Direction.IN) || direction.equals(Direction.BOTH)) {
- otherVertex.addEdge(edgeLabel, currentVertex, this.propertyKeyValues);
- }
- if (direction.equals(Direction.OUT) || direction.equals(Direction.BOTH)) {
- currentVertex.addEdge(edgeLabel, otherVertex, this.propertyKeyValues);
- }
- }
-
- @Override
- public String toString() {
- return TraversalHelper.makeStepString(this, this.direction.name(), this.edgeLabel, this.stepLabel);
- }
-
- @Override
- public Set<TraverserRequirement> getRequirements() {
- return REQUIREMENTS;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddPropertyStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddPropertyStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddPropertyStep.java
new file mode 100644
index 0000000..516d0f5
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddPropertyStep.java
@@ -0,0 +1,43 @@
+/*
+ * 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.graph.traversal.step.sideEffect;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.structure.Element;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class AddPropertyStep<S extends Element> extends SideEffectStep<S> {
+
+ private final String key;
+ private final Object value;
+
+ public AddPropertyStep(final Traversal.Admin traversal, final String key, final Object value) {
+ super(traversal);
+ this.key = key;
+ this.value = value;
+ }
+
+ @Override
+ protected void sideEffect(final Traverser.Admin<S> traverser) {
+ traverser.get().property(this.key, this.value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategy.java
index f8af029..1c9dc7a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategy.java
@@ -19,7 +19,7 @@
package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.AddEdgeStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.AddEdgeStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.strategy.AbstractTraversalStrategy;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
index 8771e24..bb2446c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
@@ -23,10 +23,12 @@ import org.apache.tinkerpop.gremlin.process.Traversal;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.EdgeVertexStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.PropertiesStep;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.VertexStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.GraphStep;
import org.apache.tinkerpop.gremlin.process.traversal.StepPosition;
import org.apache.tinkerpop.gremlin.process.traversal.step.EmptyStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
import org.apache.tinkerpop.gremlin.process.util.BulkSet;
+import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.ArrayList;
@@ -87,6 +89,10 @@ public final class TraversalHelper {
return steps;
}
+ public static Graph getGraph(final Traversal.Admin<?, ?> traversal) {
+ return ((GraphStep) traversal.getStartStep()).getGraph(Graph.class);
+ }
+
public static boolean isLocalStarGraph(final Traversal.Admin<?, ?> traversal) {
char state = 'v';
for (final Step step : traversal.getSteps()) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategyTest.java
index 4edf017..aa6a6e0 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategyTest.java
@@ -38,8 +38,6 @@ public class ReadOnlyStrategyTest {
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][]{
- {"addBothE()", __.addBothE("test", "x")},
- {"addBothE(args)", __.addBothE("test", "x", "this", "that")},
{"addInE()", __.addInE("test", "x")},
{"addInE(args)", __.addInE("test", "x", "this", "that")},
{"addOutE()", __.addOutE("test", "x")},
@@ -47,9 +45,7 @@ public class ReadOnlyStrategyTest {
{"addE(IN)", __.addE(Direction.IN, "test", "test")},
{"addE(IN,args)", __.addE(Direction.IN, "test", "test", "this", "that")},
{"addE(OUT)", __.addE(Direction.OUT, "test", "test")},
- {"addE(OUT,args)", __.addE(Direction.OUT, "test", "test", "this", "that")},
- {"addE(BOTH)", __.addE(Direction.BOTH, "test", "test")},
- {"addE(BOTH,args)", __.addE(Direction.BOTH, "test", "test", "this", "that")}});
+ {"addE(OUT,args)", __.addE(Direction.OUT, "test", "test", "this", "that")}});
}
@Parameterized.Parameter(value = 0)
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroovyAddEdgeTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroovyAddEdgeTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroovyAddEdgeTest.groovy
new file mode 100644
index 0000000..3718834
--- /dev/null
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroovyAddEdgeTest.groovy
@@ -0,0 +1,46 @@
+/*
+ * 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.graph.traversal.step.map
+
+import org.apache.tinkerpop.gremlin.process.Traversal
+import org.apache.tinkerpop.gremlin.process.TraversalEngine
+import org.apache.tinkerpop.gremlin.process.UseEngine
+import org.apache.tinkerpop.gremlin.structure.Edge
+import org.apache.tinkerpop.gremlin.structure.Vertex
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public abstract class GroovyAddEdgeTest {
+
+ @UseEngine(TraversalEngine.Type.STANDARD)
+ public static class StandardTraversals extends AddEdgeTest {
+
+ @Override
+ public Traversal<Vertex, Edge> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_aX(final Object v1Id) {
+ g.V(v1Id).as('a').out('created').addOutE('createdBy', 'a')
+ }
+
+ @Override
+ public Traversal<Vertex, Edge> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_a_weight_2X(
+ final Object v1Id) {
+ g.V(v1Id).as('a').out('created').addOutE('createdBy', 'a', 'weight', 2)
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroovyAddVertexTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroovyAddVertexTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroovyAddVertexTest.groovy
new file mode 100644
index 0000000..2e47b5a
--- /dev/null
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroovyAddVertexTest.groovy
@@ -0,0 +1,41 @@
+/*
+ * 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.graph.traversal.step.map
+
+import org.apache.tinkerpop.gremlin.process.T
+import org.apache.tinkerpop.gremlin.process.Traversal
+import org.apache.tinkerpop.gremlin.process.TraversalEngine
+import org.apache.tinkerpop.gremlin.process.UseEngine
+import org.apache.tinkerpop.gremlin.structure.Vertex
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public abstract class GroovyAddVertexTest {
+
+ @UseEngine(TraversalEngine.Type.STANDARD)
+ public static class StandardTraversals extends AddVertexTest {
+
+ @Override
+ public Traversal<Vertex, Vertex> get_g_V_addVXlabel_animal_age_0X() {
+ g.V.addV(T.label, 'animal', 'age', 0);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/GroovyAddEdgeTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/GroovyAddEdgeTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/GroovyAddEdgeTest.groovy
deleted file mode 100644
index 9a5306a..0000000
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/GroovyAddEdgeTest.groovy
+++ /dev/null
@@ -1,52 +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.graph.traversal.step.sideEffect
-
-import org.apache.tinkerpop.gremlin.process.Traversal
-import org.apache.tinkerpop.gremlin.process.TraversalEngine
-import org.apache.tinkerpop.gremlin.process.UseEngine
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.AddEdgeTest
-import org.apache.tinkerpop.gremlin.structure.Vertex
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public abstract class GroovyAddEdgeTest {
-
- @UseEngine(TraversalEngine.Type.STANDARD)
- public static class StandardTraversals extends AddEdgeTest {
-
- @Override
- public Traversal<Vertex, Vertex> get_g_VX1X_asXaX_outXcreatedX_inXcreatedX_addBothEXcocreator_aX(
- final Object v1Id) {
- g.V(v1Id).as('a').out('created').in('created').addBothE('cocreator', 'a')
- }
-
- @Override
- public Traversal<Vertex, Vertex> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_aX(final Object v1Id) {
- g.V(v1Id).as('a').out('created').addOutE('createdBy', 'a')
- }
-
- @Override
- public Traversal<Vertex, Vertex> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_a_weight_2X(
- final Object v1Id) {
- g.V(v1Id).as('a').out('created').addOutE('createdBy', 'a', 'weight', 2)
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java
index 086b725..ebb7b40 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java
@@ -42,6 +42,8 @@ import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.GroovyRe
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.GroovySampleTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.GroovySimplePathTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.GroovyWhereTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.GroovyAddEdgeTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.GroovyAddVertexTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.GroovyBackTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.GroovyCoalesceTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.GroovyCountTest;
@@ -59,7 +61,6 @@ import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.GroovySumTe
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.GroovyUnfoldTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.GroovyValueMapTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.GroovyVertexTest;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.GroovyAddEdgeTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.GroovyAggregateTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.GroovyGroupCountTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.GroovyGroupTest;
@@ -110,6 +111,8 @@ public class GroovyProcessStandardSuite extends ProcessStandardSuite {
GroovySimplePathTest.StandardTraversals.class,
GroovyWhereTest.StandardTraversals.class,
// map
+ GroovyAddEdgeTest.StandardTraversals.class,
+ GroovyAddVertexTest.StandardTraversals.class,
GroovyBackTest.StandardTraversals.class,
GroovyCoalesceTest.StandardTraversals.class,
GroovyCountTest.StandardTraversals.class,
@@ -128,7 +131,6 @@ public class GroovyProcessStandardSuite extends ProcessStandardSuite {
GroovyValueMapTest.StandardTraversals.class,
GroovyVertexTest.StandardTraversals.class,
// sideEffect
- GroovyAddEdgeTest.StandardTraversals.class,
GroovyAggregateTest.StandardTraversals.class,
GroovyGroupTest.StandardTraversals.class,
GroovyGroupCountTest.StandardTraversals.class,
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/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 c541da3..0a10ace 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
@@ -20,14 +20,58 @@ package org.apache.tinkerpop.gremlin.process;
import org.apache.tinkerpop.gremlin.AbstractGremlinSuite;
import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.branch.*;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.*;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.*;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.*;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.branch.BranchTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.branch.ChooseTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.branch.LocalTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.branch.RepeatTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.branch.UnionTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.AndTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.CoinTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.CyclicPathTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.DedupTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.ExceptTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.FilterTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.HasNotTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.HasTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.IsTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.OrTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.RangeTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.RetainTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.SampleTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.SimplePathTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.WhereTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.AddEdgeTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.AddVertexTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.BackTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.CoalesceTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.CountTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.FoldTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MapTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MatchTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MaxTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MeanTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MinTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.OrderTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.PropertiesTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.SelectTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.SumTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.UnfoldTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.ValueMapTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.VertexTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.AggregateTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.GroupCountTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.GroupTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.InjectTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.ProfileTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.SackTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.SideEffectCapTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.SideEffectTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.StoreTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.SubgraphTest;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.sideEffect.TreeTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.TraversalSideEffectsTest;
import org.apache.tinkerpop.gremlin.process.graph.traversal.strategy.TraversalVerificationStrategyTest;
import org.apache.tinkerpop.gremlin.process.traversal.CoreTraversalTest;
-import org.apache.tinkerpop.gremlin.process.traversal.engine.StandardTraversalEngine;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ReadOnlyStrategyTest;
import org.apache.tinkerpop.gremlin.process.util.PathTest;
import org.junit.runners.model.InitializationError;
@@ -95,6 +139,8 @@ public class ProcessStandardSuite extends AbstractGremlinSuite {
WhereTest.Traversals.class,
// map
+ AddEdgeTest.Traversals.class,
+ AddVertexTest.Traversals.class,
BackTest.Traversals.class,
CoalesceTest.Traversals.class,
CountTest.Traversals.class,
@@ -114,7 +160,6 @@ public class ProcessStandardSuite extends AbstractGremlinSuite {
ValueMapTest.Traversals.class,
// sideEffect
- AddEdgeTest.Traversals.class,
AggregateTest.Traversals.class,
GroupTest.Traversals.class,
GroupCountTest.Traversals.class,
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeTest.java
new file mode 100644
index 0000000..1f1ee6f
--- /dev/null
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
+import org.apache.tinkerpop.gremlin.FeatureRequirement;
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.TraversalEngine;
+import org.apache.tinkerpop.gremlin.process.UseEngine;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Test;
+
+import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public abstract class AddEdgeTest extends AbstractGremlinTest {
+
+ public abstract Traversal<Vertex, Edge> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_aX(final Object v1Id);
+
+ public abstract Traversal<Vertex, Edge> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_a_weight_2X(final Object v1Id);
+
+ @Test
+ @LoadGraphWith(MODERN)
+ @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+ public void g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_aX() {
+ final Traversal<Vertex, Edge> traversal = get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_aX(convertToVertexId("marko"));
+ printTraversalForm(traversal);
+ int count = 0;
+ while (traversal.hasNext()) {
+ final Edge edge = traversal.next();
+ assertEquals("createdBy", edge.label());
+ //assertEquals(convertToVertexId("lop"), vertex.id());
+ //assertEquals(1, IteratorUtils.count(vertex.vertices(Direction.OUT, "createdBy")));
+ //assertEquals(convertToVertexId("marko"), vertex.vertices(Direction.OUT, "createdBy").next().id());
+ //assertFalse(vertex.edges(Direction.OUT, "createdBy").next().properties().hasNext());
+ count++;
+
+ }
+ assertEquals(1, count);
+ }
+
+ @Test
+ @LoadGraphWith(MODERN)
+ @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+ public void g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_a_weight_2X() {
+ final Traversal<Vertex, Edge> traversal = get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_a_weight_2X(convertToVertexId("marko"));
+ printTraversalForm(traversal);
+ int count = 0;
+ while (traversal.hasNext()) {
+ final Edge edge = traversal.next();
+ assertEquals("createdBy", edge.label());
+ //assertEquals(convertToVertexId("lop"), edge.id());
+ //assertEquals(1, IteratorUtils.count(vertex.vertices(Direction.OUT, "createdBy")));
+ //assertEquals(convertToVertexId("marko"), vertex.vertices(Direction.OUT, "createdBy").next().id());
+ //assertEquals(2, vertex.edges(Direction.OUT, "createdBy").next().values("weight").next());
+ //assertEquals(1, IteratorUtils.count(vertex.edges(Direction.OUT, "createdBy").next().properties()));
+ count++;
+
+
+ }
+ assertEquals(1, count);
+ }
+
+ @UseEngine(TraversalEngine.Type.STANDARD)
+ public static class Traversals extends AddEdgeTest {
+
+ @Override
+ public Traversal<Vertex, Edge> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_aX(final Object v1Id) {
+ return g.V(v1Id).as("a").out("created").addOutE("createdBy", "a");
+ }
+
+ @Override
+ public Traversal<Vertex, Edge> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_a_weight_2X(final Object v1Id) {
+ return g.V(v1Id).as("a").out("created").addOutE("createdBy", "a", "weight", 2);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexTest.java
new file mode 100644
index 0000000..a7a9933
--- /dev/null
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
+import org.apache.tinkerpop.gremlin.FeatureRequirement;
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.process.T;
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.TraversalEngine;
+import org.apache.tinkerpop.gremlin.process.UseEngine;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.junit.Test;
+
+import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public abstract class AddVertexTest extends AbstractGremlinTest {
+
+ public abstract Traversal<Vertex, Vertex> get_g_V_addVXlabel_animal_age_0X();
+
+ @Test
+ @LoadGraphWith(MODERN)
+ @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+ public void g_V_addVXlabel_animal_age_0X() {
+ final Traversal<Vertex, Vertex> traversal = get_g_V_addVXlabel_animal_age_0X();
+ printTraversalForm(traversal);
+ int count = 0;
+ while (traversal.hasNext()) {
+ final Vertex vertex = traversal.next();
+ assertEquals("animal", vertex.label());
+ assertEquals(0, vertex.<Integer>value("age").intValue());
+ count++;
+ }
+ assertEquals(12, IteratorUtils.count(graph.vertices()));
+ assertEquals(6, count);
+ }
+
+
+ @UseEngine(TraversalEngine.Type.STANDARD)
+ public static class Traversals extends AddVertexTest {
+
+ @Override
+ public Traversal<Vertex, Vertex> get_g_V_addVXlabel_animal_age_0X() {
+ return g.V().addV(T.label, "animal", "age", 0);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeTest.java
deleted file mode 100644
index 523f181..0000000
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeTest.java
+++ /dev/null
@@ -1,137 +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.graph.traversal.step.sideEffect;
-
-import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
-import org.apache.tinkerpop.gremlin.FeatureRequirement;
-import org.apache.tinkerpop.gremlin.LoadGraphWith;
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.TraversalEngine;
-import org.apache.tinkerpop.gremlin.process.UseEngine;
-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.util.iterator.IteratorUtils;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
-import static org.junit.Assert.*;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public abstract class AddEdgeTest extends AbstractGremlinTest {
- public abstract Traversal<Vertex, Vertex> get_g_VX1X_asXaX_outXcreatedX_inXcreatedX_addBothEXcocreator_aX(final Object v1Id);
-
- public abstract Traversal<Vertex, Vertex> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_aX(final Object v1Id);
-
- public abstract Traversal<Vertex, Vertex> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_a_weight_2X(final Object v1Id);
-
- @Test
- @LoadGraphWith(MODERN)
- @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
- public void g_VX1X_asXaX_outXcreatedX_inXcreatedX_addBothEXcocreator_aX() {
- final Traversal<Vertex, Vertex> traversal = get_g_VX1X_asXaX_outXcreatedX_inXcreatedX_addBothEXcocreator_aX(convertToVertexId("marko"));
- printTraversalForm(traversal);
- final List<Vertex> cocreators = new ArrayList<>();
- final List<Object> ids = new ArrayList<>();
- while (traversal.hasNext()) {
- final Vertex vertex = traversal.next();
- cocreators.add(vertex);
- ids.add(vertex.id());
- }
- assertEquals(cocreators.size(), 3);
- assertTrue(ids.contains(convertToVertexId("marko")));
- assertTrue(ids.contains(convertToVertexId("peter")));
- assertTrue(ids.contains(convertToVertexId("josh")));
-
- for (Vertex vertex : cocreators) {
- if (vertex.id().equals(convertToVertexId("marko"))) {
- assertEquals(4, IteratorUtils.count(vertex.edges(Direction.OUT, "cocreator")));
- assertEquals(4, IteratorUtils.count(vertex.edges(Direction.IN, "cocreator")));
- } else {
- assertEquals(1, IteratorUtils.count(vertex.edges(Direction.OUT, "cocreator")));
- assertEquals(1, IteratorUtils.count(vertex.edges(Direction.IN, "cocreator")));
- }
- }
- }
-
- @Test
- @LoadGraphWith(MODERN)
- @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
- public void g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_aX() {
- final Traversal<Vertex, Vertex> traversal = get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_aX(convertToVertexId("marko"));
- printTraversalForm(traversal);
- int count = 0;
- while (traversal.hasNext()) {
- final Vertex vertex = traversal.next();
- assertEquals(convertToVertexId("lop"), vertex.id());
- assertEquals(1, IteratorUtils.count(vertex.vertices(Direction.OUT, "createdBy")));
- assertEquals(convertToVertexId("marko"), vertex.vertices(Direction.OUT, "createdBy").next().id());
- assertFalse(vertex.edges(Direction.OUT, "createdBy").next().properties().hasNext());
- count++;
-
- }
- assertEquals(1, count);
- }
-
- @Test
- @LoadGraphWith(MODERN)
- @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
- public void g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_a_weight_2X() {
- final Traversal<Vertex, Vertex> traversal = get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_a_weight_2X(convertToVertexId("marko"));
- printTraversalForm(traversal);
- int count = 0;
- while (traversal.hasNext()) {
- final Vertex vertex = traversal.next();
- assertEquals(convertToVertexId("lop"), vertex.id());
- assertEquals(1, IteratorUtils.count(vertex.vertices(Direction.OUT, "createdBy")));
- assertEquals(convertToVertexId("marko"), vertex.vertices(Direction.OUT, "createdBy").next().id());
- assertEquals(2, vertex.edges(Direction.OUT, "createdBy").next().values("weight").next());
- assertEquals(1, IteratorUtils.count(vertex.edges(Direction.OUT, "createdBy").next().properties()));
- count++;
-
-
- }
- assertEquals(1, count);
- }
-
- @UseEngine(TraversalEngine.Type.STANDARD)
- public static class Traversals extends AddEdgeTest {
-
- @Override
- public Traversal<Vertex, Vertex> get_g_VX1X_asXaX_outXcreatedX_inXcreatedX_addBothEXcocreator_aX(final Object v1Id) {
- return g.V(v1Id).as("a").out("created").in("created").addBothE("cocreator", "a");
- }
-
- @Override
- public Traversal<Vertex, Vertex> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_aX(final Object v1Id) {
- return g.V(v1Id).as("a").out("created").addOutE("createdBy", "a");
- }
-
- @Override
- public Traversal<Vertex, Vertex> get_g_VX1X_asXaX_outXcreatedX_addOutEXcreatedBy_a_weight_2X(final Object v1Id) {
- return g.V(v1Id).as("a").out("created").addOutE("createdBy", "a", "weight", 2);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4e2b979b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategyTest.java
index 7e290a6..aa2e67d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ReadOnlyStrategyTest.java
@@ -64,12 +64,6 @@ public class ReadOnlyStrategyTest extends AbstractGremlinProcessTest {
@Test
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
- public void shouldNotTraverseV_out_addBothE() {
- assertTraversal(create().V().as("a").out().addBothE("test", "a"), true);
- }
-
- @Test
- @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
public void shouldNotTraverseV_out_addInE() {
assertTraversal(create().V().as("a").out().addInE("test", "a"), true);
}
@@ -82,12 +76,6 @@ public class ReadOnlyStrategyTest extends AbstractGremlinProcessTest {
@Test
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
- public void shouldNotTraverseV_In_addBothE() {
- assertTraversal(create().V().as("a").in().addBothE("test", "a"), true);
- }
-
- @Test
- @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
public void shouldNotTraverseV_In_addInE() {
assertTraversal(create().V().as("a").in().addInE("test", "a"), true);
}
@@ -100,12 +88,6 @@ public class ReadOnlyStrategyTest extends AbstractGremlinProcessTest {
@Test
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
- public void shouldNotTraverseV_In_addEXBOTHX() {
- assertTraversal(create().V().as("a").in().addE(Direction.BOTH, "test", "a"), true);
- }
-
- @Test
- @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
public void shouldNotTraverseV_In_addEXINX() {
assertTraversal(create().V().as("a").in().addE(Direction.IN, "test", "a"), true);
}