Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1278 d175894d6 -> 47e71228f


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/47e71228/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversal.java
----------------------------------------------------------------------
diff --git 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversal.java
 
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversal.java
deleted file mode 100644
index 0245d5a..0000000
--- 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversal.java
+++ /dev/null
@@ -1,968 +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.variant;
-
-import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
-import org.apache.tinkerpop.gremlin.process.traversal.Order;
-import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.Path;
-import org.apache.tinkerpop.gremlin.process.traversal.Pop;
-import org.apache.tinkerpop.gremlin.process.traversal.Scope;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
-import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
-import org.apache.tinkerpop.gremlin.structure.Column;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
-import org.apache.tinkerpop.gremlin.util.ScriptEngineCache;
-
-import javax.script.Bindings;
-import javax.script.ScriptEngine;
-import javax.script.SimpleBindings;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.function.BiFunction;
-import java.util.function.Consumer;
-import java.util.function.Function;
-import java.util.function.Predicate;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class VariantGraphTraversal<S, E> extends DefaultGraphTraversal<S, E> {
-
-
-    public StringBuilder variantString;
-    protected VariantConverter variantConverter;
-
-    public VariantGraphTraversal(final Graph graph, final StringBuilder 
variantString, final VariantConverter variantConverter) {
-        super(graph);
-        this.variantConverter = variantConverter;
-        this.variantString = variantString;
-        __.EMPTY_GRAPH_TRAVERSAL = () -> {
-            final StringBuilder builder = new StringBuilder("__");
-            return new VariantGraphTraversal<>(EmptyGraph.instance(), builder, 
this.variantConverter);
-        };
-    }
-
-    public StringBuilder getVariantString() {
-        return this.variantString;
-    }
-
-    public String toString() {
-       return this.steps.isEmpty() ? this.variantString.toString() : 
super.toString();
-    }
-
-    @Override
-    public void applyStrategies() {
-        if (!(this.getParent() instanceof EmptyStep)) {
-            return;
-        }
-        try {
-            final String jythonString = 
this.variantConverter.generateGremlinGroovy(this.variantString);
-            __.EMPTY_GRAPH_TRAVERSAL = DefaultGraphTraversal::new;
-            ScriptEngine groovy = ScriptEngineCache.get("gremlin-groovy");
-            final Bindings groovyBindings = new SimpleBindings();
-            groovyBindings.put("g", new 
GraphTraversalSource(this.getGraph().get(), this.getStrategies()));
-            Traversal.Admin<S, E> traversal = (Traversal.Admin<S, E>) 
groovy.eval(jythonString, groovyBindings);
-            assert !traversal.isLocked();
-            this.sideEffects = traversal.getSideEffects();
-            this.strategies = traversal.getStrategies();
-            traversal.getSteps().forEach(step -> this.addStep(step));
-            super.applyStrategies();
-        } catch (final Exception e) {
-            throw new IllegalArgumentException(e.getMessage(), e);
-        }
-    }
-
-    private static String getMethodName() {
-        return Thread.currentThread().getStackTrace()[2].getMethodName();
-    }
-
-    //////////////////////////
-
-    public <E2> GraphTraversal<S, E2> map(final Function<Traverser<E>, E2> 
function) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
function);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> map(final Traversal<?, E2> mapTraversal) 
{
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
mapTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> flatMap(final Function<Traverser<E>, 
Iterator<E2>> function) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
function);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> flatMap(final Traversal<?, E2> 
flatMapTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
flatMapTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Object> id() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, String> label() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> identity() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> constant(final E2 e) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), e);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> V(final Object... vertexIdsOrElements) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
vertexIdsOrElements);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> to(final Direction direction, final 
String... edgeLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
direction, edgeLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> out(final String... edgeLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
edgeLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> in(final String... edgeLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
edgeLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> both(final String... edgeLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
edgeLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Edge> toE(final Direction direction, final 
String... edgeLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
direction, edgeLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Edge> outE(final String... edgeLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
edgeLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Edge> inE(final String... edgeLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
edgeLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Edge> bothE(final String... edgeLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
edgeLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> toV(final Direction direction) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
direction);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> inV() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> outV() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> bothV() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> otherV() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> order() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> order(final Scope scope) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, ? extends Property<E2>> properties(final 
String... propertyKeys) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
propertyKeys);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> values(final String... propertyKeys) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
propertyKeys);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, Map<String, E2>> propertyMap(final String... 
propertyKeys) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
propertyKeys);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, Map<String, E2>> valueMap(final String... 
propertyKeys) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
propertyKeys);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, Map<String, E2>> valueMap(final boolean 
includeTokens, final String... propertyKeys) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
includeTokens, propertyKeys);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, Collection<E2>> select(final Column column) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
column);
-        return (GraphTraversal) this;
-    }
-
-    @Deprecated
-    public <E2> GraphTraversal<S, E2> mapValues() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    @Deprecated
-    public <E2> GraphTraversal<S, E2> mapKeys() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, String> key() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> value() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Path> path() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, Map<String, E2>> match(final Traversal<?, 
?>... matchTraversals) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
matchTraversals);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> sack() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Integer> loops() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, Map<String, E2>> project(final String 
projectKey, final String... otherProjectKeys) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
projectKey, otherProjectKeys);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, Map<String, E2>> select(final Pop pop, final 
String selectKey1, final String selectKey2, String... otherSelectKeys) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
pop, selectKey1, selectKey2, otherSelectKeys);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, Map<String, E2>> select(final String 
selectKey1, final String selectKey2, String... otherSelectKeys) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
selectKey1, selectKey2, otherSelectKeys);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> select(final Pop pop, final String 
selectKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
pop, selectKey);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> select(final String selectKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
selectKey);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> unfold() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, List<E>> fold() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> fold(final E2 seed, final BiFunction<E2, 
E, E2> foldFunction) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
seed, foldFunction);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Long> count() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Long> count(final Scope scope) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope);
-        return (GraphTraversal) this;
-    }
-
-    public <E2 extends Number> GraphTraversal<S, E2> sum() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public <E2 extends Number> GraphTraversal<S, E2> sum(final Scope scope) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope);
-        return (GraphTraversal) this;
-    }
-
-    public <E2 extends Number> GraphTraversal<S, E2> max() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public <E2 extends Number> GraphTraversal<S, E2> max(final Scope scope) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope);
-        return (GraphTraversal) this;
-    }
-
-    public <E2 extends Number> GraphTraversal<S, E2> min() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public <E2 extends Number> GraphTraversal<S, E2> min(final Scope scope) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope);
-        return (GraphTraversal) this;
-    }
-
-    public <E2 extends Number> GraphTraversal<S, E2> mean() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public <E2 extends Number> GraphTraversal<S, E2> mean(final Scope scope) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope);
-        return (GraphTraversal) this;
-    }
-
-    public <K, V> GraphTraversal<S, Map<K, V>> group() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    @Deprecated
-    public <K, V> GraphTraversal<S, Map<K, V>> groupV3d0() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public <K> GraphTraversal<S, Map<K, Long>> groupCount() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Tree> tree() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> addV(final String vertexLabel) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
vertexLabel);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Vertex> addV() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    @Deprecated
-    public GraphTraversal<S, Vertex> addV(final Object... propertyKeyValues) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
propertyKeyValues);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Edge> addE(final String edgeLabel) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
edgeLabel);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> to(final String toStepLabel) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
toStepLabel);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> from(final String fromStepLabel) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
fromStepLabel);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> to(final Traversal<E, Vertex> toVertex) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
toVertex);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> from(final Traversal<E, Vertex> fromVertex) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
fromVertex);
-        return (GraphTraversal) this;
-    }
-
-    @Deprecated
-    public GraphTraversal<S, Edge> addE(final Direction direction, final 
String firstVertexKeyOrEdgeLabel, final String edgeLabelOrSecondVertexKey, 
final Object... propertyKeyValues) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
direction, firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey, 
propertyKeyValues);
-        return (GraphTraversal) this;
-    }
-
-    @Deprecated
-    public GraphTraversal<S, Edge> addOutE(final String 
firstVertexKeyOrEdgeLabel, final String edgeLabelOrSecondVertexKey, final 
Object... propertyKeyValues) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey, propertyKeyValues);
-        return (GraphTraversal) this;
-    }
-
-    @Deprecated
-    public GraphTraversal<S, Edge> addInE(final String 
firstVertexKeyOrEdgeLabel, final String edgeLabelOrSecondVertexKey, final 
Object... propertyKeyValues) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey, propertyKeyValues);
-        return (GraphTraversal) this;
-    }
-
-    ///////////////////// FILTER STEPS /////////////////////
-
-    public GraphTraversal<S, E> filter(final Predicate<Traverser<E>> 
predicate) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
predicate);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> filter(final Traversal<?, ?> filterTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
filterTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> or(final Traversal<?, ?>... orTraversals) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
orTraversals);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> and(final Traversal<?, ?>... andTraversals) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
andTraversals);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> inject(final E... injections) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
injections);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> dedup(final Scope scope, final String... 
dedupLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope, dedupLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> dedup(final String... dedupLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
dedupLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> where(final String startKey, final P<String> 
predicate) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
startKey, predicate);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> where(final P<String> predicate) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
predicate);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> where(final Traversal<?, ?> whereTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
whereTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> has(final String propertyKey, final P<?> 
predicate) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
propertyKey, predicate);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> has(final T accessor, final P<?> predicate) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
accessor, predicate);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> has(final String propertyKey, final Object 
value) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
propertyKey, value);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> has(final T accessor, final Object value) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
accessor, value);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> has(final String label, final String 
propertyKey, final P<?> predicate) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
label, propertyKey, predicate);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> has(final String label, final String 
propertyKey, final Object value) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
label, propertyKey, value);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> has(final T accessor, final Traversal<?, ?> 
propertyTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
accessor, propertyTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> has(final String propertyKey, final 
Traversal<?, ?> propertyTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
propertyKey, propertyTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> has(final String propertyKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
propertyKey);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> hasNot(final String propertyKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
propertyKey);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> hasLabel(final String... labels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
labels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> hasId(final Object... ids) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
ids);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> hasKey(final String... keys) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
keys);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> hasValue(final Object... values) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
values);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> is(final P<E> predicate) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
predicate);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> is(final Object value) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
value);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> not(final Traversal<?, ?> notTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
notTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> coin(final double probability) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
probability);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> range(final long low, final long high) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
low, high);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> range(final Scope scope, final long low, 
final long high) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope, low, high);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> limit(final long limit) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
limit);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> limit(final Scope scope, final long 
limit) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope, limit);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> tail() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> tail(final long limit) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
limit);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> tail(final Scope scope) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> tail(final Scope scope, final long 
limit) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope, limit);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> timeLimit(final long timeLimit) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
timeLimit);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> simplePath() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> cyclicPath() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> sample(final int amountToSample) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
amountToSample);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> sample(final Scope scope, final int 
amountToSample) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
scope, amountToSample);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> drop() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    ///////////////////// SIDE-EFFECT STEPS /////////////////////
-
-    public GraphTraversal<S, E> sideEffect(final Consumer<Traverser<E>> 
consumer) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
consumer);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> sideEffect(final Traversal<?, ?> 
sideEffectTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sideEffectTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> cap(final String sideEffectKey, final 
String... sideEffectKeys) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sideEffectKey, sideEffectKeys);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, Edge> subgraph(final String sideEffectKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sideEffectKey);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> aggregate(final String sideEffectKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sideEffectKey);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> group(final String sideEffectKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sideEffectKey);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> groupV3d0(final String sideEffectKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sideEffectKey);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> groupCount(final String sideEffectKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sideEffectKey);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> tree(final String sideEffectKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sideEffectKey);
-        return (GraphTraversal) this;
-    }
-
-    public <V, U> GraphTraversal<S, E> sack(final BiFunction<V, U, V> 
sackOperator) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sackOperator);
-        return (GraphTraversal) this;
-    }
-
-
-    @Deprecated
-    public <V, U> GraphTraversal<S, E> sack(final BiFunction<V, U, V> 
sackOperator, final String elementPropertyKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sackOperator, elementPropertyKey);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> store(final String sideEffectKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sideEffectKey);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> profile(final String sideEffectKey) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
sideEffectKey);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> property(final VertexProperty.Cardinality 
cardinality, final Object key, final Object value, final Object... keyValues) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
cardinality, key, value, keyValues);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> property(final Object key, final Object value, 
final Object... keyValues) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
key, value, keyValues);
-        return (GraphTraversal) this;
-    }
-
-    ///////////////////// BRANCH STEPS /////////////////////
-
-    public <M, E2> GraphTraversal<S, E2> branch(final Traversal<?, M> 
branchTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
branchTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public <M, E2> GraphTraversal<S, E2> branch(final Function<Traverser<E>, 
M> function) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
function);
-        return (GraphTraversal) this;
-    }
-
-    public <M, E2> GraphTraversal<S, E2> choose(final Traversal<?, M> 
choiceTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
choiceTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> choose(final Traversal<?, ?> 
traversalPredicate,
-                                             final Traversal<?, E2> 
trueChoice, final Traversal<?, E2> falseChoice) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
traversalPredicate, trueChoice, falseChoice);
-        return (GraphTraversal) this;
-    }
-
-    public <M, E2> GraphTraversal<S, E2> choose(final Function<E, M> 
choiceFunction) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
choiceFunction);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> choose(final Predicate<E> 
choosePredicate,
-                                             final Traversal<?, E2> 
trueChoice, final Traversal<?, E2> falseChoice) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
choosePredicate, trueChoice, falseChoice);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> optional(final Traversal<?, E2> 
optionalTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
optionalTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> union(final Traversal<?, E2>... 
unionTraversals) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
unionTraversals);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> coalesce(final Traversal<?, E2>... 
coalesceTraversals) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
coalesceTraversals);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> repeat(final Traversal<?, E> repeatTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
repeatTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> emit(final Traversal<?, ?> emitTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
emitTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> emit(final Predicate<Traverser<E>> 
emitPredicate) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
emitPredicate);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> emit() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> until(final Traversal<?, ?> untilTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
untilTraversal);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> until(final Predicate<Traverser<E>> 
untilPredicate) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
untilPredicate);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> times(final int maxLoops) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
maxLoops);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E2> local(final Traversal<?, E2> 
localTraversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
localTraversal);
-        return (GraphTraversal) this;
-    }
-
-    /////////////////// VERTEX PROGRAM STEPS ////////////////
-
-    public GraphTraversal<S, E> pageRank() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> pageRank(final double alpha) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
alpha);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> peerPressure() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> program(final VertexProgram<?> vertexProgram) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
vertexProgram);
-        return (GraphTraversal) this;
-    }
-
-    ///////////////////// UTILITY STEPS /////////////////////
-
-    public GraphTraversal<S, E> as(final String stepLabel, final String... 
stepLabels) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
stepLabel, stepLabels);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> barrier() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> barrier(final int maxBarrierSize) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
maxBarrierSize);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> barrier(final Consumer<TraverserSet<Object>> 
barrierConsumer) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
barrierConsumer);
-        return (GraphTraversal) this;
-    }
-
-
-    //// BY-MODULATORS
-
-    public GraphTraversal<S, E> by() {
-        this.variantConverter.addStep(this.variantString, getMethodName());
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> by(final Traversal<?, ?> traversal) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
traversal);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> by(final T token) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
token);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> by(final String key) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
key);
-        return (GraphTraversal) this;
-    }
-
-    public <V> GraphTraversal<S, E> by(final Function<V, Object> function) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
function);
-        return (GraphTraversal) this;
-    }
-
-    //// COMPARATOR BY-MODULATORS
-
-    public <V> GraphTraversal<S, E> by(final Traversal<?, ?> traversal, final 
Comparator<V> comparator) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
traversal, comparator);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> by(final Comparator<E> comparator) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
comparator);
-        return (GraphTraversal) this;
-    }
-
-    public GraphTraversal<S, E> by(final Order order) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
order);
-        return (GraphTraversal) this;
-    }
-
-    public <V> GraphTraversal<S, E> by(final String key, final Comparator<V> 
comparator) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
key, comparator);
-        return (GraphTraversal) this;
-    }
-
-    public <U> GraphTraversal<S, E> by(final Function<U, Object> function, 
final Comparator comparator) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
function, comparator);
-        return (GraphTraversal) this;
-    }
-
-    ////
-
-    public <M, E2> GraphTraversal<S, E> option(final M pickToken, final 
Traversal<E, E2> traversalOption) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
pickToken, traversalOption);
-        return (GraphTraversal) this;
-    }
-
-    public <E2> GraphTraversal<S, E> option(final Traversal<E, E2> 
traversalOption) {
-        this.variantConverter.addStep(this.variantString, getMethodName(), 
traversalOption);
-        return (GraphTraversal) this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/47e71228/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSource.java
----------------------------------------------------------------------
diff --git 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSource.java
 
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSource.java
deleted file mode 100644
index 9e4382f..0000000
--- 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSource.java
+++ /dev/null
@@ -1,219 +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.variant;
-
-import org.apache.tinkerpop.gremlin.process.computer.Computer;
-import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import 
org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStartStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Transaction;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-import java.util.function.BinaryOperator;
-import java.util.function.Supplier;
-import java.util.function.UnaryOperator;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class VariantGraphTraversalSource extends GraphTraversalSource {
-
-    private VariantConverter variantConverter;
-    private StringBuilder sourceString = new StringBuilder("g");
-
-    public VariantGraphTraversalSource(final VariantConverter 
variantConverter, final Graph graph, final TraversalStrategies 
traversalStrategies) {
-        super(graph, traversalStrategies);
-        this.variantConverter = variantConverter;
-    }
-
-    private static String getMethodName() {
-        return Thread.currentThread().getStackTrace()[2].getMethodName();
-    }
-
-    ///
-
-    @Override
-    public GraphTraversal<Edge, Edge> E(final Object... edgeIds) {
-        final StringBuilder temp = new 
StringBuilder(this.sourceString.toString());
-        this.variantConverter.addStep(temp, getMethodName(), edgeIds);
-        return new VariantGraphTraversal<>(this.getGraph(), temp, 
this.variantConverter);
-    }
-
-    @Override
-    public GraphTraversal<Vertex, Vertex> V(final Object... vertexIds) {
-        final StringBuilder temp = new 
StringBuilder(this.sourceString.toString());
-        this.variantConverter.addStep(temp, getMethodName(), vertexIds);
-        return new VariantGraphTraversal<>(this.getGraph(), temp, 
this.variantConverter);
-    }
-
-    @Deprecated
-    public GraphTraversal<Vertex, Vertex> addV(final Object... keyValues) {
-        final StringBuilder temp = new 
StringBuilder(this.sourceString.toString());
-        this.variantConverter.addStep(temp, getMethodName(), keyValues);
-        return new VariantGraphTraversal<>(this.getGraph(), temp, 
this.variantConverter);
-    }
-
-    public GraphTraversal<Vertex, Vertex> addV(final String label) {
-        final StringBuilder temp = new 
StringBuilder(this.sourceString.toString());
-        this.variantConverter.addStep(temp, getMethodName(), label);
-        return new VariantGraphTraversal<>(this.getGraph(), temp, 
this.variantConverter);
-    }
-
-    public GraphTraversal<Vertex, Vertex> addV() {
-        final StringBuilder temp = new 
StringBuilder(this.sourceString.toString());
-        this.variantConverter.addStep(temp, getMethodName());
-        return new VariantGraphTraversal<>(this.getGraph(), temp, 
this.variantConverter);
-    }
-
-    public <S> GraphTraversal<S, S> inject(S... starts) {
-        final StringBuilder temp = new 
StringBuilder(this.sourceString.toString());
-        this.variantConverter.addStep(temp, getMethodName(), starts);
-        return new VariantGraphTraversal<>(this.getGraph(), temp, 
this.variantConverter);
-    }
-
-    ///
-
-    @Override
-    public GraphTraversalSource withComputer(final Computer computer) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
computer);
-        return this;
-    }
-
-    @Override
-    public GraphTraversalSource withComputer(final Class<? extends 
GraphComputer> graphComputerClass) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
graphComputerClass);
-        return this;
-    }
-
-    @Override
-    public GraphTraversalSource withComputer() {
-        this.variantConverter.addStep(this.sourceString, getMethodName());
-        return this;
-    }
-
-    @Override
-    public GraphTraversalSource withStrategies(final TraversalStrategy... 
traversalStrategies) {
-        return super.withStrategies(traversalStrategies);
-        //this.variantConverter.addStep(this.sourceString, getMethodName(), 
traversalStrategies);
-        //return this;
-    }
-
-    @Override
-    @SuppressWarnings({"unchecked", "varargs"})
-    public GraphTraversalSource withoutStrategies(final Class<? extends 
TraversalStrategy>... traversalStrategyClasses) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
traversalStrategyClasses);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSack(final Supplier<A> initialValue, 
final UnaryOperator<A> splitOperator, final BinaryOperator<A> mergeOperator) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
splitOperator, mergeOperator);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSack(final A initialValue, final 
UnaryOperator<A> splitOperator, final BinaryOperator<A> mergeOperator) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
initialValue, splitOperator, mergeOperator);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSack(final A initialValue) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
initialValue);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSack(final Supplier<A> initialValue) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
initialValue);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSack(final Supplier<A> initialValue, 
final UnaryOperator<A> splitOperator) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
initialValue, splitOperator);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSack(final A initialValue, final 
UnaryOperator<A> splitOperator) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
initialValue, splitOperator);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSack(final Supplier<A> initialValue, 
final BinaryOperator<A> mergeOperator) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
initialValue, mergeOperator);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSack(final A initialValue, final 
BinaryOperator<A> mergeOperator) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
initialValue, mergeOperator);
-        return this;
-    }
-
-    /////
-
-    @Override
-    public <A> GraphTraversalSource withSideEffect(final String key, final 
Supplier<A> initialValue, final BinaryOperator<A> reducer) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), key, 
initialValue, reducer);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSideEffect(final String key, final A 
initialValue, final BinaryOperator<A> reducer) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), key, 
initialValue, reducer);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSideEffect(final String key, final A 
initialValue) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), key, 
initialValue);
-        return this;
-    }
-
-    @Override
-    public <A> GraphTraversalSource withSideEffect(final String key, final 
Supplier<A> initialValue) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), key, 
initialValue);
-        return this;
-    }
-
-    /////
-
-    @Override
-    public GraphTraversalSource withBulk(final boolean useBulk) {
-        this.variantConverter.addStep(this.sourceString, getMethodName(), 
useBulk);
-        return this;
-    }
-
-    @Override
-    public GraphTraversalSource withPath() {
-        this.variantConverter.addStep(this.sourceString, getMethodName());
-        return this;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/47e71228/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSourceTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSourceTest.java
 
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSourceTest.java
deleted file mode 100644
index 672eeca..0000000
--- 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalSourceTest.java
+++ /dev/null
@@ -1,56 +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.variant;
-
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.junit.Test;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class VariantGraphTraversalSourceTest {
-
-    private static Set<String> NO_GRAPH = new HashSet<>(Arrays.asList("clone", 
"iterate"));
-
-    @Test
-    public void 
variantGraphTraversalSourceShouldHaveMethodsOfGraphTraversalSource() {
-        for (Method methodA : GraphTraversalSource.class.getMethods()) {
-            if 
((GraphTraversal.class.isAssignableFrom(methodA.getReturnType()) || 
GraphTraversalSource.class.isAssignableFrom(methodA.getReturnType())) && 
!NO_GRAPH.contains(methodA.getName())) {
-                boolean found = false;
-                final String methodAName = methodA.getName();
-                final String methodAParameters = 
Arrays.asList(methodA.getParameterTypes()).toString();
-                for (final Method methodB : 
VariantGraphTraversalSource.class.getDeclaredMethods()) {
-                    final String methodBName = methodB.getName();
-                    final String methodBParameters = 
Arrays.asList(methodB.getParameterTypes()).toString();
-                    if (methodAName.equals(methodBName) && 
methodAParameters.equals(methodBParameters))
-                        found = true;
-                }
-                if (!found)
-                    throw new 
IllegalStateException(VariantGraphTraversal.class.getSimpleName() + " is 
missing the following method: " + methodAName + ":" + methodAParameters);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/47e71228/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalTest.java
 
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalTest.java
deleted file mode 100644
index fd4ad0d..0000000
--- 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/VariantGraphTraversalTest.java
+++ /dev/null
@@ -1,56 +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.variant;
-
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.junit.Test;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class VariantGraphTraversalTest {
-
-    private static Set<String> NO_GRAPH = new 
HashSet<>(Arrays.asList("asAdmin","iterate"));
-
-    @Test
-    public void variantGraphTraversalShouldHaveMethodsOfGraphTraversal() {
-        for (Method methodA : GraphTraversal.class.getMethods()) {
-            if (GraphTraversal.class.isAssignableFrom(methodA.getReturnType()) 
&& !NO_GRAPH.contains(methodA.getName())) {
-                boolean found = false;
-                final String methodAName = methodA.getName();
-                final String methodAParameters = 
Arrays.asList(methodA.getParameterTypes()).toString();
-                for (final Method methodB : 
VariantGraphTraversal.class.getDeclaredMethods()) {
-                    final String methodBName = methodB.getName();
-                    final String methodBParameters = 
Arrays.asList(methodB.getParameterTypes()).toString();
-                    if (methodAName.equals(methodBName) && 
methodAParameters.equals(methodBParameters))
-                        found = true;
-                }
-                if (!found)
-                    throw new 
IllegalStateException(VariantGraphTraversal.class.getSimpleName() + " is 
missing the following method: " + methodAName + ":" + methodAParameters);
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/47e71228/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
----------------------------------------------------------------------
diff --git 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
 
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
index 067f3c8..2b2aeb0 100644
--- 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
+++ 
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonProvider.java
@@ -20,8 +20,8 @@
 package org.apache.tinkerpop.gremlin.process.variant.python;
 
 import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.script.ScriptGraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.variant.VariantGraphProvider;
-import 
org.apache.tinkerpop.gremlin.process.variant.VariantGraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 
 /**
@@ -34,7 +34,7 @@ public class PythonProvider extends VariantGraphProvider {
             return graph.traversal();
             //throw new VerificationException("This test current does not work 
with Gremlin-Python", EmptyTraversal.instance());
         else
-            return new VariantGraphTraversalSource(new 
PythonVariantConverter(), graph, graph.traversal().getStrategies());
+            return new ScriptGraphTraversalSource(graph, 
graph.traversal().getStrategies(), new PythonTranslator("gremlin-groovy", "g"));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/47e71228/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonVariantConverter.java
----------------------------------------------------------------------
diff --git 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonVariantConverter.java
 
b/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonVariantConverter.java
deleted file mode 100644
index d488bed..0000000
--- 
a/gremlin-variant/src/test/java/org/apache/tinkerpop/gremlin/process/variant/python/PythonVariantConverter.java
+++ /dev/null
@@ -1,206 +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.variant.python;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Operator;
-import org.apache.tinkerpop.gremlin.process.traversal.Order;
-import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.Pop;
-import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
-import org.apache.tinkerpop.gremlin.process.traversal.Scope;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import 
org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.VerificationException;
-import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
-import org.apache.tinkerpop.gremlin.process.traversal.util.EmptyTraversal;
-import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
-import org.apache.tinkerpop.gremlin.process.variant.VariantConverter;
-import org.apache.tinkerpop.gremlin.process.variant.VariantGraphTraversal;
-import org.apache.tinkerpop.gremlin.structure.Column;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Element;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.apache.tinkerpop.gremlin.util.ScriptEngineCache;
-import org.apache.tinkerpop.gremlin.util.iterator.ArrayIterator;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import javax.script.SimpleBindings;
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class PythonVariantConverter implements VariantConverter {
-
-    private static ScriptEngine JYTHON_ENGINE = 
ScriptEngineCache.get("jython");
-    private static boolean IMPORT_STATICS = new Random().nextBoolean();
-
-    static {
-        try {
-            final String rootPackageName = (new 
File("gremlin-variant").exists() ? "gremlin-variant/" : "") + 
"src/main/jython/";
-            final String gremlinPythonPackageName = rootPackageName + 
"/gremlin_python";
-            final String gremlinDriverPackageName = rootPackageName + 
"/gremlin_driver";
-            final String gremlinPythonModuleName = gremlinPythonPackageName + 
"/gremlin_python.py";
-            GremlinPythonGenerator.create(gremlinPythonModuleName);
-            JYTHON_ENGINE.eval("import sys");
-            JYTHON_ENGINE.eval("sys.path.append('" + gremlinPythonPackageName 
+ "')");
-            JYTHON_ENGINE.eval("sys.path.append('" + gremlinDriverPackageName 
+ "')");
-            JYTHON_ENGINE.eval("from gremlin_python import *");
-            JYTHON_ENGINE.eval("from gremlin_python import __");
-            if (IMPORT_STATICS)
-                JYTHON_ENGINE.eval("for k in statics:\n  globals()[k] = 
statics[k]");
-        } catch (final ScriptException e) {
-            throw new IllegalStateException(e.getMessage(), e);
-        }
-    }
-
-    private static final Set<String> STEP_NAMES = 
Stream.of(GraphTraversal.class.getMethods()).filter(method -> 
Traversal.class.isAssignableFrom(method.getReturnType())).map(Method::getName).collect(Collectors.toSet());
-    private static final Set<String> PREFIX_NAMES = new 
HashSet<>(Arrays.asList("as", "in", "and", "or", "is", "not", "from", 
"global"));
-    private static final Set<String> NO_STATIC = Stream.of(T.values(), 
Operator.values())
-            .flatMap(arg -> IteratorUtils.stream(new ArrayIterator<>(arg)))
-            .map(arg -> ((Enum) arg).name())
-            .collect(Collectors.toCollection(() -> new 
HashSet<>(Arrays.asList("not"))));
-
-
-    public String generateGremlinGroovy(final StringBuilder currentTraversal) 
throws ScriptException {
-        //if (IMPORT_STATICS) assert 
!currentTraversal.toString().contains("__");
-        if (currentTraversal.toString().contains("$"))
-            throw new VerificationException("Lambdas are currently not 
supported: " + currentTraversal.toString(), EmptyTraversal.instance());
-
-        final Bindings jythonBindings = new SimpleBindings();
-        jythonBindings.put("g", 
JYTHON_ENGINE.eval("PythonGraphTraversalSource(\"g\", None)"));
-        JYTHON_ENGINE.getContext().setBindings(jythonBindings, 
ScriptContext.GLOBAL_SCOPE);
-        return JYTHON_ENGINE.eval(currentTraversal.toString()).toString();
-    }
-
-    @Override
-    public void addStep(final StringBuilder currentTraversal, final String 
stepName, final Object... arguments) {
-        // flatten the arguments into a single array
-        final Object[] objects = Stream.of(arguments)
-                .flatMap(arg ->
-                        IteratorUtils.stream(arg instanceof Object[] ?
-                                new ArrayIterator<>((Object[]) arg) :
-                                IteratorUtils.of(arg)))
-                .toArray();
-        if (objects.length == 0)
-            
currentTraversal.append(".").append(convertStepName(stepName)).append("()");
-        else if (stepName.equals("range") && 2 == objects.length)
-            
currentTraversal.append("[").append(objects[0]).append(":").append(objects[1]).append("]");
-        else if (stepName.equals("limit") && 1 == objects.length)
-            currentTraversal.append("[0:").append(objects[0]).append("]");
-        else if (stepName.equals("values") && 1 == objects.length && 
!currentTraversal.toString().equals("__") && 
!STEP_NAMES.contains(objects[0].toString()))
-            currentTraversal.append(".").append(objects[0]);
-        else {
-            currentTraversal.append(".");
-            String temp = convertStepName(stepName) + "(";
-            for (final Object object : objects) {
-                temp = temp + convertToString(object) + ",";
-            }
-            currentTraversal.append(temp.substring(0, temp.length() - 1) + 
")");
-        }
-        if (IMPORT_STATICS && currentTraversal.toString().startsWith("__.")
-                && !NO_STATIC.stream().filter(name -> 
currentTraversal.toString().contains(name)).findAny().isPresent())
-            currentTraversal.delete(0, 3);
-        if (!IMPORT_STATICS)
-            assert currentTraversal.toString().startsWith("g.") || 
currentTraversal.toString().startsWith("__.");
-    }
-
-    private static String convertToString(final Object object) {
-        if (object instanceof String)
-            return "\"" + object + "\"";
-        else if (object instanceof List) {
-            final List list = new ArrayList<>(((List) object).size());
-            for (final Object item : (List) object) {
-                list.add(item instanceof String ? "'" + item + "'" : 
convertToString(item)); // hack
-            }
-            return list.toString();
-        } else if (object instanceof Long)
-            return object + "L";
-        else if (object instanceof Class)
-            return ((Class) object).getCanonicalName();
-        else if (object instanceof SackFunctions.Barrier)
-            return convertStatic("Barrier.") + object.toString();
-        else if (object instanceof VertexProperty.Cardinality)
-            return "Cardinality." + object.toString();
-        else if (object instanceof Direction)
-            return convertStatic("Direction.") + object.toString();
-        else if (object instanceof Operator)
-            return convertStatic("Operator.") + 
convertStepName(object.toString()); // to catch and/or
-        else if (object instanceof Pop)
-            return convertStatic("Pop.") + object.toString();
-        else if (object instanceof Column)
-            return convertStatic("Column.") + object.toString();
-        else if (object instanceof P)
-            return convertPToString((P) object, new 
StringBuilder()).toString();
-        else if (object instanceof T)
-            return convertStatic("T.") + object.toString();
-        else if (object instanceof Order)
-            return convertStatic("Order.") + object.toString();
-        else if (object instanceof Scope)
-            return convertStatic("Scope.") + 
convertStepName(object.toString()); // to catch global
-        else if (object instanceof Element)
-            return convertToString(((Element) object).id()); // hack
-        else if (object instanceof VariantGraphTraversal)
-            return ((VariantGraphTraversal) 
object).getVariantString().toString();
-        else if (object instanceof Boolean)
-            return object.equals(Boolean.TRUE) ? "True" : "False";
-        else
-            return null == object ? "" : object.toString();
-    }
-
-    private static String convertStatic(final String name) {
-        return IMPORT_STATICS ? "" : name;
-    }
-
-    private static String convertStepName(final String stepName) {
-        if (PREFIX_NAMES.contains(stepName))
-            return "_" + stepName;
-        else
-            return stepName;
-    }
-
-    private static StringBuilder convertPToString(final P p, final 
StringBuilder current) {
-        if (p instanceof ConnectiveP) {
-            final List<P<?>> list = ((ConnectiveP) p).getPredicates();
-            for (int i = 0; i < list.size(); i++) {
-                convertPToString(list.get(i), current);
-                if (i < list.size() - 1)
-                    current.append(p instanceof OrP ? "._or(" : "._and(");
-            }
-            current.append(")");
-        } else
-            
current.append(convertStatic("P.")).append(p.getBiPredicate().toString()).append("(").append(convertToString(p.getValue())).append(")");
-        return current;
-    }
-}

Reply via email to