You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2018/06/15 12:17:51 UTC

[01/50] tinkerpop git commit: Merge branch 'tp33' [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1878 a6e59cf3b -> c1093c106 (forced update)


Merge branch 'tp33'


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

Branch: refs/heads/TINKERPOP-1878
Commit: 0e17304063078df378c62c4596edb1de3ffa1524
Parents: d7843fe d7b756b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jun 4 17:04:28 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 4 17:04:28 2018 -0400

----------------------------------------------------------------------
 .../traversal/step/map/PropertyElementStep.java | 48 --------------------
 1 file changed, 48 deletions(-)
----------------------------------------------------------------------



[21/50] tinkerpop git commit: Fixed spacing error in CHANGELOG CTR

Posted by sp...@apache.org.
Fixed spacing error in CHANGELOG CTR


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

Branch: refs/heads/TINKERPOP-1878
Commit: 61238bfe6f4d5710d796e3b520157b86036af4d4
Parents: 4a7cdb5
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jun 13 06:05:10 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jun 13 06:05:10 2018 -0400

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/61238bfe/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e74d6a6..5e36f57 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -38,7 +38,7 @@ This release also includes changes from <<release-3-3-3, 3.3.3>>.
 * Changed the order of `select()` scopes. The order is now: maps, side-effects, paths.
 * Removed previously deprecated Credentials DSL infrastructure.
 * Moved `TraversalEngine` to `gremlin-test` as it has long been only used in testing infrastructure.
-* Events from `EventStrategy`raised from "new" mutations will now return a true "empty" property from `VertexProperty.empty()` or `Property.empty()` as is appropriate.
+* Events from `EventStrategy` raised from "new" mutations will now return a true "empty" property from `VertexProperty.empty()` or `Property.empty()` as is appropriate.
 * `MutationListener#vertexPropertyChanged(Vertex, VertexProperty, Object, Object...)` no longer has a default implementation.
 * Removed previously deprecated `MutationListener#vertexPropertyChanged(Vertex, Property, Object, Object...)`.
 * Removed previously deprecated `OpSelectorHandler` constructor.


[44/50] tinkerpop git commit: TINKERPOP-1878 Added the plugin for sparql-gremlin

Posted by sp...@apache.org.
TINKERPOP-1878 Added the plugin for sparql-gremlin


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

Branch: refs/heads/TINKERPOP-1878
Commit: 69d60592782f7c4ee18e94df37c0b71f7ebc0899
Parents: 3328611
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jan 29 09:37:15 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 .../sparql/jsr223/SparqlGremlinPlugin.java      | 63 ++++++++++++++++++++
 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin |  1 +
 2 files changed, 64 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69d60592/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/jsr223/SparqlGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/jsr223/SparqlGremlinPlugin.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/jsr223/SparqlGremlinPlugin.java
new file mode 100644
index 0000000..8d0115b
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/jsr223/SparqlGremlinPlugin.java
@@ -0,0 +1,63 @@
+/*
+ * 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.sparql.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.sparql.process.traversal.dsl.sparql.DefaultSparqlTraversal;
+import org.apache.tinkerpop.gremlin.sparql.process.traversal.dsl.sparql.SparqlTraversal;
+import org.apache.tinkerpop.gremlin.sparql.process.traversal.dsl.sparql.SparqlTraversalSource;
+import org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy.SparqlStrategy;
+
+/**
+ * {@link GremlinPlugin} implementation for {@code sparql-gremlin} that imports the key classes and interfaces required
+ * to use SPARQL in TinkerPop.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class SparqlGremlinPlugin extends AbstractGremlinPlugin {
+
+    private static final String NAME = "tinkerpop.sparql";
+
+    private static final ImportCustomizer imports;
+
+    static {
+        try {
+            imports = DefaultImportCustomizer.build().addClassImports(
+                    SparqlTraversalSource.class,
+                    SparqlTraversal.class,
+                    DefaultSparqlTraversal.class,
+                    SparqlStrategy.class).create();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private static final SparqlGremlinPlugin instance = new SparqlGremlinPlugin();
+
+    public SparqlGremlinPlugin() {
+        super(NAME, imports);
+    }
+
+    public static SparqlGremlinPlugin instance() {
+        return instance;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69d60592/sparql-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/sparql-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
new file mode 100644
index 0000000..882054c
--- /dev/null
+++ b/sparql-gremlin/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
@@ -0,0 +1 @@
+org.apache.tinkerpop.gremlin.sparql.jsr223.SparqlGremlinPlugin
\ No newline at end of file


[04/50] tinkerpop git commit: Merge branch 'tp33'

Posted by sp...@apache.org.
Merge branch 'tp33'


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

Branch: refs/heads/TINKERPOP-1878
Commit: d5b54fe0fdb8a60d7af28702649896fdce94826d
Parents: 0e17304 a0b7ce5
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jun 5 08:18:45 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jun 5 08:18:45 2018 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java   | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------



[24/50] tinkerpop git commit: TINKERPOP-1878 Code reformatting - bad spacing/tabs or something

Posted by sp...@apache.org.
TINKERPOP-1878 Code reformatting - bad spacing/tabs or something


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

Branch: refs/heads/TINKERPOP-1878
Commit: 5ec45f1f229ede5e08864bc33cc1104e6b32a51e
Parents: 48b263f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 26 16:03:49 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 .../sparql/SparqlToGremlinTranspiler.java       | 138 +++++++++----------
 1 file changed, 69 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ec45f1f/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
index c3bc907..1b28a1d 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
@@ -55,59 +55,59 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
  */
 public class SparqlToGremlinTranspiler {
 
-	private GraphTraversal<Vertex, ?> traversal;
+    private GraphTraversal<Vertex, ?> traversal;
 
     private List<Traversal> traversalList = new ArrayList<>();
 
-	private SparqlToGremlinTranspiler(final GraphTraversal<Vertex, ?> traversal) {
-		this.traversal = traversal;
-	}
+    private SparqlToGremlinTranspiler(final GraphTraversal<Vertex, ?> traversal) {
+        this.traversal = traversal;
+    }
 
-	private SparqlToGremlinTranspiler(final GraphTraversalSource g) {
-		this(g.V());
-	}
+    private SparqlToGremlinTranspiler(final GraphTraversalSource g) {
+        this(g.V());
+    }
 
     /**
      * Converts SPARQL to a Gremlin traversal.
      *
-     * @param graph the {@link Graph} instance to execute the traversal from
+     * @param graph       the {@link Graph} instance to execute the traversal from
      * @param sparqlQuery the query to transpile to Gremlin
      */
     public static GraphTraversal<Vertex, ?> transpile(final Graph graph, final String sparqlQuery) {
-        return transpile(graph.traversal(),	sparqlQuery);
+        return transpile(graph.traversal(), sparqlQuery);
     }
 
     /**
      * Converts SPARQL to a Gremlin traversal.
      *
-     * @param g the {@link GraphTraversalSource} instance to execute the traversal from
+     * @param g           the {@link GraphTraversalSource} instance to execute the traversal from
      * @param sparqlQuery the query to transpile to Gremlin
      */
     public static GraphTraversal<Vertex, ?> transpile(final GraphTraversalSource g, final String sparqlQuery) {
         return transpile(g, QueryFactory.create(Prefixes.prepend(sparqlQuery), Syntax.syntaxSPARQL));
     }
 
-	private GraphTraversal<Vertex, ?> transpile(final Query query) {
-		final Op op = Algebra.compile(query);
-		OpWalker.walk(op, new GremlinOpVisitor());
+    private GraphTraversal<Vertex, ?> transpile(final Query query) {
+        final Op op = Algebra.compile(query);
+        OpWalker.walk(op, new GremlinOpVisitor());
 
-		int traversalIndex = 0;
-		final int numberOfTraversal = traversalList.size();
+        int traversalIndex = 0;
+        final int numberOfTraversal = traversalList.size();
         final Traversal arrayOfAllTraversals[] = new Traversal[numberOfTraversal];
 
-		for (Traversal tempTrav : traversalList) {
-			arrayOfAllTraversals[traversalIndex++] = tempTrav;
-		}
+        for (Traversal tempTrav : traversalList) {
+            arrayOfAllTraversals[traversalIndex++] = tempTrav;
+        }
 
-		// creates a map of ordering keys and their ordering direction
+        // creates a map of ordering keys and their ordering direction
         final Map<String, Order> orderingIndex = createOrderIndexFromQuery(query);
 
-		if (traversalList.size() > 0)
-			traversal = traversal.match(arrayOfAllTraversals);
+        if (traversalList.size() > 0)
+            traversal = traversal.match(arrayOfAllTraversals);
 
-		final List<String> vars = query.getResultVars();
-		if (!query.isQueryResultStar() && !query.hasGroupBy()) {
-		    // the result sizes have special handling to get the right signatures of select() called. perhaps this
+        final List<String> vars = query.getResultVars();
+        if (!query.isQueryResultStar() && !query.hasGroupBy()) {
+            // the result sizes have special handling to get the right signatures of select() called. perhaps this
             // could be refactored to work more nicely
             switch (vars.size()) {
                 case 0:
@@ -116,7 +116,7 @@ public class SparqlToGremlinTranspiler {
                     if (query.isDistinct())
                         traversal = traversal.dedup(vars.get(0));
 
-                    orderingIndex.forEach((k,v) -> traversal = traversal.order().by(__.select(k), v));
+                    orderingIndex.forEach((k, v) -> traversal = traversal.order().by(__.select(k), v));
                     traversal = traversal.select(vars.get(0));
 
                     break;
@@ -124,7 +124,7 @@ public class SparqlToGremlinTranspiler {
                     if (query.isDistinct())
                         traversal = traversal.dedup(vars.get(0), vars.get(1));
 
-                    orderingIndex.forEach((k,v) -> traversal = traversal.order().by(__.select(k), v));
+                    orderingIndex.forEach((k, v) -> traversal = traversal.order().by(__.select(k), v));
                     traversal = traversal.select(vars.get(0), vars.get(1));
 
                     break;
@@ -134,7 +134,7 @@ public class SparqlToGremlinTranspiler {
                     if (query.isDistinct())
                         traversal = traversal.dedup(all);
 
-                    orderingIndex.forEach((k,v) -> traversal = traversal.order().by(__.select(k), v));
+                    orderingIndex.forEach((k, v) -> traversal = traversal.order().by(__.select(k), v));
 
                     // just some shenanigans to get the right signature of select() called
                     final String[] others = Arrays.copyOfRange(all, 2, vars.size());
@@ -142,59 +142,59 @@ public class SparqlToGremlinTranspiler {
 
                     break;
             }
-		}
-
-		if (query.hasGroupBy()) {
-			final VarExprList lstExpr = query.getGroupBy();
-			String grpVar = "";
-			for (Var expr : lstExpr.getVars()) {
-				grpVar = expr.getName();
-			}
-
-			if (!grpVar.isEmpty())
-				traversal = traversal.select(grpVar);
-			if (query.hasAggregators()) {
+        }
+
+        if (query.hasGroupBy()) {
+            final VarExprList lstExpr = query.getGroupBy();
+            String grpVar = "";
+            for (Var expr : lstExpr.getVars()) {
+                grpVar = expr.getName();
+            }
+
+            if (!grpVar.isEmpty())
+                traversal = traversal.select(grpVar);
+            if (query.hasAggregators()) {
                 final List<ExprAggregator> exprAgg = query.getAggregators();
-				for (ExprAggregator expr : exprAgg) {
-					if (expr.getAggregator().getName().contains("COUNT")) {
-						if (!query.toString().contains("GROUP")) {
-							if (expr.getAggregator().toString().contains("DISTINCT"))
-								traversal = traversal.dedup(expr.getAggregator().getExprList().get(0).toString().substring(1));
-							else
-								traversal = traversal.select(expr.getAggregator().getExprList().get(0).toString().substring(1));
-
-							traversal = traversal.count();
-						} else {
+                for (ExprAggregator expr : exprAgg) {
+                    if (expr.getAggregator().getName().contains("COUNT")) {
+                        if (!query.toString().contains("GROUP")) {
+                            if (expr.getAggregator().toString().contains("DISTINCT"))
+                                traversal = traversal.dedup(expr.getAggregator().getExprList().get(0).toString().substring(1));
+                            else
+                                traversal = traversal.select(expr.getAggregator().getExprList().get(0).toString().substring(1));
+
+                            traversal = traversal.count();
+                        } else {
                             traversal = traversal.groupCount();
                         }
-					}
+                    }
 
-					if (expr.getAggregator().getName().contains("MAX")) {
-						traversal = traversal.max();
-					}
-				}
-			} else {
+                    if (expr.getAggregator().getName().contains("MAX")) {
+                        traversal = traversal.max();
+                    }
+                }
+            } else {
                 traversal = traversal.group();
             }
-		}
+        }
 
-		if (query.hasOrderBy() && query.hasGroupBy())
-            orderingIndex.forEach((k,v) -> traversal = traversal.order().by(__.select(k), v));
+        if (query.hasOrderBy() && query.hasGroupBy())
+            orderingIndex.forEach((k, v) -> traversal = traversal.order().by(__.select(k), v));
 
-		if (query.hasLimit()) {
-			long limit = query.getLimit(), offset = 0;
+        if (query.hasLimit()) {
+            long limit = query.getLimit(), offset = 0;
 
-			if (query.hasOffset())
-				offset = query.getOffset();
+            if (query.hasOffset())
+                offset = query.getOffset();
 
-			if (query.hasGroupBy() && query.hasOrderBy())
-				traversal = traversal.range(Scope.local, offset, offset + limit);
-			else
-				traversal = traversal.range(offset, offset + limit);
-		}
+            if (query.hasGroupBy() && query.hasOrderBy())
+                traversal = traversal.range(Scope.local, offset, offset + limit);
+            else
+                traversal = traversal.range(offset, offset + limit);
+        }
 
-		return traversal;
-	}
+        return traversal;
+    }
 
     /**
      * Extracts any {@code SortCondition} instances from the SPARQL query and holds them in an index of their keys


[25/50] tinkerpop git commit: TINKERPOP-1878 More tests for ordering

Posted by sp...@apache.org.
TINKERPOP-1878 More tests for ordering

Factored the order index creation into its own method to tidy up a bit.


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

Branch: refs/heads/TINKERPOP-1878
Commit: 48b263f2ef4be6ce2549d38c00c764dfeed6bf43
Parents: 923f04c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 26 15:56:55 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 .../sparql/SparqlToGremlinTranspiler.java       | 29 ++++++++++++++------
 .../dsl/sparql/SparqlTraversalSourceTest.java   |  6 ++++
 2 files changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/48b263f2/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
index ea3f828..c3bc907 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
@@ -99,15 +99,8 @@ public class SparqlToGremlinTranspiler {
 			arrayOfAllTraversals[traversalIndex++] = tempTrav;
 		}
 
-		final Map<String, Order> orderingIndex = new HashMap<>();
-		if (query.hasOrderBy()) {
-            final List<SortCondition> sortingConditions = query.getOrderBy();
-
-			for (SortCondition sortCondition : sortingConditions) {
-                final Expr expr = sortCondition.getExpression();
-                orderingIndex.put(expr.getVarName(), sortCondition.getDirection() == 1 ? Order.incr : Order.decr);
-			}
-		}
+		// creates a map of ordering keys and their ordering direction
+        final Map<String, Order> orderingIndex = createOrderIndexFromQuery(query);
 
 		if (traversalList.size() > 0)
 			traversal = traversal.match(arrayOfAllTraversals);
@@ -203,6 +196,24 @@ public class SparqlToGremlinTranspiler {
 		return traversal;
 	}
 
+    /**
+     * Extracts any {@code SortCondition} instances from the SPARQL query and holds them in an index of their keys
+     * where the value is that keys sorting direction.
+     */
+    private static Map<String, Order> createOrderIndexFromQuery(final Query query) {
+        final Map<String, Order> orderingIndex = new HashMap<>();
+        if (query.hasOrderBy()) {
+            final List<SortCondition> sortingConditions = query.getOrderBy();
+
+            for (SortCondition sortCondition : sortingConditions) {
+                final Expr expr = sortCondition.getExpression();
+                orderingIndex.put(expr.getVarName(), sortCondition.getDirection() == 1 ? Order.incr : Order.decr);
+            }
+        }
+
+        return orderingIndex;
+    }
+
     private static GraphTraversal<Vertex, ?> transpile(final GraphTraversalSource g, final Query query) {
         return new SparqlToGremlinTranspiler(g).transpile(query);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/48b263f2/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
index 2743255..1b39813 100644
--- a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
+++ b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
@@ -82,4 +82,10 @@ public class SparqlTraversalSourceTest {
                 }}
         ));
     }
+
+    @Test
+    public void shouldFindAllNamesOrdered() {
+        final List<?> x = g.sparql("SELECT ?name WHERE { ?person v:name ?name } ORDER BY DESC(?name)").toList();
+        assertThat(x, contains("vadas", "ripple", "peter", "marko", "lop", "josh"));
+    }
 }


[22/50] tinkerpop git commit: TINKERPOP-1831 Added KeyedProperty/VertexProperty for EventStrategy

Posted by sp...@apache.org.
TINKERPOP-1831 Added KeyedProperty/VertexProperty for EventStrategy

This is a minor but necessary change from the previous approach that used EmptyProperty/VertexProperty for "new" property additions. Use of "empty" was not sufficient because it didn't allow the MutationListener to know the key being updated. CTR


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

Branch: refs/heads/TINKERPOP-1878
Commit: fc866751e11768666ed347f772d86d888a2dec16
Parents: 61238bf
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jun 13 10:13:15 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jun 13 10:15:55 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   2 +-
 docs/src/upgrade/release-3.4.x.asciidoc         |   4 +-
 .../step/sideEffect/AddPropertyStep.java        |   8 +-
 .../util/empty/EmptyVertexProperty.java         |   2 +-
 .../structure/util/keyed/KeyedProperty.java     |  85 ++++++++++++++
 .../util/keyed/KeyedVertexProperty.java         | 114 +++++++++++++++++++
 .../decoration/EventStrategyProcessTest.java    |  29 +++--
 7 files changed, 228 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fc866751/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 5e36f57..2320162 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -38,7 +38,7 @@ This release also includes changes from <<release-3-3-3, 3.3.3>>.
 * Changed the order of `select()` scopes. The order is now: maps, side-effects, paths.
 * Removed previously deprecated Credentials DSL infrastructure.
 * Moved `TraversalEngine` to `gremlin-test` as it has long been only used in testing infrastructure.
-* Events from `EventStrategy` raised from "new" mutations will now return a true "empty" property from `VertexProperty.empty()` or `Property.empty()` as is appropriate.
+* Events from `EventStrategy` raised from "new" mutations will now return a `KeyedVertexProperty` or `KeyedProperty` as is appropriate.
 * `MutationListener#vertexPropertyChanged(Vertex, VertexProperty, Object, Object...)` no longer has a default implementation.
 * Removed previously deprecated `MutationListener#vertexPropertyChanged(Vertex, Property, Object, Object...)`.
 * Removed previously deprecated `OpSelectorHandler` constructor.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fc866751/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.4.x.asciidoc b/docs/src/upgrade/release-3.4.x.asciidoc
index 68f7cd3..8829569 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -129,8 +129,8 @@ have originally been the correct signature of `vertexPropertyChanged(Vertex, Ver
 prior versions when this method and its related `edgePropertyChanged()` and `vertexPropertyPropertyChanged()` were
 triggered by way of the addition of a new property a "fake" property was included with a `null` value for the
 "oldValue" argument to these methods (as it did not exist prior to this event). That was a bit awkward to reason about
-when dealing with that event. To make this easier, the event now raises with a `VertexProperty.empty()` or
-`Property.empty()` instance, which can be evaluated with `equals()` easily to determine if the property is new or not.
+when dealing with that event. To make this easier, the event now raises with a `KeyedVertexProperty` or
+`KeyedProperty` instance, which only contains a property key and no value in them.
 
 link:https://issues.apache.org/jira/browse/TINKERPOP-1831[TINKERPOP-1831]
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fc866751/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
index 3589c0c..6b814c3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
@@ -37,6 +37,8 @@ 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.StringFactory;
+import org.apache.tinkerpop.gremlin.structure.util.keyed.KeyedProperty;
+import org.apache.tinkerpop.gremlin.structure.util.keyed.KeyedVertexProperty;
 
 import java.util.List;
 import java.util.Set;
@@ -97,17 +99,17 @@ public final class AddPropertyStep<S extends Element> extends SideEffectStep<S>
             if (element instanceof Vertex)
                 evt = new Event.VertexPropertyChangedEvent(eventStrategy.detach((Vertex) element),
                         newProperty ?
-                                VertexProperty.empty() :
+                                new KeyedVertexProperty(key) :
                                 eventStrategy.detach((VertexProperty) currentProperty), value, vertexPropertyKeyValues);
             else if (element instanceof Edge)
                 evt = new Event.EdgePropertyChangedEvent(eventStrategy.detach((Edge) element),
                         newProperty ?
-                                Property.empty() :
+                                new KeyedProperty(key) :
                                 eventStrategy.detach(currentProperty), value);
             else if (element instanceof VertexProperty)
                 evt = new Event.VertexPropertyPropertyChangedEvent(eventStrategy.detach((VertexProperty) element),
                         newProperty ?
-                                Property.empty() :
+                                new KeyedProperty(key) :
                                 eventStrategy.detach(currentProperty), value);
             else
                 throw new IllegalStateException(String.format("The incoming object cannot be processed by change eventing in %s:  %s", AddPropertyStep.class.getName(), element));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fc866751/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/empty/EmptyVertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/empty/EmptyVertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/empty/EmptyVertexProperty.java
index a77fd6f..c7a5b44 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/empty/EmptyVertexProperty.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/empty/EmptyVertexProperty.java
@@ -90,7 +90,7 @@ public final class EmptyVertexProperty<V> implements VertexProperty<V> {
     }
 
     @Override
-    public <U> Iterator<Property<U>> properties(String... propertyKeys) {
+    public <U> Iterator<Property<U>> properties(final String... propertyKeys) {
         return Collections.emptyIterator();
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fc866751/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/keyed/KeyedProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/keyed/KeyedProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/keyed/KeyedProperty.java
new file mode 100644
index 0000000..5532f06
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/keyed/KeyedProperty.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.structure.util.keyed;
+
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+
+import java.util.NoSuchElementException;
+
+/**
+ * A utility implementation of a {@link Property} that only has a key but no value.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class KeyedProperty<V> implements Property<V> {
+
+    private final String key;
+
+    public KeyedProperty(final String key) {
+        if (null == key || key.isEmpty()) throw new IllegalArgumentException("key cannot be null");
+        this.key = key;
+    }
+
+    @Override
+    public String key() {
+        return this.key;
+    }
+
+    @Override
+    public V value() throws NoSuchElementException {
+        throw Exceptions.propertyDoesNotExist();
+    }
+
+    @Override
+    public boolean isPresent() {
+        return false;
+    }
+
+    @Override
+    public Element element() {
+        throw Exceptions.propertyDoesNotExist();
+    }
+
+    @Override
+    public void remove() {
+
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.propertyString(this);
+    }
+
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final KeyedProperty<?> that = (KeyedProperty<?>) o;
+
+        return key.equals(that.key);
+    }
+
+    @Override
+    public int hashCode() {
+        return key.hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fc866751/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/keyed/KeyedVertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/keyed/KeyedVertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/keyed/KeyedVertexProperty.java
new file mode 100644
index 0000000..53cba69
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/keyed/KeyedVertexProperty.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.structure.util.keyed;
+
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * A utility implementation of a {@link Property} that only has a key but no value and no meta-properties.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class KeyedVertexProperty<V> implements VertexProperty<V> {
+
+    private final String key;
+
+    public KeyedVertexProperty(final String key) {
+        if (null == key || key.isEmpty()) throw new IllegalArgumentException("key cannot be null");
+        this.key = key;
+    }
+
+    @Override
+    public Vertex element() {
+        throw Property.Exceptions.propertyDoesNotExist();
+    }
+
+    @Override
+    public Object id() {
+        throw Property.Exceptions.propertyDoesNotExist();
+    }
+
+    @Override
+    public Graph graph() {
+        throw Property.Exceptions.propertyDoesNotExist();
+    }
+
+    @Override
+    public <U> Property<U> property(String key) {
+        return Property.<U>empty();
+    }
+
+    @Override
+    public <U> Property<U> property(String key, U value) {
+        return Property.<U>empty();
+    }
+
+    @Override
+    public String key() {
+        return this.key;
+    }
+
+    @Override
+    public V value() throws NoSuchElementException {
+        throw Property.Exceptions.propertyDoesNotExist();
+    }
+
+    @Override
+    public boolean isPresent() {
+        return false;
+    }
+
+    @Override
+    public void remove() {
+
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.propertyString(this);
+    }
+
+    @Override
+    public <U> Iterator<Property<U>> properties(final String... propertyKeys) {
+        return Collections.emptyIterator();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final KeyedVertexProperty<?> that = (KeyedVertexProperty<?>) o;
+
+        return key.equals(that.key);
+    }
+
+    @Override
+    public int hashCode() {
+        return key.hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fc866751/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
index b527340..0992eae 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
@@ -31,6 +31,8 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.keyed.KeyedProperty;
+import org.apache.tinkerpop.gremlin.structure.util.keyed.KeyedVertexProperty;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexProperty;
@@ -633,7 +635,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertThat(element, instanceOf(DetachedVertexProperty.class));
                 assertEquals(label, element.label());
                 assertEquals(value, element.value());
-                assertEquals(Property.empty(), oldValue);
+                assertThat(oldValue, instanceOf(KeyedProperty.class));
+                assertEquals("new", oldValue.key());
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
@@ -750,7 +753,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertEquals(label, element.label());
                 assertEquals(inId, element.inVertex().id());
                 assertEquals(outId, element.outVertex().id());
-                assertEquals(Property.empty(), oldValue);
+                assertThat(oldValue, instanceOf(KeyedProperty.class));
+                assertEquals("new", oldValue.key());
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
@@ -925,7 +929,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertThat(element, instanceOf(DetachedVertex.class));
                 assertEquals(label, element.label());
                 assertEquals(id, element.id());
-                assertEquals(VertexProperty.empty(), oldValue);
+                assertThat(oldValue, instanceOf(KeyedVertexProperty.class));
+                assertEquals("new", oldValue.key());
                 assertEquals("dah", setValue);
                 triggered.set(true);
             }
@@ -1102,7 +1107,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertThat(element, instanceOf(ReferenceVertexProperty.class));
                 assertEquals(label, element.label());
                 assertEquals(value, element.value());
-                assertEquals(Property.empty(), oldValue);
+                assertThat(oldValue, instanceOf(KeyedProperty.class));
+                assertEquals("new", oldValue.key());
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
@@ -1219,7 +1225,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertEquals(label, element.label());
                 assertEquals(inId, element.inVertex().id());
                 assertEquals(outId, element.outVertex().id());
-                assertEquals(Property.empty(), oldValue);
+                assertThat(oldValue, instanceOf(KeyedProperty.class));
+                assertEquals("new", oldValue.key());
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
@@ -1396,7 +1403,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertThat(element, instanceOf(ReferenceVertex.class));
                 assertEquals(label, element.label());
                 assertEquals(id, element.id());
-                assertEquals(VertexProperty.empty(), oldValue);
+                assertThat(oldValue, instanceOf(KeyedVertexProperty.class));
+                assertEquals("new", oldValue.key());
                 assertEquals("dah", setValue);
                 triggered.set(true);
             }
@@ -1572,7 +1580,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertEquals(vp, element);
                 assertEquals(label, element.label());
                 assertEquals(value, element.value());
-                assertEquals(Property.empty(), oldValue);
+                assertThat(oldValue, instanceOf(KeyedProperty.class));
+                assertEquals("new", oldValue.key());
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
@@ -1689,7 +1698,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertEquals(label, element.label());
                 assertEquals(inId, element.inVertex().id());
                 assertEquals(outId, element.outVertex().id());
-                assertEquals(Property.empty(), oldValue);
+                assertThat(oldValue, instanceOf(KeyedProperty.class));
+                assertEquals("new", oldValue.key());
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
@@ -1866,7 +1876,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertEquals(v, element);
                 assertEquals(label, element.label());
                 assertEquals(id, element.id());
-                assertEquals(VertexProperty.empty(), oldValue);
+                assertThat(oldValue, instanceOf(KeyedVertexProperty.class));
+                assertEquals("new", oldValue.key());
                 assertEquals("dah", setValue);
                 triggered.set(true);
             }


[48/50] tinkerpop git commit: TINKERPOP-1878 Clean up docs a bit more.

Posted by sp...@apache.org.
TINKERPOP-1878 Clean up docs a bit more.


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

Branch: refs/heads/TINKERPOP-1878
Commit: f74bc6941269cbeb0fd80b35a8c33c84e8ea9319
Parents: 537a6b4
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sun May 13 10:53:56 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 docs/src/reference/transpilers.asciidoc | 36 +++++++++++++---------------
 1 file changed, 16 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f74bc694/docs/src/reference/transpilers.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/transpilers.asciidoc b/docs/src/reference/transpilers.asciidoc
index b05be68..390d4f4 100644
--- a/docs/src/reference/transpilers.asciidoc
+++ b/docs/src/reference/transpilers.asciidoc
@@ -24,23 +24,20 @@ Gremlin Transpiler enables a particular query language to work on any TinkerPop-
 
 == SPARQL-Gremlin
 
-image:https://raw.githubusercontent.com/LITMUS-Benchmark-Suite/sparql-to-gremlin/master/docs/images/sparql-gremlin-logo.png[gremlinator]
+image::gremlin-standing.png[]
 
-The SPARQL-Gremlin transpiler, transforms link:https://en.wikipedia.org/wiki/SPARQL[SPARQL] queries into Gremlin traversals. It is based on the  https://jena.apache.org/index.html[Apache Jena] SPARQL processor https://jena.apache.org/documentation/query/index.html[ARQ], which provides access to a syntax tree of a SPARQL query.
+The SPARQL-Gremlin transpiler, transforms link:https://en.wikipedia.org/wiki/SPARQL[SPARQL] queries into Gremlin
+traversals. It uses the https://jena.apache.org/index.html[Apache Jena] SPARQL processor
+link:https://jena.apache.org/documentation/query/index.html[ARQ], which provides access to a syntax tree of a
+SPARQL query.
 
+The goal of this work is to bridge the query interoperability gap between the two famous, yet fairly disconnected,
+graph communities: Semantic Web (which relies on the RDF data model) and Graph database (which relies on property graph
+data model).
 
-The goal of this work is to bridge the query interoperability gap between the two famous, yet fairly disconnected, graph communities: Semantic Web (which relies on the RDF data model) and Graph database
-(which relies on Property graph data model).
-
-NOTE: The foundational research work on SPARQL-Gremlin transpiler (aka Gremlinator) can be found from -
-https://arxiv.org/pdf/1801.02911.pdf[Gremlinator full paper]. In this
-paper, we present and discuss the notion of graph query language
-semantics of SPARQL and Gremlin, and a formal mapping between SPARQL
-pattern matching graph patterns and Gremlin traversals. Furthermore, we
-point the interested reader to the following resourcesfor a better
-understanding: (1) Gremlinator demonstration -
-(http://gremlinator.iai.uni-bonn.de:8080/Demo/[Public Demo Mirror 1])
-and (http://195.201.31.31:8080/Demo/[Public Demo Mirror 2]); (2) A short video tutorial on how to use the demonstration - https://www.youtube.com/watch?v=Z0ETx2IBamw[here]
+NOTE: The foundational research work on SPARQL-Gremlin transpiler (aka Gremlinator) can be found in the
+link:https://arxiv.org/pdf/1801.02911.pdf[Gremlinator paper]. This paper presents the graph query language semantics of
+SPARQL and Gremlin, and a formal mapping between SPARQL pattern matching graph patterns and Gremlin traversals.
 
 [source,xml]
 ----
@@ -111,9 +108,9 @@ g.sparql("""SELECT ?name ?id ?label
 [[supported-queries]]
 === Supported Queries
 
-The SPARQL-Gremlin transpiler is currently an on-going effort with an aim to cover the entire SPARQL 1.1 query feature
-spectrum, however we currently only support translation of the SPARQL 1.0 specification, especially _SELECT_ queries.
-The supported SPARQL query types are:
+The SPARQL-Gremlin transpiler currently supports translation of the SPARQL 1.0 specification, especially `SELECT`
+queries, though there is an on-going effort to cover the entire SPARQL 1.1 query feature spectrum. The supported
+SPARQL query types are:
 
 * Union 
 * Optional 
@@ -129,8 +126,7 @@ The supported SPARQL query types are:
 [[limitations]]
 === Limitations
 
-The current implementation of SPARQL-Gremlin transpiler (i.e. SPARQL-Gremlin) does
-not support the following cases: 
+The current implementation of SPARQL-Gremlin transpiler (i.e. SPARQL-Gremlin) does not support the following cases:
 
 * SPARQL queries with variables in the predicate position are not currently covered, with an exception of the following
 case:
@@ -143,7 +139,7 @@ g.sparql("""SELECT * WHERE { ?x ?y ?z . }""")
 * A SPARQL Union query with un-balanced patterns, i.e. a gremlin union traversal can only be generated if the input
 SPARQL query has the same number of patterns on both the side of the union operator. For instance, the following
 SPARQL query cannot be mapped using Gremlinator, since a union is executed between different number of graph patterns
-(two patterns _union_ 1 pattern).
+(two patterns `union` 1 pattern).
 
 [source,groovy]
 ----


[35/50] tinkerpop git commit: TINKERPOP-1878 General refactoring and javadoc on Prefixes class

Posted by sp...@apache.org.
TINKERPOP-1878 General refactoring and javadoc on Prefixes class


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

Branch: refs/heads/TINKERPOP-1878
Commit: 1dedf4fef24779d700a633b2877eff3ae914264d
Parents: 56089ea
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 26 09:39:28 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/sparql/Prefixes.java      | 23 ++++++++++----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1dedf4fe/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/Prefixes.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/Prefixes.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/Prefixes.java
index 452bf68..32768a7 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/Prefixes.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/Prefixes.java
@@ -22,15 +22,16 @@ package org.apache.tinkerpop.gremlin.sparql;
 import java.util.Arrays;
 import java.util.List;
 
+/**
+ * Helper methods for working with prefix lines in SPARQL queries.
+ */
+class Prefixes {
 
-public class Prefixes {
-
-	// public final static String BASE_URI = "http://northwind.com/model/";
-    public final static String BASE_URI = "http://www.tinkerpop.com/traversal/";
+    final static String BASE_URI = "http://tinkerpop.apache.org/traversal/";
 
-    final static List<String> PREFIXES = Arrays.asList("edge", "property", "value");
+    private final static List<String> PREFIXES = Arrays.asList("edge", "property", "value");
 
-    final static String PREFIX_DEFINITIONS;
+    private final static String PREFIX_DEFINITIONS;
 
     static {
         final StringBuilder builder = new StringBuilder();
@@ -41,24 +42,24 @@ public class Prefixes {
         PREFIX_DEFINITIONS = builder.toString();
     }
 
-    public static String getURI(final String prefix) {
+    static String getURI(final String prefix) {
         return BASE_URI + prefix + "#";
     }
 
-    public static String getURIValue(final String uri) {
+    static String getURIValue(final String uri) {
         return uri.substring(uri.indexOf("#") + 1);
     }
 
-    public static String getPrefix(final String uri) {
+    static String getPrefix(final String uri) {
         final String tmp = uri.substring(0, uri.indexOf("#"));
         return tmp.substring(tmp.lastIndexOf("/") + 1);
     }
 
-    public static String prepend(final String script) {
+    static String prepend(final String script) {
         return PREFIX_DEFINITIONS + script;
     }
 
-    public static StringBuilder prepend(final StringBuilder scriptBuilder) {
+    static StringBuilder prepend(final StringBuilder scriptBuilder) {
         return scriptBuilder.insert(0, PREFIX_DEFINITIONS);
     }
 }


[12/50] tinkerpop git commit: TINKERPOP-1518 GraphProvider allows for caching of graph features

Posted by sp...@apache.org.
TINKERPOP-1518 GraphProvider allows for caching of graph features


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

Branch: refs/heads/TINKERPOP-1878
Commit: aec170982aa03d1a07248721cb045ba95e11188b
Parents: ae2f304
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 7 20:15:53 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 7 20:15:53 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 docs/src/dev/provider/index.asciidoc            |  4 ++
 docs/src/upgrade/release-3.4.x.asciidoc         | 20 ++++++
 .../tinkerpop/gremlin/structure/Graph.java      |  1 -
 .../tinkerpop/gremlin/AbstractGremlinTest.java  | 64 ++++++++++++++------
 .../apache/tinkerpop/gremlin/GraphManager.java  |  5 ++
 .../apache/tinkerpop/gremlin/GraphProvider.java | 16 +++++
 .../neo4j/AbstractNeo4jGraphProvider.java       | 23 ++++++-
 8 files changed, 114 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aec17098/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e886107..a846363 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -33,6 +33,7 @@ This release also includes changes from <<release-3-3-3, 3.3.3>>.
 * `min()` and `max()` now support all types implementing `Comparable`.
 * Change the `toString()` of `Path` to be standardized as other graph elements are.
 * `hadoop-gremlin` no longer generates a test artifact.
+* Allowed `GraphProvider` to expose a cached `Graph.Feature` object so that the test suite could re-use them to speed test runs.
 * Fixed a bug in `ReducingBarrierStep`, that returned the provided seed value despite no elements being available.
 * Changed the order of `select()` scopes. The order is now: maps, side-effects, paths.
 * Removed previously deprecated Credentials DSL infrastructure.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aec17098/docs/src/dev/provider/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/provider/index.asciidoc b/docs/src/dev/provider/index.asciidoc
index f6a964b..896f85c 100644
--- a/docs/src/dev/provider/index.asciidoc
+++ b/docs/src/dev/provider/index.asciidoc
@@ -662,6 +662,10 @@ should validate that the ignored tests are appropriately bypassed and that there
 definitions.  Moreover, implementers should consider filling gaps in their own test suites, especially when
 IO-related tests are being ignored.
 
+TIP: If it is expensive to construct a new `Graph` instance, consider implementing `GraphProvider.getStaticFeatures()`
+which can help by caching a static feature set for instances produced by that `GraphProvider` and allow the test suite
+to avoid that construction cost if the test is ignored.
+
 The only test-class that requires any code investment is the `GraphProvider` implementation class. This class is a
 used by the test suite to construct `Graph` configurations and instances and provides information about the
 implementation itself.  In most cases, it is best to simply extend `AbstractGraphProvider` as it provides many

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aec17098/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.4.x.asciidoc b/docs/src/upgrade/release-3.4.x.asciidoc
index 851d458..741fb3c 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -241,6 +241,26 @@ See: link:https://issues.apache.org/jira/browse/TINKERPOP-1522[TINKERPOP-1522]
 
 ==== Graph Database Providers
 
+===== Caching Graph Features
+
+For graph implementations that have expensive creation times, it can be time consuming to run the TinkerPop test suite
+as each test run requires a `Graph` instance even if the test is ultimately ignored becaue it doesn't pass the feature
+checks. To possibly help alleviate this problem, the `GraphProvider` interface now includes this method:
+
+[source,java]
+----
+public default Optional<Graph.Features> getStaticFeatures() {
+    return Optional.empty();
+}
+----
+
+This method can be implemented to return a cacheable set of features for a `Graph` generated from that `GraphProvider`.
+Assuming this method is faster than the cost of creating a new `Graph` instance, the test suite should execute
+significantly faster depending on how many tests end up being ignored.
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1518[TINKERPOP-1518],
+link:
+
 ===== Configuring Interface
 
 There were some changes to interfaces that were related to `Step`. A new `Configuring` interface was added that was

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aec17098/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index 2fbfe03..dc14cc6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -40,7 +40,6 @@ import java.lang.reflect.InvocationTargetException;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.NoSuchElementException;
 import java.util.Optional;
 import java.util.Set;
 import java.util.UUID;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aec17098/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
index 25d7a55..8f55329 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
@@ -29,9 +29,9 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.javatuples.Pair;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.slf4j.Logger;
@@ -40,9 +40,11 @@ import org.slf4j.LoggerFactory;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Random;
+import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
@@ -61,6 +63,9 @@ import static org.junit.Assume.assumeThat;
  */
 public abstract class AbstractGremlinTest {
     private static final Logger logger = LoggerFactory.getLogger(AbstractGremlinTest.class);
+
+    protected static final Map<Pair<Class<?>, String>, Boolean> featureCache = new HashMap<>();
+
     protected Graph graph;
     protected GraphTraversalSource g;
     protected Configuration config;
@@ -75,8 +80,26 @@ public abstract class AbstractGremlinTest {
         final LoadGraphWith[] loadGraphWiths = testMethod.getAnnotationsByType(LoadGraphWith.class);
         final LoadGraphWith loadGraphWith = loadGraphWiths.length == 0 ? null : loadGraphWiths[0];
         final LoadGraphWith.GraphData loadGraphWithData = null == loadGraphWith ? null : loadGraphWith.value();
+        final Set<FeatureRequirement> featureRequirementSet = getFeatureRequirementsForTest(testMethod, loadGraphWiths);
 
         graphProvider = GraphManager.getGraphProvider();
+
+        final Optional<Graph.Features> staticFeatures = graphProvider.getStaticFeatures();
+        if (staticFeatures.isPresent()) {
+            for (FeatureRequirement fr : featureRequirementSet) {
+                try {
+                    assumeThat(String.format("StaticFeatures of the graph do not support all of the features required by this test so it will be ignored: %s.%s=%s",
+                            fr.featureClass().getSimpleName(), fr.feature(), fr.supported()),
+                            staticFeatures.get().supports(fr.featureClass(), fr.feature()), is(fr.supported()));
+                } catch (NoSuchMethodException nsme) {
+                    throw new NoSuchMethodException(String.format("[supports%s] is not a valid feature on %s", fr.feature(), fr.featureClass()));
+                } catch (UnsupportedOperationException uoe) {
+                    // no worries - it just means that we can't use the cache to support this check and will have to
+                    // incur the cost of instantiating a graph instance directly
+                }
+            }
+        }
+
         graphProvider.getTestListener().ifPresent(l -> l.onTestStart(this.getClass(), name.getMethodName()));
         config = graphProvider.standardGraphConfiguration(this.getClass(), name.getMethodName(), loadGraphWithData);
 
@@ -87,24 +110,11 @@ public abstract class AbstractGremlinTest {
         graph = graphProvider.openTestGraph(config);
         g = graphProvider.traversal(graph);
 
-        // get feature requirements on the test method and add them to the list of ones to check
-        final FeatureRequirement[] featureRequirement = testMethod.getAnnotationsByType(FeatureRequirement.class);
-        final List<FeatureRequirement> frs = new ArrayList<>(Arrays.asList(featureRequirement));
-
-        // if the graph is loading data then it will come with it's own requirements
-        if (loadGraphWiths.length > 0) frs.addAll(loadGraphWiths[0].value().featuresRequired());
-
-        // if the graph has a set of feature requirements bundled together then add those
-        final FeatureRequirementSet[] featureRequirementSets = testMethod.getAnnotationsByType(FeatureRequirementSet.class);
-        if (featureRequirementSets.length > 0)
-            frs.addAll(Arrays.stream(featureRequirementSets)
-                    .flatMap(f -> f.value().featuresRequired().stream()).collect(Collectors.toList()));
-
-        // process the unique set of feature requirements
-        final Set<FeatureRequirement> featureRequirementSet = new HashSet<>(frs);
         for (FeatureRequirement fr : featureRequirementSet) {
             try {
-                //System.out.println(String.format("Assume that %s meets Feature Requirement - %s - with %s", fr.featureClass().getSimpleName(), fr.feature(), fr.supported()));
+                // even if we checked static features above it's of little cost to recheck again with the real graph
+                // once it is instantiated. the real cost savings is preventing graph creation in the first place so
+                // let's double check that all is legit.
                 assumeThat(String.format("%s does not support all of the features required by this test so it will be ignored: %s.%s=%s",
                                 graph.getClass().getSimpleName(), fr.featureClass().getSimpleName(), fr.feature(), fr.supported()),
                         graph.features().supports(fr.featureClass(), fr.feature()), is(fr.supported()));
@@ -263,6 +273,24 @@ public abstract class AbstractGremlinTest {
         AbstractGremlinTest.verifyUniqueStepIds(traversal, 0, new HashSet<>());
     }
 
+    private static Set<FeatureRequirement> getFeatureRequirementsForTest(final Method testMethod, final LoadGraphWith[] loadGraphWiths) {
+        // get feature requirements on the test method and add them to the list of ones to check
+        final FeatureRequirement[] featureRequirement = testMethod.getAnnotationsByType(FeatureRequirement.class);
+        final List<FeatureRequirement> frs = new ArrayList<>(Arrays.asList(featureRequirement));
+
+        // if the graph is loading data then it will come with it's own requirements
+        if (loadGraphWiths.length > 0) frs.addAll(loadGraphWiths[0].value().featuresRequired());
+
+        // if the graph has a set of feature requirements bundled together then add those
+        final FeatureRequirementSet[] featureRequirementSets = testMethod.getAnnotationsByType(FeatureRequirementSet.class);
+        if (featureRequirementSets.length > 0)
+            frs.addAll(Arrays.stream(featureRequirementSets)
+                    .flatMap(f -> f.value().featuresRequired().stream()).collect(Collectors.toList()));
+
+        // process the unique set of feature requirements
+        return new HashSet<>(frs);
+    }
+
     private static void verifyUniqueStepIds(final Traversal.Admin<?, ?> traversal, final int depth, final Set<String> ids) {
         for (final Step step : traversal.asAdmin().getSteps()) {
             /*for (int i = 0; i < depth; i++) System.out.print("\t");

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aec17098/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
index 6886465..7506226 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
@@ -183,6 +183,11 @@ public class GraphManager {
             if (innerGraphProvider instanceof AutoCloseable)
                 ((AutoCloseable) innerGraphProvider).close();
         }
+
+        @Override
+        public Optional<Graph.Features> getStaticFeatures() {
+            return innerGraphProvider.getStaticFeatures();
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aec17098/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
index c785cfc..1fcb147 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
@@ -294,6 +294,22 @@ public interface GraphProvider {
     }
 
     /**
+     * Gets a {@link Graph.Features} implementation that contains graph feature configuration that will never change
+     * from execution to execution of the tests given this current {@code GraphProvider} implementation. Implementing
+     * this method will allow the test suite to avoid creation of a {@link Graph} instance and thus speed up the
+     * execution of tests if that creation process is expensive. It is important that this static set of features be
+     * representative of what the {@link Graph} instance produced by this {@code GraphProvider} can actually do or
+     * else the cost of {@link Graph} instantiation will be incurred when it doesn't need to be. It is also important
+     * that this method be faster than the cost of {@link Graph} creation in the first place or there really won't be
+     * any difference in execution speed. In cases where some features are static and others are not, simply throw
+     * an {@code UnsupportedOperationException} from those features to let the test suite know that it cannot rely
+     * on them and the test suite will revert to using a constructed {@link Graph} instance.
+     */
+    public default Optional<Graph.Features> getStaticFeatures() {
+        return Optional.empty();
+    }
+
+    /**
      * An annotation to be applied to a {@code GraphProvider} implementation that provides additional information
      * about its intentions. The {@code Descriptor} is required by those {@code GraphProvider} implementations
      * that will be assigned to test suites that use

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aec17098/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/AbstractNeo4jGraphProvider.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/AbstractNeo4jGraphProvider.java b/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/AbstractNeo4jGraphProvider.java
index 9226822..514ef2b 100644
--- a/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/AbstractNeo4jGraphProvider.java
+++ b/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/AbstractNeo4jGraphProvider.java
@@ -32,6 +32,7 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 
 import java.io.File;
 import java.util.HashSet;
+import java.util.Optional;
 import java.util.Random;
 import java.util.Set;
 
@@ -49,6 +50,26 @@ public abstract class AbstractNeo4jGraphProvider extends AbstractGraphProvider {
         add(Neo4jVertexProperty.class);
     }};
 
+    protected Graph.Features features = null;
+
+    @Override
+    public Graph openTestGraph(final Configuration config) {
+        final Graph graph = super.openTestGraph(config);
+
+        // we can just use the initial set of features taken from the first graph generated from the provider because
+        // neo4j feature won't ever change. don't think there is any danger of keeping this instance about even if
+        // the original graph instance goes out of scope.
+        if (null == features) {
+            this.features = graph.features();
+        }
+        return graph;
+    }
+
+    @Override
+    public Optional<Graph.Features> getStaticFeatures() {
+        return Optional.ofNullable(features);
+    }
+
     @Override
     public void clear(final Graph graph, final Configuration configuration) throws Exception {
         if (null != graph) {
@@ -56,7 +77,7 @@ public abstract class AbstractNeo4jGraphProvider extends AbstractGraphProvider {
             graph.close();
         }
 
-        if (configuration.containsKey(Neo4jGraph.CONFIG_DIRECTORY)) {
+        if (configuration != null && configuration.containsKey(Neo4jGraph.CONFIG_DIRECTORY)) {
             // this is a non-in-sideEffects configuration so blow away the directory
             final File graphDirectory = new File(configuration.getString(Neo4jGraph.CONFIG_DIRECTORY));
             deleteDirectory(graphDirectory);


[23/50] tinkerpop git commit: Initial commit for sparql-gremlin changes

Posted by sp...@apache.org.
Initial commit for sparql-gremlin changes


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

Branch: refs/heads/TINKERPOP-1878
Commit: 3dc8d9fb85ebb1cefc3090e2f9db8024ffc2b60e
Parents: fc86675
Author: harsh9t <ha...@gmail.com>
Authored: Thu Jan 18 01:33:29 2018 +0100
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:29 2018 -0400

----------------------------------------------------------------------
 sparql-gremlin/pom.xml                          |  63 +++
 .../gremlin/sparql/ConsoleCompiler.java         | 165 ++++++++
 .../tinkerpop/gremlin/sparql/Prefixes.java      |  64 ++++
 .../gremlin/sparql/SparqlToGremlinCompiler.java | 381 +++++++++++++++++++
 .../gremlin/sparql/TraversalBuilder.java        |  82 ++++
 .../gremlin/sparql/WhereTraversalBuilder.java   | 134 +++++++
 .../tinkerpop/gremlin/sparql/PrefixesTest.java  |  67 ++++
 .../gremlin/sparql/ResourceHelper.java          |  37 ++
 .../sparql/SparqlToGremlinCompilerTest.java     | 223 +++++++++++
 9 files changed, 1216 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dc8d9fb/sparql-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/sparql-gremlin/pom.xml b/sparql-gremlin/pom.xml
new file mode 100644
index 0000000..e134d31
--- /dev/null
+++ b/sparql-gremlin/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>tinkerpop</artifactId>
+        <groupId>org.apache.tinkerpop</groupId>
+        <version>3.3.2-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>sparql-gremlin</artifactId>
+    <organization>
+        <name>WDAQUA-ITN</name>
+        <url>http://wdaqua.eu</url>
+    </organization>
+    <developers>
+        <developer>
+            <name>Harsh Thakkar</name>
+            <email>harsh9t@gmail.com</email>
+            <organization>University of Bonn</organization>
+            <organizationUrl>http://harshthakkar.in</organizationUrl>
+        </developer>
+        <developer>
+            <name>Dharmen Punjani</name>
+            <email>dharmen.punjani@gmail.com</email>
+            <organization>National and Kapodistrian University of Athens</organization>
+            <organizationUrl>http://wdaqua.eu/students/dharmen-punjani</organizationUrl>
+        </developer>
+    </developers>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <jena.version>3.0.0</jena.version>
+        <query.dir>src/test/resources/sparql/queries</query.dir>
+    </properties>
+
+    <dependencies>
+    <dependency>
+        <groupId>org.apache.jena</groupId>
+        <artifactId>apache-jena-libs</artifactId>
+        <type>pom</type>
+        <version>${jena.version}</version>
+    </dependency>
+        <dependency>
+            <groupId>org.apache.tinkerpop</groupId>
+            <artifactId>gremlin-core</artifactId>
+            <version>3.3.2-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tinkerpop</groupId>
+            <artifactId>tinkergraph-gremlin</artifactId>
+            <version>3.3.2-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tinkerpop</groupId>
+            <artifactId>gremlin-test</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dc8d9fb/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/ConsoleCompiler.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/ConsoleCompiler.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/ConsoleCompiler.java
new file mode 100644
index 0000000..0d50475
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/ConsoleCompiler.java
@@ -0,0 +1,165 @@
+/*
+ * 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.sparql;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.tinkerpop.gremlin.jsr223.JavaTranslator;
+import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.io.IoCore;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+
+import org.apache.tinkerpop.gremlin.sparql.SparqlToGremlinCompiler;
+
+class ConsoleCompiler {
+
+    public static void main(final String[] args) throws IOException {
+    	//args = "/examples/modern1.sparql";
+        final Options options = new Options();
+        options.addOption("f", "file", true, "a file that contains a SPARQL query");
+        options.addOption("g", "graph", true, "the graph that's used to execute the query [classic|modern|crew|kryo file]");
+        // TODO: add an OLAP option (perhaps: "--olap spark"?)
+
+        final CommandLineParser parser = new DefaultParser();
+        final CommandLine commandLine;
+
+        try {
+            commandLine = parser.parse(options, args);
+        } catch (ParseException e) {
+            System.out.println(e.getMessage());
+            printHelp(1);
+            return;
+        }
+        
+        final InputStream inputStream = commandLine.hasOption("file")
+                ? new FileInputStream(commandLine.getOptionValue("file"))
+                : System.in;
+        final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+        final StringBuilder queryBuilder = new StringBuilder();
+
+        if (!reader.ready()) {
+            printHelp(1);
+        }
+
+        String line;
+        while (null != (line = reader.readLine())) {
+            queryBuilder.append(System.lineSeparator()).append(line);
+        }
+
+        final String queryString = queryBuilder.toString();
+        Graph graph;
+        
+        if (commandLine.hasOption("graph")) {
+            switch (commandLine.getOptionValue("graph").toLowerCase()) {
+                case "classic":
+                    graph = TinkerFactory.createClassic();
+                    break;
+                case "modern":
+                    graph = TinkerFactory.createModern();
+                    System.out.println("Modern Graph Created");
+                    break;
+                case "crew":
+                    graph = TinkerFactory.createTheCrew();
+                    break;
+                default:
+                    graph = TinkerGraph.open();
+                    System.out.println("Graph Created");
+                    String graphName = commandLine.getOptionValue("graph");
+                    long startTime= System.currentTimeMillis();
+                    if(graphName.endsWith(".graphml"))
+                    	graph.io(IoCore.graphml()).readGraph(graphName);
+                    else if(graphName.endsWith(".kryo")||graphName.endsWith("gryo"))
+                    	graph.io(IoCore.gryo()).readGraph(graphName);
+                    long endTime = System.currentTimeMillis();
+                    System.out.println("Time taken to load graph from kyro file: "+ (endTime-startTime)+" mili seconds");
+                    break;
+            }
+        } else {
+ 
+            graph = TinkerFactory.createModern();
+        }
+
+        long startTime = System.currentTimeMillis();
+        final Traversal<Vertex, ?> traversal = SparqlToGremlinCompiler.convertToGremlinTraversal(graph, queryString);
+        long endTime = System.currentTimeMillis();
+        System.out.println("Time traken to convert SPARQL to Gremlin Traversal : "+ (endTime - startTime)+ " miliseconds");
+        
+        printWithHeadline("SPARQL Query", queryString);
+        // printWithHeadline("Traversal (prior execution)", traversal);
+  
+        
+        Bytecode traversalByteCode = traversal.asAdmin().getBytecode();
+        
+        
+//        JavaTranslator.of(graph.traversal()).translate(traversalByteCode);
+//        
+//        System.out.println("the Byte Code : "+ traversalByteCode.toString());
+        printWithHeadline("Result", String.join(System.lineSeparator(),JavaTranslator.of(graph.traversal()).translate(traversalByteCode).toStream().map(Object::toString).collect(Collectors.toList())));
+        // printWithHeadline("Traversal (after execution)", traversal);
+    }
+
+    private static void printHelp(final int exitCode) throws IOException {
+        final Map<String, String> env = System.getenv();
+        final String command = env.containsKey("LAST_COMMAND") ? env.get("LAST_COMMAND") : "sparql-gremlin.sh";
+        printWithHeadline("Usage Examples", String.join("\n",
+                command + " -f examples/modern1.sparql",
+                command + " < examples/modern2.sparql",
+                command + " <<< 'SELECT * WHERE { ?a e:knows ?b }'",
+                command + " -g crew < examples/crew1.sparql"));
+        if (exitCode >= 0) {
+            System.exit(exitCode);
+        }
+    }
+
+    private static void printWithHeadline(final String headline, final Object content) throws IOException {
+        final StringReader sr = new StringReader(content != null ? content.toString() : "null");
+        final BufferedReader br = new BufferedReader(sr);
+        String line;
+        System.out.println();
+        System.out.println( headline ); 
+        System.out.println();
+        boolean skip = true;
+        while (null != (line = br.readLine())) {
+            skip &= line.isEmpty();
+            if (!skip) {
+                System.out.println("  " + line);
+            }
+        }
+        System.out.println();
+        br.close();
+        sr.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dc8d9fb/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/Prefixes.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/Prefixes.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/Prefixes.java
new file mode 100644
index 0000000..452bf68
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/Prefixes.java
@@ -0,0 +1,64 @@
+/*
+ * 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.sparql;
+
+import java.util.Arrays;
+import java.util.List;
+
+
+public class Prefixes {
+
+	// public final static String BASE_URI = "http://northwind.com/model/";
+    public final static String BASE_URI = "http://www.tinkerpop.com/traversal/";
+
+    final static List<String> PREFIXES = Arrays.asList("edge", "property", "value");
+
+    final static String PREFIX_DEFINITIONS;
+
+    static {
+        final StringBuilder builder = new StringBuilder();
+        for (final String prefix : PREFIXES) {
+            builder.append("PREFIX ").append(prefix.substring(0, 1)).append(": <").append(getURI(prefix)).
+                    append(">").append(System.lineSeparator());
+        }
+        PREFIX_DEFINITIONS = builder.toString();
+    }
+
+    public static String getURI(final String prefix) {
+        return BASE_URI + prefix + "#";
+    }
+
+    public static String getURIValue(final String uri) {
+        return uri.substring(uri.indexOf("#") + 1);
+    }
+
+    public static String getPrefix(final String uri) {
+        final String tmp = uri.substring(0, uri.indexOf("#"));
+        return tmp.substring(tmp.lastIndexOf("/") + 1);
+    }
+
+    public static String prepend(final String script) {
+        return PREFIX_DEFINITIONS + script;
+    }
+
+    public static StringBuilder prepend(final StringBuilder scriptBuilder) {
+        return scriptBuilder.insert(0, PREFIX_DEFINITIONS);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dc8d9fb/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompiler.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompiler.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompiler.java
new file mode 100644
index 0000000..adb36e9
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompiler.java
@@ -0,0 +1,381 @@
+/*
+ * 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.sparql;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.jena.graph.Triple;
+import org.apache.jena.query.Query;
+import org.apache.jena.query.QueryFactory;
+import org.apache.jena.query.SortCondition;
+import org.apache.jena.query.Syntax;
+import org.apache.jena.sparql.algebra.Algebra;
+import org.apache.jena.sparql.algebra.Op;
+import org.apache.jena.sparql.algebra.OpVisitorBase;
+import org.apache.jena.sparql.algebra.OpWalker;
+import org.apache.jena.sparql.algebra.op.OpBGP;
+import org.apache.jena.sparql.algebra.op.OpFilter;
+import org.apache.jena.sparql.algebra.op.OpLeftJoin;
+import org.apache.jena.sparql.algebra.op.OpUnion;
+import org.apache.jena.sparql.core.Var;
+import org.apache.jena.sparql.core.VarExprList;
+import org.apache.jena.sparql.expr.Expr;
+import org.apache.jena.sparql.expr.ExprAggregator;
+import org.apache.tinkerpop.gremlin.process.traversal.Order;
+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.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
+// TODO: implement OpVisitor, don't extend OpVisitorBase
+public class SparqlToGremlinCompiler extends OpVisitorBase {
+
+	private GraphTraversal<Vertex, ?> traversal;
+
+	List<Traversal> traversalList = new ArrayList<Traversal>();
+
+	String groupVariable = "";
+	int sortingDirection = 0;
+	long offsetLimit = 0;
+	String sortingVariable = "";
+
+	GraphTraversalSource temp;
+	Graph graph;
+
+	private SparqlToGremlinCompiler(final GraphTraversal<Vertex, ?> traversal) {
+		this.traversal = traversal;
+	}
+
+	private SparqlToGremlinCompiler(final GraphTraversalSource g) {
+		this(g.V());
+		temp = g;
+
+	}
+
+	private SparqlToGremlinCompiler(final Graph g) {
+		this.traversal = (GraphTraversal<Vertex, ?>) g.traversal();
+		graph = g;
+	}
+
+	public String createMatchStep(String step) {
+		String st = "";
+		step = step.substring(1, step.length() - 2);
+		String first = step.substring(0, step.indexOf(","));
+		String second = step.substring(step.indexOf(",") + 1);
+		//System.out.println("First : " + first);
+		//System.out.println("Second : " + second);
+		st = first.substring(first.indexOf("["), first.length() - 1);
+		st = "[" + st + "," + second + "]";
+		return st;
+	}
+
+	GraphTraversal<Vertex, ?> convertToGremlinTraversal(final Query query) {
+		
+		// long startTime = System.currentTimeMillis();
+		// long endTime;
+		final Op op = Algebra.compile(query); // SPARQL query compiles here to
+												// OP
+//		System.out.println("OP Tree: " + op.toString());
+
+		
+		OpWalker.walk(op, this); // OP is being walked here
+		
+		
+		
+		
+		//System.out.println("time taken for opWalker:"+ (endTime-startTime));
+		// startTime = System.currentTimeMillis();
+		int traversalIndex = 0;
+		int numberOfTraversal = traversalList.size();
+		Traversal arrayOfAllTraversals[] = new Traversal[numberOfTraversal];
+
+		if (query.hasOrderBy() && !query.hasGroupBy()) {
+			List<SortCondition> sortingConditions = query.getOrderBy();
+			int directionOfSort = 0;
+
+			for (SortCondition sortCondition : sortingConditions) {
+				Expr expr = sortCondition.getExpression();
+				directionOfSort = sortCondition.getDirection();
+				sortingVariable = expr.getVarName();
+
+			}
+
+			Order orderDirection = Order.incr;
+			if (directionOfSort == -1) {
+				orderDirection = Order.decr;
+			}
+		}
+		for (Traversal tempTrav : traversalList) {
+
+			arrayOfAllTraversals[traversalIndex++] = tempTrav;
+		}
+
+		int directionOfSort = 0;
+		Order orderDirection = Order.incr;
+		if (query.hasOrderBy()) {
+			List<SortCondition> sortingConditions = query.getOrderBy();
+
+			//
+			for (SortCondition sortCondition : sortingConditions) {
+				Expr expr = sortCondition.getExpression();
+				directionOfSort = sortCondition.getDirection();
+				sortingVariable = expr.getVarName();
+//				System.out.println("order by var: "+sortingDirection);
+			}
+			//
+
+			if (directionOfSort == -1) {
+				orderDirection = Order.decr;
+			}
+
+		}
+
+		if (traversalList.size() > 0)
+			traversal = traversal.match(arrayOfAllTraversals);
+
+		final List<String> vars = query.getResultVars();
+		List<ExprAggregator> lstexpr = query.getAggregators();
+		if (!query.isQueryResultStar() && !query.hasGroupBy()) {
+
+			switch (vars.size()) {
+			case 0:
+				throw new IllegalStateException();
+			case 1:
+				if (query.isDistinct()) {
+//					System.out.println("Inside ------------------- >Select 1------------------------> Distinct");
+					traversal = traversal.dedup(vars.get(0));
+				}
+				if (query.hasOrderBy()) {
+//					System.out.println("Inside ------------------- >Select 1");
+					traversal = traversal.order().by(sortingVariable, orderDirection);
+				} else {
+
+					traversal = traversal.select(vars.get(0));
+				}
+				break;
+			case 2:
+				if (query.isDistinct()) {
+					traversal = traversal.dedup(vars.get(0), vars.get(1));
+				}
+				if (query.hasOrderBy()) {
+//					System.out.println("Inside ------------------- >Select 1");
+					traversal = traversal.order().by(__.select(vars.get(0)), orderDirection).by(__.select(vars.get(1)));
+				} else
+					traversal = traversal.select(vars.get(0), vars.get(1));
+				break;
+			default:
+				final String[] all = new String[vars.size()];
+				vars.toArray(all);
+				if (query.isDistinct()) {
+
+					traversal = traversal.dedup(all);
+				}
+				final String[] others = Arrays.copyOfRange(all, 2, vars.size());
+				if (query.hasOrderBy()) {
+
+					traversal = traversal.order().by(__.select(vars.get(0)), orderDirection).by(__.select(vars.get(1)));
+
+				} else
+					traversal = traversal.select(vars.get(0), vars.get(1), others);
+
+				break;
+			}
+
+		}
+		
+		
+		if (query.hasGroupBy()) {
+			VarExprList lstExpr = query.getGroupBy();
+			String grpVar = "";
+			Traversal tempTrav;
+			for (Var expr : lstExpr.getVars()) {
+				grpVar = expr.getName();
+				// System.out.println("The Group by var: " + expr.getName());
+			}
+
+			if (query.hasLimit()) {
+				long limit = query.getLimit(), offset = 0;
+
+				if (query.hasOffset()) {
+					offset = query.getOffset();
+
+				}
+				// if (query.hasGroupBy() && query.hasOrderBy())
+				// traversal = traversal.range( offset, offset + limit);
+				// else
+				// traversal = traversal.range(offset, offset + limit);
+
+			}
+
+			if (!grpVar.isEmpty())
+				traversal = traversal.select(grpVar);
+			if (query.hasAggregators()) {
+				List<ExprAggregator> exprAgg = query.getAggregators();
+				for (ExprAggregator expr : exprAgg) {
+
+//					System.out.println("The Aggregator by var: " + expr.getAggregator().getExprList().toString()
+//							+ " is :" + expr.getAggregator().toString());
+					if (expr.getAggregator().getName().contains("COUNT")) {
+						if (!query.toString().contains("GROUP")) {
+							if (expr.getAggregator().toString().contains("DISTINCT")) {
+								traversal = traversal
+										.dedup(expr.getAggregator().getExprList().get(0).toString().substring(1));
+							} else {
+								traversal = traversal
+										.select(expr.getAggregator().getExprList().get(0).toString().substring(1));
+							}
+							traversal = traversal.count();
+						} else
+							traversal = traversal.groupCount();
+					}
+					if (expr.getAggregator().getName().contains("MAX")) {
+						traversal = traversal.max();
+					}
+				}
+
+			} else {
+
+				traversal = traversal.group();
+			}
+			
+			
+		}
+
+
+		if (query.hasOrderBy() && query.hasGroupBy()) {
+
+			traversal = traversal.order().by(sortingVariable, orderDirection);
+		}
+		if (query.hasLimit()) {
+			long limit = query.getLimit(), offset = 0;
+
+			if (query.hasOffset()) {
+				offset = query.getOffset();
+
+			}
+			if (query.hasGroupBy() && query.hasOrderBy())
+				traversal = traversal.range(Scope.local, offset, offset + limit);
+			else
+				traversal = traversal.range(offset, offset + limit);
+
+		}
+		// endTime = System.currentTimeMillis();
+		// System.out.println("time taken for convertToGremlinTraversal Function : "+ (endTime-startTime)+" mili seconds");
+		
+		return traversal;
+	}
+
+	private static GraphTraversal<Vertex, ?> convertToGremlinTraversal(final GraphTraversalSource g,
+			final Query query) {
+		return new SparqlToGremlinCompiler(g).convertToGremlinTraversal(query);
+	}
+
+	public static GraphTraversal<Vertex, ?> convertToGremlinTraversal(final Graph graph, final String query) {
+		return convertToGremlinTraversal(graph.traversal(),	QueryFactory.create(Prefixes.prepend(query)));
+	}
+
+	public static GraphTraversal<Vertex, ?> convertToGremlinTraversal(final GraphTraversalSource g,
+			final String query) {
+		return convertToGremlinTraversal(g, QueryFactory.create(Prefixes.prepend(query), Syntax.syntaxSPARQL));
+	}
+
+	// VISITING SPARQL ALGEBRA OP BASIC TRIPLE PATTERNS - MAYBE
+	@Override
+	public void visit(final OpBGP opBGP) {
+		{
+			
+			// System.out.println("Inside opBGP ---------------------------------------------->");
+			final List<Triple> triples = opBGP.getPattern().getList();
+			final Traversal[] matchTraversals = new Traversal[triples.size()];
+			int i = 0;
+			for (final Triple triple : triples) {
+
+				matchTraversals[i++] = TraversalBuilder.transform(triple);
+				traversalList.add(matchTraversals[i - 1]);
+			}
+
+		}
+
+	}
+
+	// VISITING SPARQL ALGEBRA OP FILTER - MAYBE
+	@Override
+	public void visit(final OpFilter opFilter) {
+
+		// System.out.println("Inside opFilter ---------------------------------------------->");
+		Traversal traversal = null;
+
+		for (Expr expr : opFilter.getExprs().getList()) {
+			if (expr != null) {
+
+				traversal = __.where(WhereTraversalBuilder.transform(expr));
+				traversalList.add(traversal);
+			}
+		}
+
+	}
+	// TODO: add more functions for operators other than FILTER, such as
+	// OPTIONAL
+	// This can be done by understanding how Jena handles these other
+	// operators/filters inherently and then map them to Gremlin
+
+	public void visit(final OpLeftJoin opLeftJoin) {
+
+//		System.out.println("Inside opOptional ---------------------------------------------->");
+//		System.out.println(opLeftJoin.getRight().toString());
+
+	}
+
+	@Override
+	public void visit(final OpUnion opUnion) {
+
+		// System.out.println("Inside opUnion ---------------------------------------------->");
+		Traversal unionTemp[] = new Traversal[2];
+		Traversal unionTemp1[] = new Traversal[traversalList.size() / 2];
+		Traversal unionTemp2[] = new Traversal[traversalList.size() / 2];
+
+		int count = 0;
+
+		for (int i = 0; i < traversalList.size(); i++) {
+
+			if (i < traversalList.size() / 2) {
+
+				unionTemp1[i] = traversalList.get(i);
+			} else {
+				unionTemp2[count++] = traversalList.get(i);
+			}
+		}
+
+		unionTemp[1] = __.match(unionTemp2);
+		unionTemp[0] = __.match(unionTemp1);
+
+		traversalList.clear();
+		traversal = (GraphTraversal<Vertex, ?>) traversal.union(unionTemp);
+		// System.out.println("Getting out from Union -------------------> :
+		// "+traversal);
+		// traversalList.add(__.union(unionTemp));
+		// traversalList.clear();
+	}
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dc8d9fb/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/TraversalBuilder.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/TraversalBuilder.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/TraversalBuilder.java
new file mode 100644
index 0000000..72a32a5
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/TraversalBuilder.java
@@ -0,0 +1,82 @@
+/*
+ * 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.sparql;
+
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.structure.PropertyType;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
+
+class TraversalBuilder {
+
+    public static GraphTraversal<?, ?> transform(final Triple triple) {
+        final GraphTraversal<Vertex, ?> matchTraversal = __.as(triple.getSubject().getName());
+        
+        final Node predicate = triple.getPredicate();
+        final String uri = predicate.getURI();
+        final String uriValue = Prefixes.getURIValue(uri);
+        final String prefix = Prefixes.getPrefix(uri);
+
+        switch (prefix) {
+            case "edge":
+                return matchTraversal.out(uriValue).as(triple.getObject().getName());
+            case "property":
+                return matchProperty(matchTraversal, uriValue, PropertyType.PROPERTY, triple.getObject());
+            case "value":
+                return matchProperty(matchTraversal, uriValue, PropertyType.VALUE, triple.getObject());
+            default:
+                throw new IllegalStateException(String.format("Unexpected predicate: %s", predicate));
+        }
+    }
+
+    private static GraphTraversal<?, ?> matchProperty(final GraphTraversal<?, ?> traversal, final String propertyName,
+                                                      final PropertyType type, final Node object) {
+        switch (propertyName) {
+            case "id":
+         
+                return object.isConcrete()
+                        ? traversal.hasId(object.getLiteralValue())
+                        : traversal.id().as(object.getName());
+            case "label":
+                return object.isConcrete()
+                        ? traversal.hasLabel(object.getLiteralValue().toString())
+                        : traversal.label().as(object.getName());
+            case "key":
+                return object.isConcrete()
+                        ? traversal.hasKey(object.getLiteralValue().toString())
+                        : traversal.key().as(object.getName());
+            case "value":
+                return object.isConcrete()
+                        ? traversal.hasValue(object.getLiteralValue().toString())
+                        : traversal.value().as(object.getName());
+            default:
+                if (type.equals(PropertyType.PROPERTY)) {
+                    return traversal.properties(propertyName).as(object.getName());
+                } else {
+                    return object.isConcrete()
+                            ? traversal.values(propertyName).is(object.getLiteralValue())
+                            : traversal.values(propertyName).as(object.getName());
+                }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dc8d9fb/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/WhereTraversalBuilder.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/WhereTraversalBuilder.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/WhereTraversalBuilder.java
new file mode 100644
index 0000000..f4d49b6
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/WhereTraversalBuilder.java
@@ -0,0 +1,134 @@
+/*
+ * 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.sparql;
+
+import java.util.List;
+
+import org.apache.jena.graph.Triple;
+import org.apache.jena.sparql.algebra.op.OpBGP;
+import org.apache.jena.sparql.expr.E_Equals;
+import org.apache.jena.sparql.expr.E_Exists;
+import org.apache.jena.sparql.expr.E_GreaterThan;
+import org.apache.jena.sparql.expr.E_GreaterThanOrEqual;
+import org.apache.jena.sparql.expr.E_LessThan;
+import org.apache.jena.sparql.expr.E_LessThanOrEqual;
+import org.apache.jena.sparql.expr.E_LogicalAnd;
+import org.apache.jena.sparql.expr.E_LogicalOr;
+import org.apache.jena.sparql.expr.E_NotEquals;
+import org.apache.jena.sparql.expr.E_NotExists;
+import org.apache.jena.sparql.expr.E_StrLength;
+import org.apache.jena.sparql.expr.Expr;
+import org.apache.tinkerpop.gremlin.process.traversal.P;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+
+class WhereTraversalBuilder {
+
+    public static GraphTraversal<?, ?> transform(final E_Equals expression) {
+    //	System.out.println("The aggr one : "+expression.getArg1().getClass().getName() + "The aggr one :"+expression.getArg2().getClass().getName());
+        final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
+        return __.as(expression.getArg1().getVarName()).is(P.eq(value));
+    }
+
+    public static GraphTraversal<?, ?> transform(final E_NotEquals expression) {
+        final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
+        return __.as(expression.getArg1().getVarName()).is(P.neq(value));
+    }
+
+    public static GraphTraversal<?, ?> transform(final E_LessThan expression) {
+    //	System.out.println("The aggr one : "+expression.getArg1().getClass().getName() + "The aggr one :"+expression.getArg2().getClass().getName());
+    	final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
+        return __.as(expression.getArg1().getVarName()).is(P.lt(value));
+    }
+
+    public static GraphTraversal<?, ?> transform(final E_LessThanOrEqual expression) {
+    //	System.out.println("The aggr one : "+expression.getArg1().getClass().getName() + "The aggr one :"+expression.getArg2().getClass().getName());
+        final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
+        return __.as(expression.getArg1().getVarName()).is(P.lte(value));
+    }
+
+    public static GraphTraversal<?, ?> transform(final E_GreaterThan expression) {
+        final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
+        return __.as(expression.getArg1().getVarName()).is(P.gt(value));
+    }
+
+    public static GraphTraversal<?, ?> transform(final E_GreaterThanOrEqual expression) {
+        final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
+        return __.as(expression.getArg1().getVarName()).is(P.gte(value));
+    }
+
+    public static GraphTraversal<?, ?> transform(final E_LogicalAnd expression) {
+        return __.and(
+                transform(expression.getArg1()),
+                transform(expression.getArg2()));
+    }
+
+    public static GraphTraversal<?, ?> transform(final E_LogicalOr expression) {
+        return __.or(
+                transform(expression.getArg1()),
+                transform(expression.getArg2()));
+    }
+
+    public static GraphTraversal<?, ?> transform(final E_Exists expression) {
+        final OpBGP opBGP = (OpBGP) expression.getGraphPattern();
+        final List<Triple> triples = opBGP.getPattern().getList();
+        if (triples.size() != 1) throw new IllegalStateException("Unhandled EXISTS pattern");
+        final GraphTraversal<?, ?> traversal = TraversalBuilder.transform(triples.get(0));
+        final Step endStep = traversal.asAdmin().getEndStep();
+        final String label = (String) endStep.getLabels().iterator().next();
+        endStep.removeLabel(label);
+        return traversal;
+    }
+    
+
+    public static GraphTraversal<?, ?> transform(final E_NotExists expression) {
+        final OpBGP opBGP = (OpBGP) expression.getGraphPattern();
+        final List<Triple> triples = opBGP.getPattern().getList();
+        if (triples.size() != 1) throw new IllegalStateException("Unhandled NOT EXISTS pattern");
+        final GraphTraversal<?, ?> traversal = TraversalBuilder.transform(triples.get(0));
+        final Step endStep = traversal.asAdmin().getEndStep();
+        final String label = (String) endStep.getLabels().iterator().next();
+        endStep.removeLabel(label);
+        return __.not(traversal);
+    }
+    
+    public static int getStrLength(final E_StrLength expression){
+    	
+    	return expression.getArg().toString().length();
+    	
+    }
+    
+    
+    //what does <?, ?> signify? possibly <S,E>
+    public static GraphTraversal<?, ?> transform(final Expr expression) {
+        if (expression instanceof E_Equals) return transform((E_Equals) expression);
+        if (expression instanceof E_NotEquals) return transform((E_NotEquals) expression);
+        if (expression instanceof E_LessThan) return transform((E_LessThan) expression);
+        if (expression instanceof E_LessThanOrEqual) return transform((E_LessThanOrEqual) expression);
+        if (expression instanceof E_GreaterThan) return transform((E_GreaterThan) expression);
+        if (expression instanceof E_GreaterThanOrEqual) return transform((E_GreaterThanOrEqual) expression);
+        if (expression instanceof E_LogicalAnd) return transform((E_LogicalAnd) expression);
+        if (expression instanceof E_LogicalOr) return transform((E_LogicalOr) expression);
+        if (expression instanceof E_Exists) return transform((E_Exists) expression);
+        if (expression instanceof E_NotExists) return transform((E_NotExists) expression);
+        throw new IllegalStateException(String.format("Unhandled expression: %s", expression));
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dc8d9fb/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/PrefixesTest.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/PrefixesTest.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/PrefixesTest.java
new file mode 100644
index 0000000..155680b
--- /dev/null
+++ b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/PrefixesTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.sparql;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class PrefixesTest {
+
+    final static String TEST_QUERY = String.join(System.lineSeparator(), "SELECT *", "WHERE {}");
+    final static String PREFIXED_QUERY = String.join(System.lineSeparator(),
+            "PREFIX e: <" + Prefixes.BASE_URI + "edge#>",
+            "PREFIX p: <" + Prefixes.BASE_URI + "property#>",
+            "PREFIX v: <" + Prefixes.BASE_URI + "value#>",
+            TEST_QUERY);
+
+    @Test
+    public void testGetURI() throws Exception {
+        final String prefix = "test";
+        final String uri = Prefixes.BASE_URI + prefix + "#";
+        assertEquals(uri, Prefixes.getURI(prefix));
+    }
+
+    @Test
+    public void testGetURIValue() throws Exception {
+        final String prefix = "test";
+        final String value = "value";
+        final String uri = Prefixes.getURI(prefix) + value;
+        assertEquals(value, Prefixes.getURIValue(uri));
+    }
+
+    @Test
+    public void testGetPrefix() throws Exception {
+        final String prefix = "test";
+        final String uri = Prefixes.getURI(prefix);
+        assertEquals(prefix, Prefixes.getPrefix(uri));
+    }
+
+    @Test
+    public void testPrependString() throws Exception {
+        assertEquals(PREFIXED_QUERY, Prefixes.prepend(TEST_QUERY));
+    }
+
+    @Test
+    public void testPrependStringBuilder() throws Exception {
+        final StringBuilder builder = new StringBuilder(TEST_QUERY);
+        assertEquals(PREFIXED_QUERY, Prefixes.prepend(builder).toString());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dc8d9fb/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/ResourceHelper.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/ResourceHelper.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/ResourceHelper.java
new file mode 100644
index 0000000..4f58e61
--- /dev/null
+++ b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/ResourceHelper.java
@@ -0,0 +1,37 @@
+/*
+ * 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.sparql;
+
+import org.apache.commons.io.IOUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+public class ResourceHelper {
+
+    public static String loadQuery(final String prefix, final int number) throws IOException {
+        final String path = "/queries/" + prefix + number + ".sparql";
+        final InputStream stream = ResourceHelper.class.getResourceAsStream(path);
+        return IOUtils.toString(stream, "UTF-8");
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dc8d9fb/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompilerTest.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompilerTest.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompilerTest.java
new file mode 100644
index 0000000..3fb49e8
--- /dev/null
+++ b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompilerTest.java
@@ -0,0 +1,223 @@
+/*
+ * 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.sparql;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import static org.apache.tinkerpop.gremlin.sparql.SparqlToGremlinCompiler.convertToGremlinTraversal;
+import static org.junit.Assert.assertEquals;
+
+
+import java.io.IOException;
+
+import static org.apache.tinkerpop.gremlin.sparql.ResourceHelper.loadQuery;
+
+
+public class SparqlToGremlinCompilerTest {
+
+    private Graph modern, crew;
+    private GraphTraversalSource mg, cg;
+    private GraphTraversalSource mc, cc;
+/*
+    @Before
+    public void setUp() throws Exception {
+        modern = TinkerFactory.createModern();
+        mg = modern.traversal();
+        mc = modern.traversal(computer());
+        crew = TinkerFactory.createTheCrew();
+        cg = modern.traversal();
+        cc = modern.traversal(computer());
+    }
+
+    @Ignore
+    @Test
+    public void play() throws IOException {
+        final String query = loadQuery("modern", 11);
+        final Traversal traversal = convertToGremlinTraversal(modern, query);
+        System.out.println(traversal);
+        System.out.println(traversal.toList());
+        System.out.println(traversal);
+    }
+
+    /* Modern */
+
+ /*   @Test
+    public void testModern1() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("a").hasLabel("person"),
+                as("a").out("knows").as("b"),
+                as("a").out("created").as("c"),
+                as("b").out("created").as("c"),
+                as("a").values("age").as("d")).where(as("d").is(lt(30))).
+                select("a", "b", "c");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 1)));
+    }
+
+    @Test
+    public void testModern2() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("a").hasLabel("person"),
+                as("a").out("knows").as("b"),
+                as("a").out("created").as("c"),
+                as("b").out("created").as("c"),
+                as("a").values("age").as("d")).where(as("d").is(lt(30)));
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 2)));
+    }
+
+    @Test
+    public void testModern3() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("person").values("name").as("name"),
+                as("person").values("age").as("age")).select("name", "age");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 3)));
+    }
+
+    @Test
+    public void testModern4() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("person").values("name").as("name"),
+                as("person").values("age").as("age"),
+                as("person").out("created").as("project"),
+                as("project").values("name").is("lop")).select("name", "age");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 4)));
+    }
+
+    @Test
+    public void testModern5() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("person").values("name").as("name"),
+                as("person").values("age").is(29)).select("name");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 5)));
+    }
+
+    @Test
+    public void testModern6() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("person").values("name").as("name"),
+                as("person").values("age").as("age")).where(and(as("age").is(gt(30)), as("age").is(lt(40)))).
+                select("name", "age");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 6)));
+    }
+
+    @Test
+    public void testModern7() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("person").values("name").as("name"),
+                as("person").values("age").as("age")).where(or(as("age").is(lt(30)), as("age").is(gt(40)))).
+                select("name", "age");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 7)));
+    }
+
+    @Test
+    public void testModern8() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("person").values("name").as("name"),
+                as("person").values("age").as("age")).where(
+                or(and(as("age").is(gt(30)), as("age").is(lt(40))), as("name").is("marko"))).
+                select("name", "age");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 8)));
+    }
+
+    @Test
+    public void testModern9() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("a").values("name").as("name")).where(as("a").values("age")).
+                select("name");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 9)));
+    }
+
+    @Test
+    public void testModern10() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("a").values("name").as("name")).where(__.not(as("a").values("age"))).
+                select("name");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 10)));
+    }
+
+    @Test
+    public void testModern11() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("a").out("created").as("b"),
+                as("a").values("name").as("name")).dedup("name").select("name");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 11)));
+    }
+
+    @Test
+    public void testModern12() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("a").out("created").as("b"),
+                as("b").values("name").as("name")).dedup();
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 12)));
+    }
+
+    @Test
+    public void testModern13() throws Exception {
+        final GraphTraversal expected = mg.V().match(
+                as("a").out("created").as("b"),
+                as("a").values("name").as("c")).dedup("a", "b", "c").select("a", "b", "c");
+        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 13)));
+    }
+
+    /* The Crew */
+
+ /*   @Test
+    public void testCrew1() throws Exception {
+        final GraphTraversal expected = cg.V().match(
+                as("a").values("name").is("daniel"),
+                as("a").properties("location").as("b"),
+                as("b").value().as("c"),
+                as("b").values("startTime").as("d")).
+                select("c", "d");
+        assertEquals(expected, convertToGremlinTraversal(crew, loadQuery("crew", 1)));
+    }
+
+    /* Computer Mode */
+
+  /*  @Test
+    public void testModernInComputerMode() throws Exception {
+        final GraphTraversal expected = mc.V().match(
+                as("a").hasLabel("person"),
+                as("a").out("knows").as("b"),
+                as("a").out("created").as("c"),
+                as("b").out("created").as("c"),
+                as("a").values("age").as("d")).where(as("d").is(lt(30))).
+                select("a", "b", "c");
+        assertEquals(expected, convertToGremlinTraversal(mc, loadQuery("modern", 1)));
+    }
+
+    @Test
+    public void testCrewInComputerMode() throws Exception {
+        final GraphTraversal expected = cc.V().match(
+                as("a").values("name").is("daniel"),
+                as("a").properties("location").as("b"),
+                as("b").value().as("c"),
+                as("b").values("startTime").as("d")).
+                select("c", "d");
+        assertEquals(expected, convertToGremlinTraversal(crew, loadQuery("crew", 1)));
+    } */
+}
\ No newline at end of file


[16/50] tinkerpop git commit: Merge branch 'tp33'

Posted by sp...@apache.org.
Merge branch 'tp33'


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

Branch: refs/heads/TINKERPOP-1878
Commit: d3b6a340dbb9c89355c40089a5c083dc0dbd4c5b
Parents: ae2f304 d4c76a6
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Sat Jun 9 13:34:46 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Sat Jun 9 13:34:46 2018 +0200

----------------------------------------------------------------------
 .travis.yml | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[36/50] tinkerpop git commit: TINKERPOP-1878 Added a test for ordering and corrected some problems in logic

Posted by sp...@apache.org.
TINKERPOP-1878 Added a test for ordering and corrected some problems in logic

Ordering didn't work - at least not completely. The test, as it is written in this commit, that failed to sort properly. Changed the logic for ordering to track all of the keys specified to ORDER with their appropriate ASC/DESC operators and added all of them to the traversal.


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

Branch: refs/heads/TINKERPOP-1878
Commit: 923f04cdfe58904e17d20557aa15ff116e0498d2
Parents: 2d4c8c9
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 26 15:41:10 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 .../sparql/SparqlToGremlinTranspiler.java       | 55 ++++++--------------
 .../dsl/sparql/SparqlTraversalSourceTest.java   | 31 +++++++++--
 2 files changed, 44 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/923f04cd/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
index 9db7d82..ea3f828 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
@@ -21,9 +21,10 @@ package org.apache.tinkerpop.gremlin.sparql;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
-import org.apache.jena.graph.Triple;
 import org.apache.jena.query.Query;
 import org.apache.jena.query.QueryFactory;
 import org.apache.jena.query.SortCondition;
@@ -58,8 +59,6 @@ public class SparqlToGremlinTranspiler {
 
     private List<Traversal> traversalList = new ArrayList<>();
 
-    private String sortingVariable = "";
-
 	private SparqlToGremlinTranspiler(final GraphTraversal<Vertex, ?> traversal) {
 		this.traversal = traversal;
 	}
@@ -96,31 +95,18 @@ public class SparqlToGremlinTranspiler {
 		final int numberOfTraversal = traversalList.size();
         final Traversal arrayOfAllTraversals[] = new Traversal[numberOfTraversal];
 
-		if (query.hasOrderBy() && !query.hasGroupBy()) {
-            final List<SortCondition> sortingConditions = query.getOrderBy();
-
-			for (SortCondition sortCondition : sortingConditions) {
-                final Expr expr = sortCondition.getExpression();
-				sortingVariable = expr.getVarName();
-			}
-		}
-
 		for (Traversal tempTrav : traversalList) {
 			arrayOfAllTraversals[traversalIndex++] = tempTrav;
 		}
 
-		Order orderDirection = Order.incr;
+		final Map<String, Order> orderingIndex = new HashMap<>();
 		if (query.hasOrderBy()) {
-            int directionOfSort = 0;
             final List<SortCondition> sortingConditions = query.getOrderBy();
 
 			for (SortCondition sortCondition : sortingConditions) {
                 final Expr expr = sortCondition.getExpression();
-				directionOfSort = sortCondition.getDirection();
-				sortingVariable = expr.getVarName();
+                orderingIndex.put(expr.getVarName(), sortCondition.getDirection() == 1 ? Order.incr : Order.decr);
 			}
-
-			if (directionOfSort == -1) orderDirection = Order.decr;
 		}
 
 		if (traversalList.size() > 0)
@@ -128,6 +114,8 @@ public class SparqlToGremlinTranspiler {
 
 		final List<String> vars = query.getResultVars();
 		if (!query.isQueryResultStar() && !query.hasGroupBy()) {
+		    // the result sizes have special handling to get the right signatures of select() called. perhaps this
+            // could be refactored to work more nicely
             switch (vars.size()) {
                 case 0:
                     throw new IllegalStateException();
@@ -135,20 +123,16 @@ public class SparqlToGremlinTranspiler {
                     if (query.isDistinct())
                         traversal = traversal.dedup(vars.get(0));
 
-                    if (query.hasOrderBy())
-                        traversal = traversal.order().by(sortingVariable, orderDirection);
-                    else
-                        traversal = traversal.select(vars.get(0));
+                    orderingIndex.forEach((k,v) -> traversal = traversal.order().by(__.select(k), v));
+                    traversal = traversal.select(vars.get(0));
 
                     break;
                 case 2:
                     if (query.isDistinct())
                         traversal = traversal.dedup(vars.get(0), vars.get(1));
 
-                    if (query.hasOrderBy())
-                        traversal = traversal.order().by(__.select(vars.get(0)), orderDirection).by(__.select(vars.get(1)));
-                    else
-                        traversal = traversal.select(vars.get(0), vars.get(1));
+                    orderingIndex.forEach((k,v) -> traversal = traversal.order().by(__.select(k), v));
+                    traversal = traversal.select(vars.get(0), vars.get(1));
 
                     break;
                 default:
@@ -157,11 +141,11 @@ public class SparqlToGremlinTranspiler {
                     if (query.isDistinct())
                         traversal = traversal.dedup(all);
 
+                    orderingIndex.forEach((k,v) -> traversal = traversal.order().by(__.select(k), v));
+
+                    // just some shenanigans to get the right signature of select() called
                     final String[] others = Arrays.copyOfRange(all, 2, vars.size());
-                    if (query.hasOrderBy())
-                        traversal = traversal.order().by(__.select(vars.get(0)), orderDirection).by(__.select(vars.get(1)));
-                    else
-                        traversal = traversal.select(vars.get(0), vars.get(1), others);
+                    traversal = traversal.select(vars.get(0), vars.get(1), others);
 
                     break;
             }
@@ -202,7 +186,7 @@ public class SparqlToGremlinTranspiler {
 		}
 
 		if (query.hasOrderBy() && query.hasGroupBy())
-			traversal = traversal.order().by(sortingVariable, orderDirection);
+            orderingIndex.forEach((k,v) -> traversal = traversal.order().by(__.select(k), v));
 
 		if (query.hasLimit()) {
 			long limit = query.getLimit(), offset = 0;
@@ -233,14 +217,7 @@ public class SparqlToGremlinTranspiler {
          */
         @Override
         public void visit(final OpBGP opBGP) {
-            final List<Triple> triples = opBGP.getPattern().getList();
-            final Traversal[] matchTraversals = new Traversal[triples.size()];
-            int i = 0;
-            for (final Triple triple : triples) {
-
-                matchTraversals[i++] = TraversalBuilder.transform(triple);
-                traversalList.add(matchTraversals[i - 1]);
-            }
+            opBGP.getPattern().getList().forEach(triple -> traversalList.add(TraversalBuilder.transform(triple)));
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/923f04cd/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
index 9bb6025..2743255 100644
--- a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
+++ b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
@@ -27,16 +27,18 @@ import java.util.List;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
+import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class SparqlTraversalSourceTest {
 
+    private static final Graph graph = TinkerFactory.createModern();
+    private static final SparqlTraversalSource g = graph.traversal(SparqlTraversalSource.class);
+
     @Test
-    public void shouldDoStuff() {
-        final Graph graph = TinkerFactory.createModern();
-        final SparqlTraversalSource g = graph.traversal(SparqlTraversalSource.class);
+    public void shouldFindAllPersonsNamesAndAges() {
         final List<?> x = g.sparql("SELECT ?name ?age WHERE { ?person v:name ?name . ?person v:age ?age }").toList();
         assertThat(x, containsInAnyOrder(
                 new HashMap<String,Object>(){{
@@ -57,4 +59,27 @@ public class SparqlTraversalSourceTest {
                 }}
         ));
     }
+
+    @Test
+    public void shouldFindAllPersonsNamesAndAgesOrdered() {
+        final List<?> x = g.sparql("SELECT ?name ?age WHERE { ?person v:name ?name . ?person v:age ?age } ORDER BY ASC(?age)").toList();
+        assertThat(x, contains(
+                new HashMap<String,Object>(){{
+                    put("name", "vadas");
+                    put("age", 27);
+                }},
+                new HashMap<String,Object>(){{
+                    put("name", "marko");
+                    put("age", 29);
+                }},
+                new HashMap<String,Object>(){{
+                    put("name", "josh");
+                    put("age", 32);
+                }},
+                new HashMap<String,Object>(){{
+                    put("name", "peter");
+                    put("age", 35);
+                }}
+        ));
+    }
 }


[05/50] tinkerpop git commit: Removed some previously deprecated structures

Posted by sp...@apache.org.
Removed some previously deprecated structures

These deprecations were typically pretty old, going back to 3.2.x and were generally for internal or provider usage. They were an odd mismatch of things so I didn't bother to createa JIRA for them, but documented them all fully in changelog and upgrade docs. CTR


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

Branch: refs/heads/TINKERPOP-1878
Commit: b75cfb8ec529aad957d5a631b15cc3afcf86186f
Parents: d5b54fe
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jun 5 09:16:55 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jun 5 09:16:55 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  4 +
 docs/src/upgrade/release-3.4.x.asciidoc         |  9 ++-
 .../step/map/LambdaCollectingBarrierStep.java   | 13 ----
 .../traversal/step/util/HasContainer.java       | 18 -----
 .../Process/Traversal/GraphTraversal.cs         |  9 ---
 .../jsr223/GremlinGroovyScriptEngine.java       | 13 +---
 ...mlinGroovyScriptEngineCompileStaticTest.java | 29 ++++----
 ...remlinGroovyScriptEngineFileSandboxTest.java | 43 ++++++-----
 ...GroovyScriptEngineSandboxedStandardTest.java | 78 ++++++++++----------
 ...nGroovyScriptEngineTinkerPopSandboxTest.java | 17 +++--
 ...remlinGroovyScriptEngineTypeCheckedTest.java | 29 ++++----
 .../lib/process/graph-traversal.js              | 10 ---
 .../gremlin_python/process/graph_traversal.py   |  4 -
 .../hadoop/structure/HadoopConfiguration.java   | 24 ------
 14 files changed, 111 insertions(+), 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 14b084c..75974c0 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -34,12 +34,16 @@ This release also includes changes from <<release-3-3-3, 3.3.3>>.
 * Removed previously deprecated Credentials DSL infrastructure.
 * Moved `TraversalEngine` to `gremlin-test` as it has long been only used in testing infrastructure.
 * Removed previously deprecated `OpSelectorHandler` constructor.
+* Removed previously deprecated `close()` from `GremlinGroovyScriptEngine` which no longer implements `AutoCloseable`.
+* Removed previously deprecated `getGraphInputFormat()` and `getGraphOutputFormat()` from `HadoopConfiguration`.
 * Removed previously deprecated `AbstractOpProcessor#makeFrame()` method.
 * Removed previously deprecated `AuthenticationSettings.className` configuration option in Gremlin Server.
 * Removed previously deprecated `GraphManager` methods `getGraphs()` and `getTraversalSources()`.
 * Removed previously deprecated Gremlin Server setting for `serializedResponseTimeout`.
 * Removed previously deprecated Structure API exceptions related to "element not found" situations.
 * Removed previously deprecated `rebindings` options from the Java driver API.
+* Removed previously deprecated `LambdaCollectingBarrierStep.Consumers` enum.
+* Removed previously deprecated `HasContainer#makeHasContainers(String, P)`
 * Removed support for Giraph.
 
 == TinkerPop 3.3.0 (Gremlin Symphony #40 in G Minor)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.4.x.asciidoc b/docs/src/upgrade/release-3.4.x.asciidoc
index 3c881c3..98b6045 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -82,8 +82,10 @@ gremlin> g.V().values('name').max()
 The following deprecated classes, methods or fields have been removed in this version:
 
 * `gremlin-core`
-** `org.apache.tinkerpop.gremlin.process.traversal.engine.*`
 ** `org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine`
+** `org.apache.tinkerpop.gremlin.process.traversal.engine.*`
+** `org.apache.tinkerpop.gremlin.process.traversal.step.map.LambdaCollectingBarrierStep.Consumers`
+** `org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer#makeHasContainers(String, P)`
 ** `org.apache.tinkerpop.gremlin.structure.Element.Exceptions#elementAlreadyRemoved(Class, Object)`
 ** `org.apache.tinkerpop.gremlin.structure.Graph.Exceptions#elementNotFound(Class, Object)`
 ** `org.apache.tinkerpop.gremlin.structure.Graph.Exceptions#elementNotFound(Class, Object, Exception)`
@@ -91,6 +93,8 @@ The following deprecated classes, methods or fields have been removed in this ve
 ** `org.apache.tinkerpop.gremlin.driver.Client#rebind(String)`
 ** `org.apache.tinkerpop.gremlin.driver.Client.ReboundClusterdClient`
 ** `org.apache.tinkerpop.gremlin.driver.Tokens#ARGS_REBINDINGS`
+* `gremlin-groovy`
+** `org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.close()` - no longer implements `AutoCloseable`
 * `gremlin-server`
 ** `org.apache.tinkerpop.gremlin.server.GraphManager#getGraphs()`
 ** `org.apache.tinkerpop.gremlin.server.GraphManager#getTraversalSources()`
@@ -98,6 +102,9 @@ The following deprecated classes, methods or fields have been removed in this ve
 ** `org.apache.tinkerpop.gremlin.server.Settings.AuthenticationSettings#className`
 ** `org.apache.tinkerpop.gremlin.server.handler.OpSelectorHandler(Settings, GraphManager, GremlinExecutor, ScheduledExecutorService)`
 ** `org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor#makeFrame(ChannelHandlerContext, RequestMessage, MessageSerializer serializer, boolean, List, ResponseStatusCode code)`
+* `hadoop-graph`
+** `org.apache.tinkerpop.gremlin.hadoop.structure.HadoopConfiguration#getGraphInputFormat()`
+** `org.apache.tinkerpop.gremlin.hadoop.structure.HadoopConfiguration#getGraphOutputFormat()`
 
 Please see the javadoc deprecation notes or upgrade documentation specific to when the deprecation took place to
 understand how to resolve this breaking change.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
index 9b500d4..ef41b61 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
@@ -32,19 +32,6 @@ import java.util.function.Consumer;
  */
 public final class LambdaCollectingBarrierStep<S> extends CollectingBarrierStep<S> implements LambdaHolder {
 
-    /**
-     * @deprecated As of release 3.2.0, replaced by use of {@link NoOpBarrierStep}.
-     */
-    @Deprecated
-    public enum Consumers implements Consumer<TraverserSet<Object>> {
-        noOp {
-            @Override
-            public void accept(final TraverserSet<Object> traverserSet) {
-
-            }
-        }
-    }
-
     private final Consumer<TraverserSet<S>> barrierConsumer;
 
     public LambdaCollectingBarrierStep(final Traversal.Admin traversal, final Consumer<TraverserSet<S>> barrierConsumer, final int maxBarrierSize) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java
index 08ab389..9e3ab91 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java
@@ -182,22 +182,4 @@ public class HasContainer implements Serializable, Cloneable, Predicate<Element>
         }
         return true;
     }
-
-
-    /**
-     * @deprecated As of release 3.2.4. Providers should handle composite {@link P#and} predicates and not rely on splitting.
-     */
-    @Deprecated
-    public static HasContainer[] makeHasContainers(final String key, final P<?> predicate) {
-        if (predicate instanceof AndP) {
-            final List<P<?>> predicates = ((AndP) predicate).getPredicates();
-            final HasContainer[] hasContainers = new HasContainer[predicates.size()];
-            for (int i = 0; i < predicates.size(); i++) {
-                hasContainers[i] = new HasContainer(key, predicates.get(i));
-            }
-            return hasContainers;
-        } else {
-            return new HasContainer[]{new HasContainer(key, predicate)};
-        }
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index bb3d5d8..9952455 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -1676,14 +1676,5 @@ namespace Gremlin.Net.Process.Traversal
             return Wrap<S, E>(this);
         }
 
-        /// <summary>
-        ///     Adds the with step to this <see cref="GraphTraversal{SType, EType}" />.
-        /// </summary>
-        public GraphTraversal<S, E> With (StepConfiguration modulation)
-        {
-            Bytecode.AddStep("with", modulation);
-            return Wrap<S, E>(this);
-        }
-
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 03ea883..e2af3aa 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -29,7 +29,6 @@ import groovy.lang.MissingMethodException;
 import groovy.lang.MissingPropertyException;
 import groovy.lang.Script;
 import groovy.lang.Tuple;
-import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.tinkerpop.gremlin.groovy.loaders.GremlinLoader;
 import org.apache.tinkerpop.gremlin.jsr223.ConcurrentBindings;
 import org.apache.tinkerpop.gremlin.jsr223.CoreGremlinPlugin;
@@ -89,8 +88,7 @@ import java.util.stream.Collectors;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  * @see org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor
  */
-public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
-        implements AutoCloseable, GremlinScriptEngine {
+public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl implements GremlinScriptEngine {
 
     private static final Logger log = LoggerFactory.getLogger(GremlinGroovyScriptEngine.class);
     /**
@@ -310,15 +308,6 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
     }
 
     /**
-     * @deprecated As of release 3.2.4, not replaced as this class will not implement {@code AutoCloseable} in the
-     * future.
-     */
-    @Override
-    @Deprecated
-    public void close() throws Exception {
-    }
-
-    /**
      * Resets the entire {@code GremlinGroovyScriptEngine} by clearing script caches, recreating the classloader,
      * clearing bindings.
      */

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
index b5949a2..f6bea6e 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompileStaticTest.java
@@ -37,12 +37,12 @@ public class GremlinGroovyScriptEngineCompileStaticTest {
     @Test
     public void shouldCompileStatic() throws Exception {
         // with no type checking this should pass
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine()) {
-            assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));
-        }
+        GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine();
+        assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));
 
         final CompileStaticGroovyCustomizer provider = new CompileStaticGroovyCustomizer();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(provider)) {
+        scriptEngine = new GremlinGroovyScriptEngine(provider);
+        try {
             scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()");
             fail("Should have failed type checking");
         } catch (ScriptException se) {
@@ -56,13 +56,13 @@ public class GremlinGroovyScriptEngineCompileStaticTest {
     public void shouldCompileStaticWithExtension() throws Exception {
         // with no type checking extension this should pass
         final CompileStaticGroovyCustomizer providerNoExtension = new CompileStaticGroovyCustomizer();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
-            assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
-        }
+        GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension);
+        assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
 
         final CompileStaticGroovyCustomizer providerWithExtension = new CompileStaticGroovyCustomizer(
                 PrecompiledExtensions.PreventColorUsageExtension.class.getName());
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
+        scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension);
+        try {
             scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
             fail("Should have failed type checking");
         } catch (ScriptException se) {
@@ -75,15 +75,15 @@ public class GremlinGroovyScriptEngineCompileStaticTest {
     public void shouldCompileStaticWithMultipleExtension() throws Exception {
         // with no type checking extension this should pass
         final CompileStaticGroovyCustomizer providerNoExtension = new CompileStaticGroovyCustomizer();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
-            assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
-            assertEquals(1l, scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count"));
-        }
+        GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension);
+        assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
+        assertEquals(1l, scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count"));
 
         final CompileStaticGroovyCustomizer providerWithExtension = new CompileStaticGroovyCustomizer(
                 PrecompiledExtensions.PreventColorUsageExtension.class.getName() +
                         "," + PrecompiledExtensions.PreventCountDownLatchUsageExtension.class.getName());
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
+        scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension);
+        try {
             scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
             fail("Should have failed type checking");
         } catch (ScriptException se) {
@@ -91,7 +91,8 @@ public class GremlinGroovyScriptEngineCompileStaticTest {
             assertThat(se.getMessage(), containsString("Method call is not allowed!"));
         }
 
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
+        scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension);
+        try {
             scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count");
             fail("Should have failed type checking");
         } catch (ScriptException se) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineFileSandboxTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineFileSandboxTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineFileSandboxTest.java
index 12925b8..c92581a 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineFileSandboxTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineFileSandboxTest.java
@@ -70,35 +70,33 @@ public class GremlinGroovyScriptEngineFileSandboxTest {
         final File f = TestHelper.generateTempFileFromResource(graph.getClass(), GremlinGroovyScriptEngineFileSandboxTest.class, "sandbox-empty-static-variable-types.yaml", ".yaml");
         System.setProperty(FileSandboxExtension.GREMLIN_SERVER_SANDBOX, f.getAbsolutePath());
         final CompileStaticGroovyCustomizer standardSandbox = new CompileStaticGroovyCustomizer(FileSandboxExtension.class.getName());
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) {
-            assertEquals(123, engine.eval("java.lang.Math.abs(-123)"));
-            assertThat(engine.eval("new Boolean(true)"), is(true));
-            assertThat(engine.eval("new Boolean(true).toString()"), is("true"));
-        }
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox);
+        assertEquals(123, engine.eval("java.lang.Math.abs(-123)"));
+        assertThat(engine.eval("new Boolean(true)"), is(true));
+        assertThat(engine.eval("new Boolean(true).toString()"), is("true"));
     }
 
     @Test
     public void shouldEvalAsTheMethodIsWhiteListed() throws Exception {
         final CompileStaticGroovyCustomizer standardSandbox = new CompileStaticGroovyCustomizer(FileSandboxExtension.class.getName());
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) {
-            assertEquals(123, engine.eval("java.lang.Math.abs(-123)"));
-            assertThat(engine.eval("new Boolean(true)"), is(true));
-            assertThat(engine.eval("new Boolean(true).toString()"), is("true"));
-        }
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox);
+        assertEquals(123, engine.eval("java.lang.Math.abs(-123)"));
+        assertThat(engine.eval("new Boolean(true)"), is(true));
+        assertThat(engine.eval("new Boolean(true).toString()"), is("true"));
     }
 
     @Test
     public void shouldEvalAsGroovyPropertiesWhenWhiteListed() throws Exception {
         final CompileStaticGroovyCustomizer standardSandbox = new CompileStaticGroovyCustomizer(FileSandboxExtension.class.getName());
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) {
-            assertThat(Arrays.equals("test".getBytes(), (byte[]) engine.eval("'test'.bytes")), is(true));
-        }
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox);
+        assertThat(Arrays.equals("test".getBytes(), (byte[]) engine.eval("'test'.bytes")), is(true));
     }
 
     @Test
     public void shouldPreventMaliciousStuffWithSystemButAllowSomeMethodsOnSystem() throws Exception {
         final CompileStaticGroovyCustomizer standardSandbox = new CompileStaticGroovyCustomizer(FileSandboxExtension.class.getName());
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) {
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox);
+        try {
             assertThat((long) engine.eval("System.currentTimeMillis()"), greaterThan(0L));
             assertThat((long) engine.eval("System.nanoTime()"), greaterThan(0L));
 
@@ -113,7 +111,8 @@ public class GremlinGroovyScriptEngineFileSandboxTest {
     @Test
     public void shouldPreventMaliciousStuffWithFile() throws Exception {
         final CompileStaticGroovyCustomizer standardSandbox = new CompileStaticGroovyCustomizer(FileSandboxExtension.class.getName());
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) {
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox);
+        try {
             engine.eval("java.nio.file.FileSystems.getDefault()");
             fail("Should have a compile error because class/method is not white listed");
         } catch (Exception ex) {
@@ -126,13 +125,13 @@ public class GremlinGroovyScriptEngineFileSandboxTest {
     @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldEvalOnGAsTheMethodIsWhiteListed() throws Exception {
         final CompileStaticGroovyCustomizer standardSandbox = new CompileStaticGroovyCustomizer(FileSandboxExtension.class.getName());
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) {
-            final Bindings bindings = engine.createBindings();
-            bindings.put("g", g);
-            bindings.put("marko", convertToVertexId(graph, "marko"));
-            assertEquals(g.V(convertToVertexId(graph, "marko")).next(), engine.eval("g.V(marko).next()", bindings));
-            assertEquals(g.V(convertToVertexId(graph, "marko")).out("created").count().next(), engine.eval("g.V(marko).out(\"created\").count().next()", bindings));
-        }
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox);
+
+        final Bindings bindings = engine.createBindings();
+        bindings.put("g", g);
+        bindings.put("marko", convertToVertexId(graph, "marko"));
+        assertEquals(g.V(convertToVertexId(graph, "marko")).next(), engine.eval("g.V(marko).next()", bindings));
+        assertEquals(g.V(convertToVertexId(graph, "marko")).out("created").count().next(), engine.eval("g.V(marko).out(\"created\").count().next()", bindings));
     }
 
     private Object convertToVertexId(final Graph graph, final String vertexName) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineSandboxedStandardTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineSandboxedStandardTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineSandboxedStandardTest.java
index c3bac74..b203ba8 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineSandboxedStandardTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineSandboxedStandardTest.java
@@ -61,15 +61,15 @@ public class GremlinGroovyScriptEngineSandboxedStandardTest {
     public void shouldEvalGraphTraversalSource() throws Exception {
         final Graph graph = TinkerFactory.createModern();
         final GraphTraversalSource g = graph.traversal();
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine()) {
-            final Bindings bindings = engine.createBindings();
-            bindings.put("g", g);
-            bindings.put("marko", convertToVertexId(graph, "marko"));
-            assertEquals(g.V(convertToVertexId(graph, "marko")).next(), engine.eval("g.V(marko).next()", bindings));
-        }
-
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(notSandboxed)) {
-            final Bindings bindings = engine.createBindings();
+        GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
+        Bindings bindings = engine.createBindings();
+        bindings.put("g", g);
+        bindings.put("marko", convertToVertexId(graph, "marko"));
+        assertEquals(g.V(convertToVertexId(graph, "marko")).next(), engine.eval("g.V(marko).next()", bindings));
+
+        engine = new GremlinGroovyScriptEngine(notSandboxed);
+        try {
+            bindings = engine.createBindings();
             bindings.put("g", g);
             bindings.put("marko", convertToVertexId(graph, "marko"));
             engine.eval("g.V(marko).next()", bindings);
@@ -79,28 +79,27 @@ public class GremlinGroovyScriptEngineSandboxedStandardTest {
             assertThat(ex.getMessage(), containsString("The variable [g] is undeclared."));
         }
 
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(sandboxed)) {
-            final Bindings bindings = engine.createBindings();
-            bindings.put("g", g);
-            bindings.put("marko", convertToVertexId(graph, "marko"));
-            assertEquals(g.V(convertToVertexId(graph, "marko")).next(), engine.eval("g.V(marko).next()", bindings));
-            assertEquals(g.V(convertToVertexId(graph, "marko")).out("created").count().next(), engine.eval("g.V(marko).out(\"created\").count().next()", bindings));
-        }
+        engine = new GremlinGroovyScriptEngine(sandboxed);
+        bindings = engine.createBindings();
+        bindings.put("g", g);
+        bindings.put("marko", convertToVertexId(graph, "marko"));
+        assertEquals(g.V(convertToVertexId(graph, "marko")).next(), engine.eval("g.V(marko).next()", bindings));
+        assertEquals(g.V(convertToVertexId(graph, "marko")).out("created").count().next(), engine.eval("g.V(marko).out(\"created\").count().next()", bindings));
     }
 
     @Test
     public void shouldEvalGraph() throws Exception {
         final Graph graph = TinkerFactory.createModern();
         final GraphTraversalSource g = graph.traversal();
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine()) {
-            final Bindings bindings = engine.createBindings();
-            bindings.put("graph", graph);
-            bindings.put("marko", convertToVertexId(graph, "marko"));
-            assertEquals(graph.vertices(convertToVertexId(graph, "marko")).next(), engine.eval("graph.vertices(marko).next()", bindings));
-        }
-
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(notSandboxed)) {
-            final Bindings bindings = engine.createBindings();
+        GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
+        Bindings bindings = engine.createBindings();
+        bindings.put("graph", graph);
+        bindings.put("marko", convertToVertexId(graph, "marko"));
+        assertEquals(graph.vertices(convertToVertexId(graph, "marko")).next(), engine.eval("graph.vertices(marko).next()", bindings));
+
+        engine = new GremlinGroovyScriptEngine(notSandboxed);
+        try {
+            bindings = engine.createBindings();
             bindings.put("graph", graph);
             bindings.put("marko", convertToVertexId(graph, "marko"));
             assertEquals(graph.vertices(convertToVertexId(graph, "marko")).next(), engine.eval("graph.vertices(marko).next()", bindings));
@@ -110,8 +109,9 @@ public class GremlinGroovyScriptEngineSandboxedStandardTest {
             assertThat(ex.getMessage(), containsString("The variable [graph] is undeclared."));
         }
 
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(notSandboxed)) {
-            final Bindings bindings = engine.createBindings();
+        engine = new GremlinGroovyScriptEngine(notSandboxed);
+        try {
+            bindings = engine.createBindings();
             bindings.put("graph", graph);
             bindings.put("x", convertToVertexId(graph, "marko"));
             assertEquals(graph.vertices(convertToVertexId(graph, "marko")).next(), engine.eval("graph.vertices(x).next()", bindings));
@@ -121,19 +121,17 @@ public class GremlinGroovyScriptEngineSandboxedStandardTest {
             assertThat(ex.getMessage(), containsString("The variable [graph] is undeclared."));
         }
 
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(sandboxed)) {
-            final Bindings bindings = engine.createBindings();
-            bindings.put("graph", graph);
-            bindings.put("marko", convertToVertexId(graph, "marko"));
-            assertEquals(graph.vertices(convertToVertexId(graph, "marko")).next(), engine.eval("graph.vertices(marko).next()", bindings));
-        }
-
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(sandboxed)) {
-            final Bindings bindings = engine.createBindings();
-            bindings.put("graph", graph);
-            bindings.put("x", convertToVertexId(graph, "marko"));
-            assertEquals(graph.vertices(convertToVertexId(graph, "marko")).next(), engine.eval("graph.vertices(x).next()", bindings));
-        }
+        engine = new GremlinGroovyScriptEngine(sandboxed);
+        bindings = engine.createBindings();
+        bindings.put("graph", graph);
+        bindings.put("marko", convertToVertexId(graph, "marko"));
+        assertEquals(graph.vertices(convertToVertexId(graph, "marko")).next(), engine.eval("graph.vertices(marko).next()", bindings));
+
+        engine = new GremlinGroovyScriptEngine(sandboxed);
+        bindings = engine.createBindings();
+        bindings.put("graph", graph);
+        bindings.put("x", convertToVertexId(graph, "marko"));
+        assertEquals(graph.vertices(convertToVertexId(graph, "marko")).next(), engine.eval("graph.vertices(x).next()", bindings));
     }
 
     private Object convertToVertexId(final Graph graph, final String vertexName) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTinkerPopSandboxTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTinkerPopSandboxTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTinkerPopSandboxTest.java
index c2d555f..fd36eaa 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTinkerPopSandboxTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTinkerPopSandboxTest.java
@@ -40,7 +40,8 @@ public class GremlinGroovyScriptEngineTinkerPopSandboxTest {
     @Test
     public void shouldNotEvalAsTheMethodIsNotWhiteListed() throws Exception {
         final CompileStaticGroovyCustomizer standardSandbox = new CompileStaticGroovyCustomizer(TinkerPopSandboxExtension.class.getName());
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) {
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox);
+        try {
             engine.eval("java.lang.Math.abs(123)");
             fail("Should have a compile error because class/method is not white listed");
         } catch (Exception ex) {
@@ -54,13 +55,13 @@ public class GremlinGroovyScriptEngineTinkerPopSandboxTest {
         final Graph graph = TinkerFactory.createModern();
         final GraphTraversalSource g = graph.traversal();
         final CompileStaticGroovyCustomizer standardSandbox = new CompileStaticGroovyCustomizer(TinkerPopSandboxExtension.class.getName());
-        try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) {
-            final Bindings bindings = engine.createBindings();
-            bindings.put("g", g);
-            bindings.put("marko", convertToVertexId(graph, "marko"));
-            assertEquals(g.V(convertToVertexId(graph, "marko")).next(), engine.eval("g.V(marko).next()", bindings));
-            assertEquals(g.V(convertToVertexId(graph, "marko")).out("created").count().next(), engine.eval("g.V(marko).out(\"created\").count().next()", bindings));
-        }
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox);
+
+        final Bindings bindings = engine.createBindings();
+        bindings.put("g", g);
+        bindings.put("marko", convertToVertexId(graph, "marko"));
+        assertEquals(g.V(convertToVertexId(graph, "marko")).next(), engine.eval("g.V(marko).next()", bindings));
+        assertEquals(g.V(convertToVertexId(graph, "marko")).out("created").count().next(), engine.eval("g.V(marko).out(\"created\").count().next()", bindings));
     }
 
     private Object convertToVertexId(final Graph graph, final String vertexName) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
index 70c7b68..6cfb7f4 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTypeCheckedTest.java
@@ -37,12 +37,12 @@ public class GremlinGroovyScriptEngineTypeCheckedTest {
     @Test
     public void shouldTypeCheck() throws Exception {
         // with no type checking this should pass
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine()) {
-            assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));
-        }
+        GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine();
+        assertEquals(255, scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()"));
 
         final TypeCheckedGroovyCustomizer provider = new TypeCheckedGroovyCustomizer();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(provider)) {
+        scriptEngine = new GremlinGroovyScriptEngine(provider);
+        try {
             scriptEngine.eval("((Object) new java.awt.Color(255, 255, 255)).getRed()");
             fail("Should have failed type checking");
         } catch (ScriptException se) {
@@ -56,13 +56,13 @@ public class GremlinGroovyScriptEngineTypeCheckedTest {
     public void shouldTypeCheckWithExtension() throws Exception {
         // with no type checking extension this should pass
         final TypeCheckedGroovyCustomizer providerNoExtension = new TypeCheckedGroovyCustomizer();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
-            assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
-        }
+        GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension);
+        assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
 
         final TypeCheckedGroovyCustomizer providerWithExtension = new TypeCheckedGroovyCustomizer(
                 PrecompiledExtensions.PreventColorUsageExtension.class.getName());
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
+        scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension);
+        try {
             scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
             fail("Should have failed type checking");
         } catch (ScriptException se) {
@@ -75,15 +75,15 @@ public class GremlinGroovyScriptEngineTypeCheckedTest {
     public void shouldTypeCheckWithMultipleExtension() throws Exception {
         // with no type checking extension this should pass
         final TypeCheckedGroovyCustomizer providerNoExtension = new TypeCheckedGroovyCustomizer();
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension)) {
-            assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
-            assertEquals(1l, scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count"));
-        }
+        GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerNoExtension);
+        assertEquals(255, scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red"));
+        assertEquals(1l, scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count"));
 
         final TypeCheckedGroovyCustomizer providerWithExtension = new TypeCheckedGroovyCustomizer(
                 PrecompiledExtensions.PreventColorUsageExtension.class.getName() +
                         "," + PrecompiledExtensions.PreventCountDownLatchUsageExtension.class.getName());
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
+        scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension);
+        try {
             scriptEngine.eval("def c = new java.awt.Color(255, 255, 255); c.red");
             fail("Should have failed type checking");
         } catch (ScriptException se) {
@@ -91,7 +91,8 @@ public class GremlinGroovyScriptEngineTypeCheckedTest {
             assertThat(se.getMessage(), containsString("Method call is not allowed!"));
         }
 
-        try (GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension)) {
+        scriptEngine = new GremlinGroovyScriptEngine(providerWithExtension);
+        try {
             scriptEngine.eval("def c = new java.util.concurrent.CountDownLatch(1); c.count");
             fail("Should have failed type checking");
         } catch (ScriptException se) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
index 901f9b0..edeb2cb 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
@@ -1132,16 +1132,6 @@ class GraphTraversal extends Traversal {
     return this;
   }
   
-  /**
-   * Graph traversal with method.
-   * @param {...Object} args
-   * @returns {GraphTraversal}
-   */
-  with(...args) {
-    this.bytecode.addStep('with', args);
-    return this;
-  }
-  
 }
 
 function callOnEmptyTraversal(fnName, args) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index a492f9c..d5630c0 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -505,10 +505,6 @@ class GraphTraversal(Traversal):
         self.bytecode.add_step("where", *args)
         return self
 
-    def with(self, *args):
-        self.bytecode.add_step("with", *args)
-        return self
-
 
 class __(object):
     graph_traversal = GraphTraversal

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b75cfb8e/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopConfiguration.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopConfiguration.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopConfiguration.java
index 9e31225..a8125ea 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopConfiguration.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopConfiguration.java
@@ -98,30 +98,6 @@ public final class HadoopConfiguration extends AbstractConfiguration implements
         }
     }
 
-    /**
-     * @deprecated As of release 3.2.0, replaced by {@link HadoopConfiguration#getGraphReader()}.
-     */
-    @Deprecated
-    public Class<InputFormat<NullWritable, VertexWritable>> getGraphInputFormat() {
-        try {
-            return (Class) Class.forName(this.getString(Constants.GREMLIN_HADOOP_GRAPH_READER));
-        } catch (final ClassNotFoundException e) {
-            throw new RuntimeException(e.getMessage(), e);
-        }
-    }
-
-    /**
-     * @deprecated As of release 3.2.0, replaced by {@link HadoopConfiguration#getGraphWriter()}.
-     */
-    @Deprecated
-    public Class<OutputFormat<NullWritable, VertexWritable>> getGraphOutputFormat() {
-        try {
-            return (Class) Class.forName(this.getString(Constants.GREMLIN_HADOOP_GRAPH_WRITER));
-        } catch (final ClassNotFoundException e) {
-            throw new RuntimeException(e.getMessage(), e);
-        }
-    }
-
     public String getInputLocation() {
         return this.getString(Constants.GREMLIN_HADOOP_INPUT_LOCATION);
     }


[40/50] tinkerpop git commit: updating the reference documentation

Posted by sp...@apache.org.
updating the reference documentation

added the following:
- fix the logo
- added prefixes
- added limitations
- added examples

todo:
- cover all limitations and special cases with examples

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

Branch: refs/heads/TINKERPOP-1878
Commit: 95796a32bccd1f232f1b1e08912a6fe8e0df6eb6
Parents: 1166716
Author: Harsh Thakkar <ha...@gmail.com>
Authored: Wed Mar 28 17:27:32 2018 +0200
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 docs/src/reference/transpilers.asciidoc | 355 ++++++++++++++++++++++++++-
 1 file changed, 351 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95796a32/docs/src/reference/transpilers.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/transpilers.asciidoc b/docs/src/reference/transpilers.asciidoc
index 9100f84..386b4a5 100644
--- a/docs/src/reference/transpilers.asciidoc
+++ b/docs/src/reference/transpilers.asciidoc
@@ -17,10 +17,6 @@ limitations under the License.
 [[transpilers]]
 = Gremlin Transpilers
 
-![gremlinator][SPARQL-Gremlin]
-
-[SPARQL-Gremlin]: https://raw.githubusercontent.com/LITMUS-Benchmark-Suite/sparql-to-gremlin/master/docs/images/sparql-gremlin-logo.png
-
 There are many languages built to query data. SQL is typically used to query relational data. There is SPARQL for RDF
 data. Cypher is used to do pattern matching in graph data. The list could go on. Transpilers convert languages like
 these to Gremlin so that it becomes possible to use them in any context that Gremlin is used. In other words, a
@@ -28,6 +24,24 @@ Gremlin Transpiler enables a particular query language to work on any TinkerPop-
 
 == SPARQL-Gremlin
 
+image:https://raw.githubusercontent.com/LITMUS-Benchmark-Suite/sparql-to-gremlin/master/docs/images/sparql-gremlin-logo.png[gremlinator]
+
+The SPARQL-Gremlin transpiler, transforms link:https://en.wikipedia.org/wiki/SPARQL[SPARQL] queries into Gremlin traversals. It is based on the  https://jena.apache.org/index.html[Apache Jena] SPARQL processor https://jena.apache.org/documentation/query/index.html[ARQ], which provides access to a syntax tree of a SPARQL query.
+
+
+The goal of this work is to bridge the query interoperability gap between the two famous, yet fairly disconnected, graph communities: Semantic Web (which relies on the RDF data model) and Graph database
+(which relies on Property graph data model).
+
+NOTE: The foundational research work on SPARQL-Gremlin transpiler (aka Gremlinator) can be found from -
+https://arxiv.org/pdf/1801.02911.pdf[Gremlinator full paper]. In this
+paper, we present and discuss the notion of graph query language
+semantics of SPARQL and Gremlin, and a formal mapping between SPARQL
+pattern matching graph patterns and Gremlin traversals. Furthermore, we
+point the interested reader to the following resourcesfor a better
+understanding: (1) Gremlinator demonstration -
+(http://gremlinator.iai.uni-bonn.de:8080/Demo/[Public Demo Mirror 1])
+and (http://195.201.31.31:8080/Demo/[Public Demo Mirror 2]); (2) A short video tutorial on how to use the demonstration - https://www.youtube.com/watch?v=Z0ETx2IBamw[here]
+
 [source,xml]
 ----
 <dependency>
@@ -68,3 +82,336 @@ start step.
 <2> Execute a SPARQL query against the TinkerGraph instance. The `SparqlTraversalSource` uses a
 <<traversalstrategy,TraversalStrategy>> to transparently converts that SPARQL query into a standard Gremlin traversal
 and then when finally iterated, executes that against the TinkerGraph.
+
+[[prefixes]]
+Prefixes
+~~~~~~~~~
+
+The SPARQL-Gremlin transpiler supports the following prefixes to traverse the graph:
+
+[cols=",",options="header",]
+|====================================
+|Prefix |Purpose
+|`v:<label>` |label-access traversal
+|`e:<label>` |out-edge traversal
+|`p:<name>` |property traversal
+|`v:<name>` |property-value traversal
+|====================================
+
+Note that element IDs and labels are treated like normal properties, hence they can be accessed using the same pattern:
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT ?name ?id ?label 
+	WHERE { 
+	?element v:name ?name . 
+	?element v:id ?id . 
+	?element v:label ?label .}""")
+----
+
+[[supported-queries]]
+Supported Queries
+~~~~~~~~~~~~~~~~~~
+
+The SPARQL-Gremlin transpiler is currently an on-going effort with an aim to cover the entire SPARQL 1.1 query feature spectrum, however we currently only support translation of the SPARQL 1.0 specification, especially _SELECT_ queries. The supported SPARQL query types are: 
+
+* Union 
+* Optional 
+* Order-By 
+* Group-By 
+* STAR-shaped or _neighbourhood queries_ 
+* Query modifiers, such as: 
+** Filter with _restrictions_ 
+** Count 
+** LIMIT 
+** OFFSET
+
+[[limitations]]
+Limitations
+~~~~~~~~~~~~
+
+The current implementation of SPARQL-Gremlin transpiler (i.e. SPARQL-Gremlin) does
+not support the following cases: 
+
+* SPARQL queries with variables in the
+predicate position are not currently covered, with an exception of the
+following case:
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT * WHERE { ?x ?y ?z . }""")
+----
+
+* A SPARQL Union query with un-balanced patterns, i.e. a gremlin union
+traversal can only be generated if the unput SPARQL query has the same
+number of patterns on both the side of the union operator. For instance,
+the following SPARQL query cannot be mapped using Gremlinator, since a
+union is executed between different number of graph patterns (two
+patterns _union_ 1 pattern).
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT * 
+	WHERE {
+	{?person e:created ?software . 
+	?person v:name "daniel" .}
+	UNION
+	{?software v:lang "java" .} }""")
+----
+
+* order by
+....
+Adding more here...
+....
+
+* group by
+....
+Adding more here...
+....
+
+[[examples]]
+Examples
+~~~~~~~~~
+
+The following section presents a comprehensive examples of SPARQL queries that are currently covered by the SPARQL-Gremlin transpiler.
+
+[[select-all]]
+Select All
+^^^^^^^^^^
+
+.Select all vertices in the graph.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT * WHERE { }""")
+----
+
+[[match-constant-values]]
+Match Constant Values
+^^^^^^^^^^^^^^^^^^^^^
+
+.Select all vertices with the label `person`.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT * WHERE {  ?person v:label "person" .}""")
+----
+
+[[select-specific-elements]]
+Select Specific Elements
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+.Select the values of the properties `name` and `age` for each `person` vertex.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT ?name ?age
+WHERE {
+  ?person v:label "person" .
+  ?person v:name ?name .
+  ?person v:age ?age . }""")
+----
+
+[[pattern-matching]]
+Pattern Matching
+^^^^^^^^^^^^^^^^
+
+.Select only those persons who created a project.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT ?name ?age
+WHERE {
+  ?person v:label "person" .
+  ?person v:name ?name .
+  ?person v:age ?age .
+  ?person e:created ?project . }""")
+----
+
+[[filtering]]
+Filtering
+^^^^^^^^^
+
+.Select only those persons who are older than 30.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT ?name ?age
+WHERE {
+  ?person v:label "person" .
+  ?person v:name ?name .
+  ?person v:age ?age .
+  ?person e:created ?project .
+    FILTER (?age > 30) }""")
+----
+
+[[deduplication]]
+Deduplication
+^^^^^^^^^^^^^
+
+.Select the distinct names of the created projects.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT DISTINCT ?name
+WHERE {
+  ?person v:label "person" .
+  ?person e:created ?project .
+  ?project v:name ?name .
+    FILTER (?age > 30)}""")
+----
+
+[[multiple-filters]]
+Multiple Filters
+^^^^^^^^^^^^^^^^
+
+.Select the distinct names of all Java projects.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT DISTINCT ?name
+WHERE {
+  ?person v:label "person" .
+  ?person v:age ?age .
+  ?person e:created ?project .
+  ?project v:name ?name .
+  ?project v:lang ?lang .
+    FILTER (?age > 30 && ?lang == "java") }""")
+----
+
+[[pattern-filters]]
+Pattern Filter(s)
+^^^^^^^^^^^^^^^^^
+
+.A different way to filter all person who created a project.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT ?name
+WHERE {
+  ?person v:label "person" .
+  ?person v:name ?name .
+    FILTER EXISTS { ?person e:created ?project } }""")
+----
+
+.Filter all person who did not create a project.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT ?name
+WHERE {
+  ?person v:label "person" .
+  ?person v:name ?name .
+    FILTER NOT EXISTS { ?person e:created ?project } }""")
+----
+
+[[meta-property-access]]
+Meta-Property Access
+^^^^^^^^^^^^^^^^^^^^
+
+.Accessing the Meta-Property of a graph element. Meta-Property can be perceived as the reified statements in an RDF graph.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT ?name ?startTime
+WHERE {
+  ?person v:name "daniel" .
+  ?person p:location ?location .
+  ?location v:value ?name .
+  ?location v:startTime ?startTime }""")
+----
+
+[[union]]
+Union
+^^^^^
+
+.Select all persons who have developed a software in java using union.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT * 
+WHERE {
+  {?person e:created ?software .}
+  UNION
+  {?software v:lang "java" .} }""")
+----
+
+[[optional]]
+Optional
+^^^^^^^^
+
+.Return the names of the persons who have created a software in java and optionally python.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT ?person 
+WHERE {
+  ?person v:label "person" .
+  ?person e:created ?software .
+  ?software v:lang "java" .
+  OPTIONAL {?software v:lang "python" . }}""")
+----
+
+[[order-by]]
+Order By
+^^^^^^^^
+
+.Select all vertices with the label `person` and order them by their age.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT * 
+WHERE {
+  ?person v:label "person" .
+  ?person v:age ?age .
+} ORDER BY (?age)""")
+----
+
+[[group-by]]
+Group By
+^^^^^^^^
+
+.Select all vertices with the label `person` and group them by their age.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT * 
+WHERE {
+  ?person v:label "person" .
+  ?person v:age ?age .
+} GROUP BY (?age)""")
+----
+
+[[mixedcomplexaggregation-based-queries]]
+Mixed/complex/aggregation-based queries
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.Count the number of projects which have been created by persons under the age of 30 and group them by age. Return only the top two.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT COUNT(?project) 
+WHERE {
+  ?person v:label "person" .
+  ?person v:age ?age . FILTER (?age < 30)
+  ?person e:created ?project .
+} GROUP BY (?age) LIMIT 2""")
+----
+
+[[star-shaped-queries]]
+STAR-shaped queries
+^^^^^^^^^^^^^^^^^^^
+
+.STAR-shaped queries are the queries that form/follow a star-shaped execution plan. These in terms of graph traversals can be perceived as path queries or neighbourhood queries. For instance, getting all the information about a specific `person` or `software`.
+
+[gremlin-groovy,existing]
+----
+g.sparql("""SELECT ?age ?software ?name ?location ?startTime 
+WHERE {
+  ?person v:name "daniel" .
+  ?person v:age ?age .
+  ?person e:created ?software .
+  ?person p:location ?location .
+  ?location v:value ?name .
+  ?location v:startTime ?startTime }""")
+----


[07/50] tinkerpop git commit: Minor javadoc fix CTR

Posted by sp...@apache.org.
Minor javadoc fix CTR


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

Branch: refs/heads/TINKERPOP-1878
Commit: a3677e2e82c7e4722518f4be9b9235300887357a
Parents: f6274ed
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jun 6 15:45:17 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jun 6 15:45:17 2018 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/tinkerpop/gremlin/structure/Graph.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a3677e2e/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index 494ca8c..2fbfe03 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -1239,7 +1239,7 @@ public interface Graph extends AutoCloseable, Host {
         /**
          * The list of {@link GraphComputer} implementations by class name that a test should opt-out from using (i.e. other
          * graph computers not in this list will execute the test).  This setting should only be included when
-         * the test is one that uses the {@link ComputerTraversalEngine} - it will otherwise be ignored.  By
+         * the test is one that uses the {@code TraversalEngine.COMPUTER} - it will otherwise be ignored.  By
          * default, an empty array is assigned and it is thus assumed that all computers are excluded when an
          * {@code OptOut} annotation is used, therefore this value must be overridden to be more specific.
          */


[28/50] tinkerpop git commit: TINKERPOP-1878 Dropped the console app

Posted by sp...@apache.org.
TINKERPOP-1878 Dropped the console app

This allows TinkerGraph to remain a test dependency only and the console app was more of a test rig than something that a user of this library would use, so it seemed like something that could be dropped.


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

Branch: refs/heads/TINKERPOP-1878
Commit: f3053ae7bc4bfe4f88a44bbacc0fbba6ff52bed0
Parents: 523e88f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jan 25 14:49:18 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 sparql-gremlin/pom.xml                          |   1 +
 .../gremlin/sparql/ConsoleCompiler.java         | 165 -------------------
 2 files changed, 1 insertion(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3053ae7/sparql-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/sparql-gremlin/pom.xml b/sparql-gremlin/pom.xml
index d38a85d..0dceb85 100644
--- a/sparql-gremlin/pom.xml
+++ b/sparql-gremlin/pom.xml
@@ -42,6 +42,7 @@
             <groupId>org.apache.tinkerpop</groupId>
             <artifactId>tinkergraph-gremlin</artifactId>
             <version>${project.version}</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.tinkerpop</groupId>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3053ae7/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/ConsoleCompiler.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/ConsoleCompiler.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/ConsoleCompiler.java
deleted file mode 100644
index 0d50475..0000000
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/ConsoleCompiler.java
+++ /dev/null
@@ -1,165 +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.sparql;
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringReader;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.tinkerpop.gremlin.jsr223.JavaTranslator;
-import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.io.IoCore;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-
-import org.apache.tinkerpop.gremlin.sparql.SparqlToGremlinCompiler;
-
-class ConsoleCompiler {
-
-    public static void main(final String[] args) throws IOException {
-    	//args = "/examples/modern1.sparql";
-        final Options options = new Options();
-        options.addOption("f", "file", true, "a file that contains a SPARQL query");
-        options.addOption("g", "graph", true, "the graph that's used to execute the query [classic|modern|crew|kryo file]");
-        // TODO: add an OLAP option (perhaps: "--olap spark"?)
-
-        final CommandLineParser parser = new DefaultParser();
-        final CommandLine commandLine;
-
-        try {
-            commandLine = parser.parse(options, args);
-        } catch (ParseException e) {
-            System.out.println(e.getMessage());
-            printHelp(1);
-            return;
-        }
-        
-        final InputStream inputStream = commandLine.hasOption("file")
-                ? new FileInputStream(commandLine.getOptionValue("file"))
-                : System.in;
-        final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
-        final StringBuilder queryBuilder = new StringBuilder();
-
-        if (!reader.ready()) {
-            printHelp(1);
-        }
-
-        String line;
-        while (null != (line = reader.readLine())) {
-            queryBuilder.append(System.lineSeparator()).append(line);
-        }
-
-        final String queryString = queryBuilder.toString();
-        Graph graph;
-        
-        if (commandLine.hasOption("graph")) {
-            switch (commandLine.getOptionValue("graph").toLowerCase()) {
-                case "classic":
-                    graph = TinkerFactory.createClassic();
-                    break;
-                case "modern":
-                    graph = TinkerFactory.createModern();
-                    System.out.println("Modern Graph Created");
-                    break;
-                case "crew":
-                    graph = TinkerFactory.createTheCrew();
-                    break;
-                default:
-                    graph = TinkerGraph.open();
-                    System.out.println("Graph Created");
-                    String graphName = commandLine.getOptionValue("graph");
-                    long startTime= System.currentTimeMillis();
-                    if(graphName.endsWith(".graphml"))
-                    	graph.io(IoCore.graphml()).readGraph(graphName);
-                    else if(graphName.endsWith(".kryo")||graphName.endsWith("gryo"))
-                    	graph.io(IoCore.gryo()).readGraph(graphName);
-                    long endTime = System.currentTimeMillis();
-                    System.out.println("Time taken to load graph from kyro file: "+ (endTime-startTime)+" mili seconds");
-                    break;
-            }
-        } else {
- 
-            graph = TinkerFactory.createModern();
-        }
-
-        long startTime = System.currentTimeMillis();
-        final Traversal<Vertex, ?> traversal = SparqlToGremlinCompiler.convertToGremlinTraversal(graph, queryString);
-        long endTime = System.currentTimeMillis();
-        System.out.println("Time traken to convert SPARQL to Gremlin Traversal : "+ (endTime - startTime)+ " miliseconds");
-        
-        printWithHeadline("SPARQL Query", queryString);
-        // printWithHeadline("Traversal (prior execution)", traversal);
-  
-        
-        Bytecode traversalByteCode = traversal.asAdmin().getBytecode();
-        
-        
-//        JavaTranslator.of(graph.traversal()).translate(traversalByteCode);
-//        
-//        System.out.println("the Byte Code : "+ traversalByteCode.toString());
-        printWithHeadline("Result", String.join(System.lineSeparator(),JavaTranslator.of(graph.traversal()).translate(traversalByteCode).toStream().map(Object::toString).collect(Collectors.toList())));
-        // printWithHeadline("Traversal (after execution)", traversal);
-    }
-
-    private static void printHelp(final int exitCode) throws IOException {
-        final Map<String, String> env = System.getenv();
-        final String command = env.containsKey("LAST_COMMAND") ? env.get("LAST_COMMAND") : "sparql-gremlin.sh";
-        printWithHeadline("Usage Examples", String.join("\n",
-                command + " -f examples/modern1.sparql",
-                command + " < examples/modern2.sparql",
-                command + " <<< 'SELECT * WHERE { ?a e:knows ?b }'",
-                command + " -g crew < examples/crew1.sparql"));
-        if (exitCode >= 0) {
-            System.exit(exitCode);
-        }
-    }
-
-    private static void printWithHeadline(final String headline, final Object content) throws IOException {
-        final StringReader sr = new StringReader(content != null ? content.toString() : "null");
-        final BufferedReader br = new BufferedReader(sr);
-        String line;
-        System.out.println();
-        System.out.println( headline ); 
-        System.out.println();
-        boolean skip = true;
-        while (null != (line = br.readLine())) {
-            skip &= line.isEmpty();
-            if (!skip) {
-                System.out.println("  " + line);
-            }
-        }
-        System.out.println();
-        br.close();
-        sr.close();
-    }
-}


[39/50] tinkerpop git commit: TINKERPOP-1878 Minor transpiler doc fixes

Posted by sp...@apache.org.
TINKERPOP-1878 Minor transpiler doc fixes


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

Branch: refs/heads/TINKERPOP-1878
Commit: c1093c1062da9e35d5b632b8db0523ea4e23a648
Parents: 916130c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jun 15 08:16:03 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 docs/src/reference/transpilers.asciidoc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c1093c10/docs/src/reference/transpilers.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/transpilers.asciidoc b/docs/src/reference/transpilers.asciidoc
index 1bb7728..0483a5d 100644
--- a/docs/src/reference/transpilers.asciidoc
+++ b/docs/src/reference/transpilers.asciidoc
@@ -131,7 +131,7 @@ The current implementation of SPARQL-Gremlin transpiler (i.e. SPARQL-Gremlin) do
 * SPARQL queries with variables in the predicate position are not currently covered, with an exception of the following
 case:
 
-[source,text]
+[source,groovy]
 ----
 g.sparql("""SELECT * WHERE { ?x ?y ?z . }""")
 ----
@@ -141,7 +141,7 @@ SPARQL query has the same number of patterns on both the side of the union opera
 SPARQL query cannot be mapped using Gremlinator, since a union is executed between different number of graph patterns
 (two patterns `union` 1 pattern).
 
-[source,text]
+[source,groovy]
 ----
 g.sparql("""SELECT * WHERE {
 	{?person e:created ?software .
@@ -163,7 +163,7 @@ g.sparql("""SELECT ?age WHERE {
 
 Whereas, the following SPARQL query will be invalid:
 
-[source,text]
+[source,groovy]
 ----
 g.sparql("""SELECT ?person WHERE {
       ?person v:label "person" .


[41/50] tinkerpop git commit: TINKERPOP-1878 Fixed up formatting of traspiler section

Posted by sp...@apache.org.
TINKERPOP-1878 Fixed up formatting of traspiler section

There were some examples that didn't return results or generated errors. These will need some review.


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

Branch: refs/heads/TINKERPOP-1878
Commit: 537a6b49798c8aa08baadb96436a2e17ceb678f2
Parents: 95796a3
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 3 10:52:17 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 docs/src/reference/transpilers.asciidoc | 156 ++++++++++++---------------
 1 file changed, 71 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/537a6b49/docs/src/reference/transpilers.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/transpilers.asciidoc b/docs/src/reference/transpilers.asciidoc
index 386b4a5..b05be68 100644
--- a/docs/src/reference/transpilers.asciidoc
+++ b/docs/src/reference/transpilers.asciidoc
@@ -84,8 +84,7 @@ start step.
 and then when finally iterated, executes that against the TinkerGraph.
 
 [[prefixes]]
-Prefixes
-~~~~~~~~~
+=== Prefixes
 
 The SPARQL-Gremlin transpiler supports the following prefixes to traverse the graph:
 
@@ -110,10 +109,11 @@ g.sparql("""SELECT ?name ?id ?label
 ----
 
 [[supported-queries]]
-Supported Queries
-~~~~~~~~~~~~~~~~~~
+=== Supported Queries
 
-The SPARQL-Gremlin transpiler is currently an on-going effort with an aim to cover the entire SPARQL 1.1 query feature spectrum, however we currently only support translation of the SPARQL 1.0 specification, especially _SELECT_ queries. The supported SPARQL query types are: 
+The SPARQL-Gremlin transpiler is currently an on-going effort with an aim to cover the entire SPARQL 1.1 query feature
+spectrum, however we currently only support translation of the SPARQL 1.0 specification, especially _SELECT_ queries.
+The supported SPARQL query types are:
 
 * Union 
 * Optional 
@@ -127,29 +127,25 @@ The SPARQL-Gremlin transpiler is currently an on-going effort with an aim to cov
 ** OFFSET
 
 [[limitations]]
-Limitations
-~~~~~~~~~~~~
+=== Limitations
 
 The current implementation of SPARQL-Gremlin transpiler (i.e. SPARQL-Gremlin) does
 not support the following cases: 
 
-* SPARQL queries with variables in the
-predicate position are not currently covered, with an exception of the
-following case:
+* SPARQL queries with variables in the predicate position are not currently covered, with an exception of the following
+case:
 
-[gremlin-groovy,existing]
+[source,groovy]
 ----
 g.sparql("""SELECT * WHERE { ?x ?y ?z . }""")
 ----
 
-* A SPARQL Union query with un-balanced patterns, i.e. a gremlin union
-traversal can only be generated if the unput SPARQL query has the same
-number of patterns on both the side of the union operator. For instance,
-the following SPARQL query cannot be mapped using Gremlinator, since a
-union is executed between different number of graph patterns (two
-patterns _union_ 1 pattern).
+* A SPARQL Union query with un-balanced patterns, i.e. a gremlin union traversal can only be generated if the input
+SPARQL query has the same number of patterns on both the side of the union operator. For instance, the following
+SPARQL query cannot be mapped using Gremlinator, since a union is executed between different number of graph patterns
+(two patterns _union_ 1 pattern).
 
-[gremlin-groovy,existing]
+[source,groovy]
 ----
 g.sparql("""SELECT * 
 	WHERE {
@@ -170,16 +166,15 @@ Adding more here...
 ....
 
 [[examples]]
-Examples
-~~~~~~~~~
+=== Examples
 
-The following section presents a comprehensive examples of SPARQL queries that are currently covered by the SPARQL-Gremlin transpiler.
+The following section presents a comprehensive examples of SPARQL queries that are currently covered by the
+SPARQL-Gremlin transpiler.
 
 [[select-all]]
-Select All
-^^^^^^^^^^
+==== Select All
 
-.Select all vertices in the graph.
+Select all vertices in the graph.
 
 [gremlin-groovy,existing]
 ----
@@ -187,10 +182,9 @@ g.sparql("""SELECT * WHERE { }""")
 ----
 
 [[match-constant-values]]
-Match Constant Values
-^^^^^^^^^^^^^^^^^^^^^
+==== Match Constant Values
 
-.Select all vertices with the label `person`.
+Select all vertices with the label `person`.
 
 [gremlin-groovy,existing]
 ----
@@ -198,10 +192,9 @@ g.sparql("""SELECT * WHERE {  ?person v:label "person" .}""")
 ----
 
 [[select-specific-elements]]
-Select Specific Elements
-^^^^^^^^^^^^^^^^^^^^^^^^
+==== Select Specific Elements
 
-.Select the values of the properties `name` and `age` for each `person` vertex.
+Select the values of the properties `name` and `age` for each `person` vertex.
 
 [gremlin-groovy,existing]
 ----
@@ -213,10 +206,9 @@ WHERE {
 ----
 
 [[pattern-matching]]
-Pattern Matching
-^^^^^^^^^^^^^^^^
+==== Pattern Matching
 
-.Select only those persons who created a project.
+Select only those persons who created a project.
 
 [gremlin-groovy,existing]
 ----
@@ -229,10 +221,9 @@ WHERE {
 ----
 
 [[filtering]]
-Filtering
-^^^^^^^^^
+==== Filtering
 
-.Select only those persons who are older than 30.
+Select only those persons who are older than 30.
 
 [gremlin-groovy,existing]
 ----
@@ -241,31 +232,29 @@ WHERE {
   ?person v:label "person" .
   ?person v:name ?name .
   ?person v:age ?age .
-  ?person e:created ?project .
     FILTER (?age > 30) }""")
 ----
 
 [[deduplication]]
-Deduplication
-^^^^^^^^^^^^^
+==== Deduplication
 
-.Select the distinct names of the created projects.
+Select the distinct names of the created projects.
 
 [gremlin-groovy,existing]
 ----
 g.sparql("""SELECT DISTINCT ?name
 WHERE {
   ?person v:label "person" .
+  ?person v:age ?age .
   ?person e:created ?project .
   ?project v:name ?name .
     FILTER (?age > 30)}""")
 ----
 
 [[multiple-filters]]
-Multiple Filters
-^^^^^^^^^^^^^^^^
+==== Multiple Filters
 
-.Select the distinct names of all Java projects.
+Select the distinct names of all Java projects.
 
 [gremlin-groovy,existing]
 ----
@@ -276,14 +265,13 @@ WHERE {
   ?person e:created ?project .
   ?project v:name ?name .
   ?project v:lang ?lang .
-    FILTER (?age > 30 && ?lang == "java") }""")
+    FILTER (?age > 30 && ?lang = "java") }""")
 ----
 
 [[pattern-filters]]
-Pattern Filter(s)
-^^^^^^^^^^^^^^^^^
+==== Pattern Filter(s)
 
-.A different way to filter all person who created a project.
+A different way to filter all person who created a project.
 
 [gremlin-groovy,existing]
 ----
@@ -294,7 +282,7 @@ WHERE {
     FILTER EXISTS { ?person e:created ?project } }""")
 ----
 
-.Filter all person who did not create a project.
+Filter all person who did not create a project.
 
 [gremlin-groovy,existing]
 ----
@@ -305,27 +293,10 @@ WHERE {
     FILTER NOT EXISTS { ?person e:created ?project } }""")
 ----
 
-[[meta-property-access]]
-Meta-Property Access
-^^^^^^^^^^^^^^^^^^^^
-
-.Accessing the Meta-Property of a graph element. Meta-Property can be perceived as the reified statements in an RDF graph.
-
-[gremlin-groovy,existing]
-----
-g.sparql("""SELECT ?name ?startTime
-WHERE {
-  ?person v:name "daniel" .
-  ?person p:location ?location .
-  ?location v:value ?name .
-  ?location v:startTime ?startTime }""")
-----
-
 [[union]]
-Union
-^^^^^
+==== Union
 
-.Select all persons who have developed a software in java using union.
+Select all persons who have developed a software in java using union.
 
 [gremlin-groovy,existing]
 ----
@@ -337,12 +308,11 @@ WHERE {
 ----
 
 [[optional]]
-Optional
-^^^^^^^^
+==== Optional
 
-.Return the names of the persons who have created a software in java and optionally python.
+Return the names of the persons who have created a software in java and optionally python.
 
-[gremlin-groovy,existing]
+[source,groovy]
 ----
 g.sparql("""SELECT ?person 
 WHERE {
@@ -353,10 +323,9 @@ WHERE {
 ----
 
 [[order-by]]
-Order By
-^^^^^^^^
+==== Order By
 
-.Select all vertices with the label `person` and order them by their age.
+Select all vertices with the label `person` and order them by their age.
 
 [gremlin-groovy,existing]
 ----
@@ -368,12 +337,11 @@ WHERE {
 ----
 
 [[group-by]]
-Group By
-^^^^^^^^
+==== Group By
 
-.Select all vertices with the label `person` and group them by their age.
+Select all vertices with the label `person` and group them by their age.
 
-[gremlin-groovy,existing]
+[source,groovy]
 ----
 g.sparql("""SELECT * 
 WHERE {
@@ -383,12 +351,12 @@ WHERE {
 ----
 
 [[mixedcomplexaggregation-based-queries]]
-Mixed/complex/aggregation-based queries
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+==== Mixed/complex/aggregation-based queries
 
-.Count the number of projects which have been created by persons under the age of 30 and group them by age. Return only the top two.
+Count the number of projects which have been created by persons under the age of 30 and group them by age. Return only
+the top two.
 
-[gremlin-groovy,existing]
+[source,groovy]
 ----
 g.sparql("""SELECT COUNT(?project) 
 WHERE {
@@ -398,11 +366,29 @@ WHERE {
 } GROUP BY (?age) LIMIT 2""")
 ----
 
+[[meta-property-access]]
+==== Meta-Property Access
+
+Accessing the Meta-Property of a graph element. Meta-Property can be perceived as the reified statements in an RDF
+graph.
+
+[gremlin-groovy,theCrew]
+----
+g = graph.traversal(SparqlTraversalSource)
+g.sparql("""SELECT ?name ?startTime
+WHERE {
+  ?person v:name "daniel" .
+  ?person p:location ?location .
+  ?location v:value ?name .
+  ?location v:startTime ?startTime }""")
+----
+
 [[star-shaped-queries]]
-STAR-shaped queries
-^^^^^^^^^^^^^^^^^^^
+==== STAR-shaped queries
 
-.STAR-shaped queries are the queries that form/follow a star-shaped execution plan. These in terms of graph traversals can be perceived as path queries or neighbourhood queries. For instance, getting all the information about a specific `person` or `software`.
+STAR-shaped queries are the queries that form/follow a star-shaped execution plan. These in terms of graph traversals
+can be perceived as path queries or neighborhood queries. For instance, getting all the information about a specific
+`person` or `software`.
 
 [gremlin-groovy,existing]
 ----


[49/50] tinkerpop git commit: TINKERPOP-1878 Added a test for GROUP

Posted by sp...@apache.org.
TINKERPOP-1878 Added a test for GROUP


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

Branch: refs/heads/TINKERPOP-1878
Commit: 3328611610a33f852ff204108ba6b788e0880184
Parents: af7a8ca
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jan 29 09:09:07 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 .../dsl/sparql/SparqlTraversalSourceTest.java       | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33286116/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
index 56d62c9..0e56347 100644
--- a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
+++ b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
@@ -110,6 +110,7 @@ public class SparqlTraversalSourceTest {
         assertEquals(x.get("a"), _g.V(1).next());
         assertEquals(x.get("b"), _g.V(4).next());
         assertEquals(x.get("c"), _g.V(3).next());
+        assertEquals(3, x.size());
     }
 
     @Test
@@ -134,4 +135,19 @@ public class SparqlTraversalSourceTest {
                         "ORDER BY ?name").toList();
         assertThat(x, contains("josh", "marko", "peter"));
     }
+
+    @Test
+    public void shouldGroup() {
+        final Map<String,Long> x = (Map) g.sparql(
+                "SELECT ?name (COUNT(?name) AS ?name_count)\n" +
+                        "WHERE {\n" +
+                        "    ?a e:created ?b .\n" +
+                        "    ?a v:name ?name .\n" +
+                        "}" +
+                        "GROUP BY ?name").next();
+        assertEquals(new Long(2), x.get("josh"));
+        assertEquals(new Long(1), x.get("peter"));
+        assertEquals(new Long(1), x.get("marko"));
+        assertEquals(3, x.size());
+    }
 }


[17/50] tinkerpop git commit: Fixed a bug in the CoreImports for pageRank() and peerPressure()

Posted by sp...@apache.org.
Fixed a bug in the CoreImports for pageRank() and peerPressure()

Docs weren't generating as a result of the imports. Tehcnically we needed a static class import which CoreImports didn't support so rather than try to re-work all that, I just pulled PageRank and PeerPressure into their own top-level classes so they would just work with what we had. Also, lower-cased the keys as that looked more consistent with Gremlin. CTR


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

Branch: refs/heads/TINKERPOP-1878
Commit: f3506ee3b9bb68725367a9e6826494e33c4eb9e5
Parents: d3b6a34
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jun 12 16:36:01 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jun 12 16:36:01 2018 -0400

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc       | 16 ++++----
 docs/src/upgrade/release-3.4.x.asciidoc         |  6 +--
 .../tinkerpop/gremlin/jsr223/CoreImports.java   |  8 ++--
 .../computer/traversal/step/map/PageRank.java   | 43 ++++++++++++++++++++
 .../step/map/PageRankVertexProgramStep.java     | 41 +++++--------------
 .../traversal/step/map/PeerPressure.java        | 43 ++++++++++++++++++++
 .../step/map/PeerPressureVertexProgramStep.java | 40 +++++-------------
 .../traversal/step/map/PageRankTest.java        | 10 ++---
 .../traversal/step/map/PeerPressureTest.java    | 10 ++---
 9 files changed, 130 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3506ee3/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index 0d7d67f..0589203 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -1705,14 +1705,13 @@ g = graph.traversal().withComputer()
 g.V().pageRank().by('pageRank').values('pageRank')
 g.V().hasLabel('person').
   pageRank().
-    with(PageRank.EDGES, __.outE('knows')).
-    with(PageRank.PROPERTY_NAME, 'friendRank').
+    with(PageRank.edges, __.outE('knows')).
+    with(PageRank.propertyName, 'friendRank').
   order().by('friendRank',desc).valueMap('name','friendRank')
 ----
 
 Note the use of the `with()` modulating step which provides configuration options to the algorithm. It takes
-configuration keys from the static `PageRank` inner class on `PageRankVertexProgramStep` and is automatically
-imported to the Gremlin Console.
+configuration keys from the `PageRank` and is automatically imported to the Gremlin Console.
 
 The <<explain-step,`explain()`>>-step can be used to understand how the traversal is compiled into multiple `GraphComputer` jobs.
 
@@ -1721,8 +1720,8 @@ The <<explain-step,`explain()`>>-step can be used to understand how the traversa
 g = graph.traversal().withComputer()
 g.V().hasLabel('person').
   pageRank().
-    with(PageRank.EDGES, __.outE('knows')).
-    with(PageRank.PROPERTY_NAME, 'friendRank').
+    with(PageRank.edges, __.outE('knows')).
+    with(PageRank.propertyName, 'friendRank').
   order().by('friendRank',desc).valueMap('name','friendRank').explain()
 ----
 
@@ -1817,15 +1816,14 @@ g = graph.traversal().withComputer()
 g.V().peerPressure().by('cluster').values('cluster')
 g.V().hasLabel('person').
   peerPressure().
-    with(PeerPressure.PROPERTY_NAME, 'cluster').
+    with(PeerPressure.propertyName, 'cluster').
   group().
     by('cluster').
     by('name')
 ----
 
 Note the use of the `with()` modulating step which provides configuration options to the algorithm. It takes
-configuration keys from the static `PeerPressure` inner class on `PeerPressureVertexProgramStep` and is automatically
-imported to the Gremlin Console.
+configuration keys from the `PeerPressure` class and is automatically imported to the Gremlin Console.
 
 *Additional References*
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3506ee3/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.4.x.asciidoc b/docs/src/upgrade/release-3.4.x.asciidoc
index 851d458..2568974 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -40,8 +40,8 @@ which now uses `with()` to replace the old `by()` options:
 ----
 g.V().hasLabel('person').
   pageRank().
-    with(PageRank.EDGES, __.outE('knows')).
-    with(PageRank.PROPERTY_NAME, 'friendRank').
+    with(PageRank.edges, __.outE('knows')).
+    with(PageRank.propertyName, 'friendRank').
   order().
     by('friendRank',desc).
   valueMap('name','friendRank')
@@ -53,7 +53,7 @@ A similar change was made for `peerPressure()` step:
 ----
 g.V().hasLabel('person').
   peerPressure().
-    with(PeerPressure.PROPERTY_NAME, 'cluster').
+    with(PeerPressure.propertyName, 'cluster').
   group().
     by('cluster').
     by('name')

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3506ee3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
index 6158285..558d6ca 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
@@ -48,8 +48,8 @@ import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankMa
 import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PageRankVertexProgramStep;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PeerPressureVertexProgramStep;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PageRank;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PeerPressure;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.GraphFilterStrategy;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
@@ -259,11 +259,11 @@ public final class CoreImports {
         CLASS_IMPORTS.add(ClusterCountMapReduce.class);
         CLASS_IMPORTS.add(ClusterPopulationMapReduce.class);
         CLASS_IMPORTS.add(MemoryTraversalSideEffects.class);
+        CLASS_IMPORTS.add(PeerPressure.class);
         CLASS_IMPORTS.add(PeerPressureVertexProgram.class);
-        CLASS_IMPORTS.add(PeerPressureVertexProgramStep.PeerPressure.class);
+        CLASS_IMPORTS.add(PageRank.class);
         CLASS_IMPORTS.add(PageRankMapReduce.class);
         CLASS_IMPORTS.add(PageRankVertexProgram.class);
-        CLASS_IMPORTS.add(PageRankVertexProgramStep.PageRank.class);
         CLASS_IMPORTS.add(GraphFilterStrategy.class);
         CLASS_IMPORTS.add(TraversalVertexProgram.class);
         CLASS_IMPORTS.add(VertexProgramStrategy.class);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3506ee3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRank.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRank.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRank.java
new file mode 100644
index 0000000..5f9a956
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRank.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.computer.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+/**
+ * Configuration options to be passed to the {@link GraphTraversal#with(String, Object)} step on
+ * {@link GraphTraversal#pageRank()}.
+ */
+public final class PageRank {
+    /**
+     * Configures number of iterations that the algorithm should run.
+     */
+    public static final String times = Graph.Hidden.hide("tinkerpop.pageRank.times");
+
+    /**
+     * Configures the edge to traverse when calculating the pagerank.
+     */
+    public static final String edges = Graph.Hidden.hide("tinkerpop.pageRank.edges");
+
+    /**
+     * Configures the name of the property within which to store the pagerank value.
+     */
+    public static final String propertyName = Graph.Hidden.hide("tinkerpop.pageRank.propertyName");
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3506ee3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
index 1c5b364..277b4c6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
@@ -23,9 +23,7 @@ import org.apache.tinkerpop.gremlin.process.computer.GraphFilter;
 import org.apache.tinkerpop.gremlin.process.computer.Memory;
 import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.lambda.HaltedTraversersCountTraversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
@@ -60,23 +58,23 @@ public final class PageRankVertexProgramStep extends VertexProgramStep
     public PageRankVertexProgramStep(final Traversal.Admin traversal, final double alpha) {
         super(traversal);
         this.alpha = alpha;
-        this.configure(PageRank.EDGES, __.<Vertex>outE().asAdmin());
+        this.configure(PageRank.edges, __.<Vertex>outE().asAdmin());
     }
 
     @Override
     public void configure(final Object... keyValues) {
-        if (keyValues[0].equals(PageRank.EDGES)) {
+        if (keyValues[0].equals(PageRank.edges)) {
             if (!(keyValues[1] instanceof Traversal))
-                throw new IllegalArgumentException("PageRank.EDGES requires a Traversal as its argument");
+                throw new IllegalArgumentException("PageRank.edges requires a Traversal as its argument");
             this.edgeTraversal = new PureTraversal<>(((Traversal<Vertex,Edge>) keyValues[1]).asAdmin());
             this.integrateChild(this.edgeTraversal.get());
-        } else if (keyValues[0].equals(PageRank.PROPERTY_NAME)) {
+        } else if (keyValues[0].equals(PageRank.propertyName)) {
             if (!(keyValues[1] instanceof String))
-                throw new IllegalArgumentException("PageRank.PROPERTY_NAME requires a String as its argument");
+                throw new IllegalArgumentException("PageRank.propertyName requires a String as its argument");
             this.pageRankProperty = (String) keyValues[1];
-        } else if (keyValues[0].equals(PageRank.TIMES)) {
+        } else if (keyValues[0].equals(PageRank.times)) {
             if (!(keyValues[1] instanceof Integer))
-                throw new IllegalArgumentException("PageRank.TIMES requires an Integer as its argument");
+                throw new IllegalArgumentException("PageRank.times requires an Integer as its argument");
             this.times = (int) keyValues[1];
         }else {
             this.parameters.set(this, keyValues);
@@ -94,7 +92,7 @@ public final class PageRankVertexProgramStep extends VertexProgramStep
     @Deprecated
     @Override
     public void modulateBy(final Traversal.Admin<?, ?> edgeTraversal) {
-        configure(PageRank.EDGES, edgeTraversal);
+        configure(PageRank.edges, edgeTraversal);
     }
 
     /**
@@ -103,7 +101,7 @@ public final class PageRankVertexProgramStep extends VertexProgramStep
     @Deprecated
     @Override
     public void modulateBy(final String pageRankProperty) {
-        configure(PageRank.PROPERTY_NAME, pageRankProperty);
+        configure(PageRank.propertyName, pageRankProperty);
     }
 
     /**
@@ -112,7 +110,7 @@ public final class PageRankVertexProgramStep extends VertexProgramStep
     @Deprecated
     @Override
     public void modulateTimes(int times) {
-        configure(PageRank.TIMES, times);
+        configure(PageRank.times, times);
     }
 
     @Override
@@ -162,23 +160,4 @@ public final class PageRankVertexProgramStep extends VertexProgramStep
         return super.hashCode() ^ this.edgeTraversal.hashCode() ^ this.pageRankProperty.hashCode() ^ this.times;
     }
 
-    /**
-     * Configuration options to be passed to the {@link GraphTraversal#with(String, Object)} step.
-     */
-    public static class PageRank {
-        /**
-         * Configures number of iterations that the algorithm should run.
-         */
-        public static final String TIMES = Graph.Hidden.hide("tinkerpop.pageRank.times");
-
-        /**
-         * Configures the edge to traverse when calculating the pagerank.
-         */
-        public static final String EDGES = Graph.Hidden.hide("tinkerpop.pageRank.edges");
-
-        /**
-         * Configures the name of the property within which to store the pagerank value.
-         */
-        public static final String PROPERTY_NAME = Graph.Hidden.hide("tinkerpop.pageRank.propertyName");
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3506ee3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressure.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressure.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressure.java
new file mode 100644
index 0000000..c0051f2
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressure.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.computer.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+/**
+ * Configuration options to be passed to the {@link GraphTraversal#with(String, Object)} step on
+ * {@link GraphTraversal#peerPressure()}.
+ */
+public final class PeerPressure {
+    /**
+     * Configures number of iterations that the algorithm should run.
+     */
+    public static final String times = Graph.Hidden.hide("tinkerpop.peerPressure.times");
+
+    /**
+     * Configures the edge to traverse when determining clusters.
+     */
+    public static final String edges = Graph.Hidden.hide("tinkerpop.peerPressure.edges");
+
+    /**
+     * Configures the name of the property within which to store the cluster value.
+     */
+    public static final String propertyName = Graph.Hidden.hide("tinkerpop.peerPressure.propertyName");
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3506ee3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressureVertexProgramStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressureVertexProgramStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressureVertexProgramStep.java
index be65f42..e1cba60 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressureVertexProgramStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressureVertexProgramStep.java
@@ -25,7 +25,6 @@ import org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.Pee
 import org.apache.tinkerpop.gremlin.process.computer.traversal.lambda.HaltedTraversersCountTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.ByModulating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
@@ -57,23 +56,23 @@ public final class PeerPressureVertexProgramStep extends VertexProgramStep
 
     public PeerPressureVertexProgramStep(final Traversal.Admin traversal) {
         super(traversal);
-        this.configure(PeerPressure.EDGES, __.<Vertex>outE().asAdmin());
+        this.configure(PeerPressure.edges, __.<Vertex>outE().asAdmin());
     }
 
     @Override
     public void configure(final Object... keyValues) {
-        if (keyValues[0].equals(PeerPressureVertexProgramStep.PeerPressure.EDGES)) {
+        if (keyValues[0].equals(PeerPressure.edges)) {
             if (!(keyValues[1] instanceof Traversal))
-                throw new IllegalArgumentException("PeerPressure.EDGES requires a Traversal as its argument");
+                throw new IllegalArgumentException("PeerPressure.edges requires a Traversal as its argument");
             this.edgeTraversal = new PureTraversal<>(((Traversal<Vertex,Edge>) keyValues[1]).asAdmin());
             this.integrateChild(this.edgeTraversal.get());
-        } else if (keyValues[0].equals(PeerPressureVertexProgramStep.PeerPressure.PROPERTY_NAME)) {
+        } else if (keyValues[0].equals(PeerPressure.propertyName)) {
             if (!(keyValues[1] instanceof String))
-                throw new IllegalArgumentException("PeerPressure.PROPERTY_NAME requires a String as its argument");
+                throw new IllegalArgumentException("PeerPressure.propertyName requires a String as its argument");
             this.clusterProperty = (String) keyValues[1];
-        } else if (keyValues[0].equals(PeerPressureVertexProgramStep.PeerPressure.TIMES)) {
+        } else if (keyValues[0].equals(PeerPressure.times)) {
             if (!(keyValues[1] instanceof Integer))
-                throw new IllegalArgumentException("PeerPressure.TIMES requires an Integer as its argument");
+                throw new IllegalArgumentException("PeerPressure.times requires an Integer as its argument");
             this.times = (int) keyValues[1];
         }else {
             this.parameters.set(this, keyValues);
@@ -96,7 +95,7 @@ public final class PeerPressureVertexProgramStep extends VertexProgramStep
     @Deprecated
     @Override
     public void modulateBy(final Traversal.Admin<?, ?> edgeTraversal) {
-        configure(PeerPressure.EDGES, edgeTraversal);
+        configure(PeerPressure.edges, edgeTraversal);
     }
 
     /**
@@ -105,7 +104,7 @@ public final class PeerPressureVertexProgramStep extends VertexProgramStep
     @Deprecated
     @Override
     public void modulateBy(final String clusterProperty) {
-        configure(PeerPressure.PROPERTY_NAME, clusterProperty);
+        configure(PeerPressure.propertyName, clusterProperty);
     }
 
     /**
@@ -114,7 +113,7 @@ public final class PeerPressureVertexProgramStep extends VertexProgramStep
     @Deprecated
     @Override
     public void modulateTimes(int times) {
-        configure(PeerPressure.TIMES, times);
+        configure(PeerPressure.times, times);
     }
 
     @Override
@@ -158,23 +157,4 @@ public final class PeerPressureVertexProgramStep extends VertexProgramStep
         this.integrateChild(this.edgeTraversal.get());
     }
 
-    /**
-     * Configuration options to be passed to the {@link GraphTraversal#with(String, Object)} step.
-     */
-    public static class PeerPressure {
-        /**
-         * Configures number of iterations that the algorithm should run.
-         */
-        public static final String TIMES = Graph.Hidden.hide("tinkerpop.peerPressure.times");
-
-        /**
-         * Configures the edge to traverse when determining clusters.
-         */
-        public static final String EDGES = Graph.Hidden.hide("tinkerpop.peerPressure.edges");
-
-        /**
-         * Configures the name of the property within which to store the cluster value.
-         */
-        public static final String PROPERTY_NAME = Graph.Hidden.hide("tinkerpop.peerPressure.propertyName");
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3506ee3/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
index 325621e..2312967 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
@@ -23,7 +23,7 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
 import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PageRankVertexProgramStep.PageRank;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PageRank;
 import org.apache.tinkerpop.gremlin.process.traversal.Order;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
@@ -64,7 +64,7 @@ public abstract class PageRankTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasLabelXsoftwareX_hasXname_rippleX_pageRankX1X_byXinEXcreatedXX_timesX1X_byXpriorsX_inXcreatedX_unionXboth__identityX_valueMapXname_priorsX();
 
-    public abstract Traversal<Vertex, Map<Object, List<Vertex>>> get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXPROPERTY_NAME_pageRankXX_withXEDGES_inEXX_withXTIMES_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX();
+    public abstract Traversal<Vertex, Map<Object, List<Vertex>>> get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXpropertyName_pageRankXX_withXedges_inEXX_withXtimes_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX();
 
     public abstract Traversal<Vertex, Map<Object, List<Vertex>>> get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_byXpageRankX_byXinEX_timesX1X_inXcreatedX_groupXmX_byXpageRankX_capXmX();
 
@@ -245,7 +245,7 @@ public abstract class PageRankTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXPROPERTY_NAME_pageRankXX_withXEDGES_inEXX_withXTIMES_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX() {
         // [{2.0=[v[4], v[4], v[4], v[4]], 1.0=[v[6], v[6], v[6], v[1], v[1], v[1]], software=[v[5], v[3], v[3], v[3]]}]
-        final Traversal<Vertex, Map<Object, List<Vertex>>> traversal = get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXPROPERTY_NAME_pageRankXX_withXEDGES_inEXX_withXTIMES_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX();
+        final Traversal<Vertex, Map<Object, List<Vertex>>> traversal = get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXpropertyName_pageRankXX_withXedges_inEXX_withXtimes_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX();
         printTraversalForm(traversal);
         final Map<Object, List<Vertex>> map = traversal.next();
         assertFalse(traversal.hasNext());
@@ -322,8 +322,8 @@ public abstract class PageRankTest extends AbstractGremlinProcessTest {
         }
 
         @Override
-        public Traversal<Vertex, Map<Object, List<Vertex>>> get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXPROPERTY_NAME_pageRankXX_withXEDGES_inEXX_withXTIMES_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX() {
-            return g.V().out("created").group("m").by(T.label).pageRank(1.0).with(PageRank.PROPERTY_NAME, "pageRank").with(PageRank.EDGES, __.inE()).with(PageRank.TIMES, 1).in("created").group("m").by("pageRank").cap("m");
+        public Traversal<Vertex, Map<Object, List<Vertex>>> get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXpropertyName_pageRankXX_withXedges_inEXX_withXtimes_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX() {
+            return g.V().out("created").group("m").by(T.label).pageRank(1.0).with(PageRank.propertyName, "pageRank").with(PageRank.edges, __.inE()).with(PageRank.times, 1).in("created").group("m").by("pageRank").cap("m");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3506ee3/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java
index c76941b..b70cb02 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java
@@ -23,7 +23,7 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.TestHelper;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.PeerPressureVertexProgram;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PeerPressureVertexProgramStep.PeerPressure;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PeerPressure;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -51,7 +51,7 @@ public abstract class PeerPressureTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_byXoutEX_byXclusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX();
 
-    public abstract Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXEDGES_outEX_withXPROPERTY_NAME_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX();
+    public abstract Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXedges_outEX_withXpropertyName_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX();
 
     @Test
     @LoadGraphWith(MODERN)
@@ -107,7 +107,7 @@ public abstract class PeerPressureTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXEDGES_outEX_withXPROPERTY_NAME_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX() {
         TestHelper.assumeNonDeterministic();
-        final Traversal<Vertex, Map<String, List<Object>>> traversal = get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXEDGES_outEX_withXPROPERTY_NAME_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX();
+        final Traversal<Vertex, Map<String, List<Object>>> traversal = get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXedges_outEX_withXpropertyName_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX();
         printTraversalForm(traversal);
         final List<Map<String, List<Object>>> results = traversal.toList();
         assertEquals(6, results.size());
@@ -143,8 +143,8 @@ public abstract class PeerPressureTest extends AbstractGremlinProcessTest {
         }
 
         @Override
-        public Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXEDGES_outEX_withXPROPERTY_NAME_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX() {
-            return g.V().has("name", "ripple").in("created").peerPressure().with(PeerPressure.EDGES,__.outE()).with(PeerPressure.PROPERTY_NAME, "cluster").repeat(__.union(__.identity(), __.both())).times(2).dedup().valueMap("name", "cluster");
+        public Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXedges_outEX_withXpropertyName_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX() {
+            return g.V().has("name", "ripple").in("created").peerPressure().with(PeerPressure.edges,__.outE()).with(PeerPressure.propertyName, "cluster").repeat(__.union(__.identity(), __.both())).times(2).dedup().valueMap("name", "cluster");
         }
     }
 }
\ No newline at end of file


[08/50] tinkerpop git commit: Removed gmavenplus plugin from hadoop-gremlin

Posted by sp...@apache.org.
Removed gmavenplus plugin from hadoop-gremlin

Not building any groovy here or running any scripts so there doesn't seem to be a need for it. CTR


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

Branch: refs/heads/TINKERPOP-1878
Commit: e8e22af4332e33d12067ed3e12237284067871aa
Parents: 962093e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 7 07:34:08 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 7 07:34:08 2018 -0400

----------------------------------------------------------------------
 hadoop-gremlin/pom.xml | 18 ------------------
 1 file changed, 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e8e22af4/hadoop-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/pom.xml b/hadoop-gremlin/pom.xml
index b094470..489502d 100644
--- a/hadoop-gremlin/pom.xml
+++ b/hadoop-gremlin/pom.xml
@@ -218,24 +218,6 @@ limitations under the License.
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-failsafe-plugin</artifactId>
             </plugin>
-            <plugin>
-                <groupId>org.codehaus.gmavenplus</groupId>
-                <artifactId>gmavenplus-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>addSources</goal>
-                            <goal>addTestSources</goal>
-                            <goal>generateStubs</goal>
-                            <goal>compile</goal>
-                            <goal>generateTestStubs</goal>
-                            <goal>compileTests</goal>
-                            <goal>removeStubs</goal>
-                            <goal>removeTestStubs</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
         </plugins>
     </build>
 </project>
\ No newline at end of file


[14/50] tinkerpop git commit: Install newest .NET Core SDK 2.1 version on Travis CTR

Posted by sp...@apache.org.
Install newest .NET Core SDK 2.1 version on Travis CTR

This hopefully fixes the CI problems we currently have where the key
couldn't be downloaded with a previous installation method.


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

Branch: refs/heads/TINKERPOP-1878
Commit: eba1df34989ea88a408648bb2a0cf1efbd46e00c
Parents: e8e22af
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Sat Jun 9 13:31:41 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Sat Jun 9 13:31:41 2018 +0200

----------------------------------------------------------------------
 .travis.yml | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/eba1df34/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 1c15c15..8ca1346 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,12 +18,11 @@ install:
   - mvn -version
 
 before_install:
-  - curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
-  - sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
-  - sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
+  - wget -q https://packages.microsoft.com/config/ubuntu/14.04/packages-microsoft-prod.deb
+  - sudo dpkg -i packages-microsoft-prod.deb
   - sudo apt-get install apt-transport-https
   - sudo apt-get update
-  - sudo apt-get install dotnet-sdk-2.1.101
+  - sudo apt-get install dotnet-sdk-2.1
 
 jobs:
   include:


[06/50] tinkerpop git commit: Merge branch 'TINKERPOP-1975'

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1975'

Conflicts:
	gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
	gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
	gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py


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

Branch: refs/heads/TINKERPOP-1878
Commit: f6274ed18bdb61e7e8bf25174580a0693f5aaa08
Parents: b75cfb8 160aef8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jun 6 15:42:59 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jun 6 15:42:59 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  4 ++
 docker/hadoop/Dockerfile                        | 25 -------
 docs/src/reference/the-traversal.asciidoc       | 30 ++++++--
 docs/src/upgrade/release-3.4.x.asciidoc         | 49 +++++++++++++
 .../tinkerpop/gremlin/jsr223/CoreImports.java   |  4 ++
 .../step/map/PageRankVertexProgramStep.java     | 75 ++++++++++++++++++--
 .../step/map/PeerPressureVertexProgramStep.java | 74 +++++++++++++++++--
 .../process/traversal/Parameterizing.java       | 37 ----------
 .../traversal/dsl/graph/GraphTraversal.java     | 24 ++++++-
 .../process/traversal/step/Configuring.java     | 41 +++++++++++
 .../process/traversal/step/Mutating.java        |  5 +-
 .../process/traversal/step/Parameterizing.java  | 39 ++++++++++
 .../process/traversal/step/filter/DropStep.java |  9 ++-
 .../traversal/step/map/AddEdgeStartStep.java    |  6 +-
 .../process/traversal/step/map/AddEdgeStep.java |  7 +-
 .../traversal/step/map/AddVertexStartStep.java  |  7 +-
 .../traversal/step/map/AddVertexStep.java       |  6 +-
 .../traversal/step/map/EdgeOtherVertexStep.java | 15 +++-
 .../traversal/step/map/EdgeVertexStep.java      | 15 +++-
 .../process/traversal/step/map/GraphStep.java   | 15 +++-
 .../traversal/step/map/PropertiesStep.java      | 15 +++-
 .../process/traversal/step/map/VertexStep.java  | 15 +++-
 .../step/sideEffect/AddPropertyStep.java        |  9 +--
 .../process/traversal/step/util/Parameters.java |  2 +
 .../strategy/decoration/ElementIdStrategy.java  |  2 +-
 .../strategy/decoration/PartitionStrategy.java  |  6 +-
 .../traversal/dsl/graph/GraphTraversalTest.java |  2 +-
 .../Process/Traversal/GraphTraversal.cs         |  9 +++
 gremlin-javascript/glv/generate.groovy          |  3 +-
 .../lib/process/graph-traversal.js              | 10 +++
 gremlin-python/glv/generate.groovy              |  1 +
 .../gremlin_python/process/graph_traversal.py   |  4 ++
 .../traversal/step/map/PageRankTest.java        | 41 +++++++++++
 .../traversal/step/map/PeerPressureTest.java    | 31 +++++++-
 34 files changed, 517 insertions(+), 120 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f6274ed1/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------


[32/50] tinkerpop git commit: TINKERPOP-1878 Test cleanup for sparql-gremlin

Posted by sp...@apache.org.
TINKERPOP-1878 Test cleanup for sparql-gremlin


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

Branch: refs/heads/TINKERPOP-1878
Commit: 5a163f238efa852a86a8966cc7be3d3b9e589efb
Parents: 47a9867
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 26 08:10:48 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 sparql-gremlin/pom.xml                          |  10 +-
 .../dsl/sparql/SparqlTraversalSource.java       |   4 +-
 .../gremlin/sparql/ResourceHelper.java          |  37 ---
 .../sparql/SparqlToGremlinCompilerTest.java     | 223 -------------------
 .../dsl/sparql/SparqlTraversalSourceTest.java   |  31 ++-
 5 files changed, 36 insertions(+), 269 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5a163f23/sparql-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/sparql-gremlin/pom.xml b/sparql-gremlin/pom.xml
index 0e3da38..731b822 100644
--- a/sparql-gremlin/pom.xml
+++ b/sparql-gremlin/pom.xml
@@ -41,9 +41,13 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.tinkerpop</groupId>
-            <artifactId>gremlin-test</artifactId>
-            <version>${project.version}</version>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-all</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5a163f23/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
index deb16f7..cc54aa5 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
@@ -28,6 +28,7 @@ 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.step.map.ConstantStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.InjectStep;
+import org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy.SparqlStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Transaction;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
@@ -46,6 +47,7 @@ public class SparqlTraversalSource implements TraversalSource {
     public SparqlTraversalSource(final Graph graph, final TraversalStrategies traversalStrategies) {
         this.graph = graph;
         this.strategies = traversalStrategies;
+        this.strategies.addStrategies(SparqlStrategy.instance());
     }
 
     public SparqlTraversalSource(final Graph graph) {
@@ -122,7 +124,7 @@ public class SparqlTraversalSource implements TraversalSource {
     /**
      * The start step for a SPARQL based traversal that accepts a string representation of the query to execute.
      */
-    public <S> SparqlTraversal<S,String> sparql(final String query) {
+    public <S> SparqlTraversal<S,?> sparql(final String query) {
         final SparqlTraversalSource clone = this.clone();
 
         // this is a bit of a hack to get remote traversals to work cleanly. on the remote side, we'd expect a

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5a163f23/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/ResourceHelper.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/ResourceHelper.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/ResourceHelper.java
deleted file mode 100644
index 4f58e61..0000000
--- a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/ResourceHelper.java
+++ /dev/null
@@ -1,37 +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.sparql;
-
-import org.apache.commons.io.IOUtils;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public class ResourceHelper {
-
-    public static String loadQuery(final String prefix, final int number) throws IOException {
-        final String path = "/queries/" + prefix + number + ".sparql";
-        final InputStream stream = ResourceHelper.class.getResourceAsStream(path);
-        return IOUtils.toString(stream, "UTF-8");
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5a163f23/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompilerTest.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompilerTest.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompilerTest.java
deleted file mode 100644
index 3fb49e8..0000000
--- a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompilerTest.java
+++ /dev/null
@@ -1,223 +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.sparql;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.apache.tinkerpop.gremlin.process.computer.Computer;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import static org.apache.tinkerpop.gremlin.sparql.SparqlToGremlinCompiler.convertToGremlinTraversal;
-import static org.junit.Assert.assertEquals;
-
-
-import java.io.IOException;
-
-import static org.apache.tinkerpop.gremlin.sparql.ResourceHelper.loadQuery;
-
-
-public class SparqlToGremlinCompilerTest {
-
-    private Graph modern, crew;
-    private GraphTraversalSource mg, cg;
-    private GraphTraversalSource mc, cc;
-/*
-    @Before
-    public void setUp() throws Exception {
-        modern = TinkerFactory.createModern();
-        mg = modern.traversal();
-        mc = modern.traversal(computer());
-        crew = TinkerFactory.createTheCrew();
-        cg = modern.traversal();
-        cc = modern.traversal(computer());
-    }
-
-    @Ignore
-    @Test
-    public void play() throws IOException {
-        final String query = loadQuery("modern", 11);
-        final Traversal traversal = convertToGremlinTraversal(modern, query);
-        System.out.println(traversal);
-        System.out.println(traversal.toList());
-        System.out.println(traversal);
-    }
-
-    /* Modern */
-
- /*   @Test
-    public void testModern1() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("a").hasLabel("person"),
-                as("a").out("knows").as("b"),
-                as("a").out("created").as("c"),
-                as("b").out("created").as("c"),
-                as("a").values("age").as("d")).where(as("d").is(lt(30))).
-                select("a", "b", "c");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 1)));
-    }
-
-    @Test
-    public void testModern2() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("a").hasLabel("person"),
-                as("a").out("knows").as("b"),
-                as("a").out("created").as("c"),
-                as("b").out("created").as("c"),
-                as("a").values("age").as("d")).where(as("d").is(lt(30)));
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 2)));
-    }
-
-    @Test
-    public void testModern3() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("person").values("name").as("name"),
-                as("person").values("age").as("age")).select("name", "age");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 3)));
-    }
-
-    @Test
-    public void testModern4() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("person").values("name").as("name"),
-                as("person").values("age").as("age"),
-                as("person").out("created").as("project"),
-                as("project").values("name").is("lop")).select("name", "age");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 4)));
-    }
-
-    @Test
-    public void testModern5() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("person").values("name").as("name"),
-                as("person").values("age").is(29)).select("name");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 5)));
-    }
-
-    @Test
-    public void testModern6() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("person").values("name").as("name"),
-                as("person").values("age").as("age")).where(and(as("age").is(gt(30)), as("age").is(lt(40)))).
-                select("name", "age");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 6)));
-    }
-
-    @Test
-    public void testModern7() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("person").values("name").as("name"),
-                as("person").values("age").as("age")).where(or(as("age").is(lt(30)), as("age").is(gt(40)))).
-                select("name", "age");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 7)));
-    }
-
-    @Test
-    public void testModern8() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("person").values("name").as("name"),
-                as("person").values("age").as("age")).where(
-                or(and(as("age").is(gt(30)), as("age").is(lt(40))), as("name").is("marko"))).
-                select("name", "age");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 8)));
-    }
-
-    @Test
-    public void testModern9() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("a").values("name").as("name")).where(as("a").values("age")).
-                select("name");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 9)));
-    }
-
-    @Test
-    public void testModern10() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("a").values("name").as("name")).where(__.not(as("a").values("age"))).
-                select("name");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 10)));
-    }
-
-    @Test
-    public void testModern11() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("a").out("created").as("b"),
-                as("a").values("name").as("name")).dedup("name").select("name");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 11)));
-    }
-
-    @Test
-    public void testModern12() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("a").out("created").as("b"),
-                as("b").values("name").as("name")).dedup();
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 12)));
-    }
-
-    @Test
-    public void testModern13() throws Exception {
-        final GraphTraversal expected = mg.V().match(
-                as("a").out("created").as("b"),
-                as("a").values("name").as("c")).dedup("a", "b", "c").select("a", "b", "c");
-        assertEquals(expected, convertToGremlinTraversal(modern, loadQuery("modern", 13)));
-    }
-
-    /* The Crew */
-
- /*   @Test
-    public void testCrew1() throws Exception {
-        final GraphTraversal expected = cg.V().match(
-                as("a").values("name").is("daniel"),
-                as("a").properties("location").as("b"),
-                as("b").value().as("c"),
-                as("b").values("startTime").as("d")).
-                select("c", "d");
-        assertEquals(expected, convertToGremlinTraversal(crew, loadQuery("crew", 1)));
-    }
-
-    /* Computer Mode */
-
-  /*  @Test
-    public void testModernInComputerMode() throws Exception {
-        final GraphTraversal expected = mc.V().match(
-                as("a").hasLabel("person"),
-                as("a").out("knows").as("b"),
-                as("a").out("created").as("c"),
-                as("b").out("created").as("c"),
-                as("a").values("age").as("d")).where(as("d").is(lt(30))).
-                select("a", "b", "c");
-        assertEquals(expected, convertToGremlinTraversal(mc, loadQuery("modern", 1)));
-    }
-
-    @Test
-    public void testCrewInComputerMode() throws Exception {
-        final GraphTraversal expected = cc.V().match(
-                as("a").values("name").is("daniel"),
-                as("a").properties("location").as("b"),
-                as("b").value().as("c"),
-                as("b").values("startTime").as("d")).
-                select("c", "d");
-        assertEquals(expected, convertToGremlinTraversal(crew, loadQuery("crew", 1)));
-    } */
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5a163f23/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
index 9e5ffc0..9bb6025 100644
--- a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
+++ b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
@@ -18,11 +18,16 @@
  */
 package org.apache.tinkerpop.gremlin.sparql.process.traversal.dsl.sparql;
 
-import org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy.SparqlStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
 import org.junit.Test;
 
+import java.util.HashMap;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
+
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
@@ -31,9 +36,25 @@ public class SparqlTraversalSourceTest {
     @Test
     public void shouldDoStuff() {
         final Graph graph = TinkerFactory.createModern();
-        final SparqlTraversalSource g = graph.traversal(SparqlTraversalSource.class).
-                                                withStrategies(SparqlStrategy.instance());
-        final Object x = g.sparql("SELECT ?name ?age WHERE { ?person v:name ?name . ?person v:age ?age }").toList();
-        System.out.println(x);
+        final SparqlTraversalSource g = graph.traversal(SparqlTraversalSource.class);
+        final List<?> x = g.sparql("SELECT ?name ?age WHERE { ?person v:name ?name . ?person v:age ?age }").toList();
+        assertThat(x, containsInAnyOrder(
+                new HashMap<String,Object>(){{
+                    put("name", "marko");
+                    put("age", 29);
+                }},
+                new HashMap<String,Object>(){{
+                    put("name", "vadas");
+                    put("age", 27);
+                }},
+                new HashMap<String,Object>(){{
+                    put("name", "josh");
+                    put("age", 32);
+                }},
+                new HashMap<String,Object>(){{
+                    put("name", "peter");
+                    put("age", 35);
+                }}
+        ));
     }
 }


[20/50] tinkerpop git commit: Merge branch 'TINKERPOP-1831'

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1831'


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

Branch: refs/heads/TINKERPOP-1878
Commit: 4a7cdb589b8985b814bd8f02064a5fc78e835df5
Parents: 89c23bd 7963fdf
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jun 13 05:49:20 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jun 13 05:49:20 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   3 +
 docs/src/upgrade/release-3.4.x.asciidoc         |  22 +++
 .../bulkloading/BulkLoaderVertexProgram.java    |   6 -
 .../step/sideEffect/AddPropertyStep.java        |   6 +-
 .../util/event/ConsoleMutationListener.java     |   5 -
 .../step/util/event/MutationListener.java       |  11 +-
 .../strategy/decoration/EventStrategy.java      | 108 +++++-----
 .../strategy/decoration/EventStrategyTest.java  |   1 -
 .../decoration/EventStrategyProcessTest.java    | 197 ++++---------------
 9 files changed, 130 insertions(+), 229 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4a7cdb58/CHANGELOG.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4a7cdb58/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------


[18/50] tinkerpop git commit: Merge branch 'TINKERPOP-1518'

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1518'


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

Branch: refs/heads/TINKERPOP-1878
Commit: ad19a1179d241340e81413fd951c00dd9cb82058
Parents: f3506ee 221fda5
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jun 13 05:44:54 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jun 13 05:44:54 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 docs/src/dev/provider/index.asciidoc            |  4 +
 docs/src/upgrade/release-3.4.x.asciidoc         | 20 +++++
 .../tinkerpop/gremlin/structure/Graph.java      |  1 -
 .../tinkerpop/gremlin/AbstractGremlinTest.java  | 78 +++++++++++++-------
 .../apache/tinkerpop/gremlin/GraphManager.java  |  5 ++
 .../apache/tinkerpop/gremlin/GraphProvider.java | 16 ++++
 .../neo4j/AbstractNeo4jGraphProvider.java       | 23 +++++-
 8 files changed, 121 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ad19a117/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------


[29/50] tinkerpop git commit: TINKERPOP-1878 Added a basics for sparql execution in a traversal

Posted by sp...@apache.org.
TINKERPOP-1878 Added a basics for sparql execution in a traversal


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

Branch: refs/heads/TINKERPOP-1878
Commit: 523e88f3855014a3f543de600a2e377d2abd3560
Parents: c5e7543
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jan 25 14:46:31 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 .../traversal/step/map/ConstantStep.java        |  4 ++
 .../traversal/strategy/SparqlStrategy.java      | 56 +++++++++++++++++++-
 .../dsl/sparql/SparqlTraversalSourceTest.java   | 39 ++++++++++++++
 .../src/test/resources/log4j-silent.properties  | 23 ++++++++
 .../src/test/resources/log4j-test.properties    | 23 ++++++++
 5 files changed, 144 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/523e88f3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConstantStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConstantStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConstantStep.java
index 5d02e28..749de31 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConstantStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConstantStep.java
@@ -36,6 +36,10 @@ public class ConstantStep<S, E> extends MapStep<S, E> {
         this.constant = constant;
     }
 
+    public E getConstant() {
+        return this.constant;
+    }
+
     @Override
     protected E map(final Traverser.Admin<S> traverser) {
         return this.constant;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/523e88f3/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
index 6440127..07ac4cf 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
@@ -18,8 +18,62 @@
  */
 package org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy;
 
+import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ConstantStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.TraversalMapStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+import org.apache.tinkerpop.gremlin.sparql.SparqlToGremlinCompiler;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
+import java.util.Collections;
+import java.util.Set;
+
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class SparqlStrategy {
+public class SparqlStrategy extends AbstractTraversalStrategy<TraversalStrategy.DecorationStrategy>
+        implements TraversalStrategy.DecorationStrategy {
+    private static final SparqlStrategy INSTANCE = new SparqlStrategy();
+
+    private static final Set<Class<? extends DecorationStrategy>> POSTS = Collections.singleton(VertexProgramStrategy.class);
+
+    private SparqlStrategy() {}
+
+    public static SparqlStrategy instance() {
+        return INSTANCE;
+    }
+
+    @Override
+    public Set<Class<? extends DecorationStrategy>> applyPost() {
+        return POSTS;
+    }
+
+
+    @Override
+    public void apply(final Traversal.Admin<?, ?> traversal) {
+        if (!(traversal.getParent() instanceof EmptyStep))
+            return;
+
+        if (traversal.getSteps().size() == 1 && traversal.getEndStep() instanceof ConstantStep) {
+            final ConstantStep stepWithSparql = (ConstantStep) traversal.getEndStep();
+            final Object constant = stepWithSparql.getConstant();
+            if (constant instanceof String) {
+                final String sparql = (String) constant;
+                final Traversal<Vertex, ?> sparqlTraversal = SparqlToGremlinCompiler.convertToGremlinTraversal(
+                        traversal.getGraph().get(), sparql);
+                TraversalHelper.removeAllSteps(traversal);
+                sparqlTraversal.asAdmin().getSteps().forEach(s -> traversal.addStep(s));
+            } else {
+                // The ConstantStep expects a string value
+                throw new IllegalStateException("SparqlStrategy cannot be applied to this traversal");
+            }
+        } else {
+            // SparqlStrategy requires that there be one step and it be a ConstantStep that contains some SPARQL
+            throw new IllegalStateException("SparqlStrategy cannot be applied to this traversal");
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/523e88f3/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
new file mode 100644
index 0000000..9e5ffc0
--- /dev/null
+++ b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.sparql.process.traversal.dsl.sparql;
+
+import org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy.SparqlStrategy;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
+import org.junit.Test;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class SparqlTraversalSourceTest {
+
+    @Test
+    public void shouldDoStuff() {
+        final Graph graph = TinkerFactory.createModern();
+        final SparqlTraversalSource g = graph.traversal(SparqlTraversalSource.class).
+                                                withStrategies(SparqlStrategy.instance());
+        final Object x = g.sparql("SELECT ?name ?age WHERE { ?person v:name ?name . ?person v:age ?age }").toList();
+        System.out.println(x);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/523e88f3/sparql-gremlin/src/test/resources/log4j-silent.properties
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/resources/log4j-silent.properties b/sparql-gremlin/src/test/resources/log4j-silent.properties
new file mode 100644
index 0000000..1825bb0
--- /dev/null
+++ b/sparql-gremlin/src/test/resources/log4j-silent.properties
@@ -0,0 +1,23 @@
+# 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.
+
+# this file should always have logging set to OFF.  it seems, however, that an appender of some sort is
+# required or else some logs throw error and use other log4j.properties files on the path.
+log4j.rootLogger=OFF, stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%p] %C - %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/523e88f3/sparql-gremlin/src/test/resources/log4j-test.properties
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/resources/log4j-test.properties b/sparql-gremlin/src/test/resources/log4j-test.properties
new file mode 100644
index 0000000..79038b1
--- /dev/null
+++ b/sparql-gremlin/src/test/resources/log4j-test.properties
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+log4j.rootLogger=WARN, stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%p] %C - %m%n
\ No newline at end of file


[33/50] tinkerpop git commit: TINKERPOP-1878 Updates to changelog and code comments

Posted by sp...@apache.org.
TINKERPOP-1878 Updates to changelog and code comments


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

Branch: refs/heads/TINKERPOP-1878
Commit: 47a98675f81646425ac3d5c4c2e0cd3078609397
Parents: 0731372
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jan 25 17:09:17 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                             | 1 +
 .../process/traversal/dsl/sparql/SparqlTraversalSource.java    | 6 ++++++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/47a98675/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 2320162..9c74940 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -101,6 +101,7 @@ This release also includes changes from <<release-3-2-8, 3.2.8>>.
 
 * Fixed regression issue where the HTTPChannelizer doesn't instantiate the specified AuthenticationHandler.
 * Defaulted GLV tests for gremlin-python to run for GraphSON 3.0.
+* Fixed a bug in dynamic Gryo registration where registrations that did not have serializers would fail.
 * Fixed a bug with `Tree` serialization in GraphSON 3.0.
 * In gremlin-python, the GraphSON 3.0 `g:Set` type is now deserialized to `List`.
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/47a98675/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
index 3889d95..deb16f7 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
@@ -124,6 +124,12 @@ public class SparqlTraversalSource implements TraversalSource {
      */
     public <S> SparqlTraversal<S,String> sparql(final String query) {
         final SparqlTraversalSource clone = this.clone();
+
+        // this is a bit of a hack to get remote traversals to work cleanly. on the remote side, we'd expect a
+        // GraphTraversalSource not a SparqlTraversalSource (given that sparql-gremlin is to be implemented in the
+        // DSL pattern). Instead of just sending the constant() step with the sparql query we also include an
+        // inject() step which will be recognized by a GraphTraversalSource on the remote side. Since SparqlStrategy
+        // wholly replaces both of these steps, the traversal bytecode can be read properly.
         clone.bytecode.addStep(GraphTraversal.Symbols.inject);
         clone.bytecode.addStep(GraphTraversal.Symbols.constant, query);
         final SparqlTraversal.Admin<S, S> traversal = new DefaultSparqlTraversal<>(clone);


[47/50] tinkerpop git commit: TINKERPOP-1878 Added basic docs for sparql-gremlin

Posted by sp...@apache.org.
TINKERPOP-1878 Added basic docs for sparql-gremlin


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

Branch: refs/heads/TINKERPOP-1878
Commit: 6dffbc54440d3eab197e28ece68d4b780054068d
Parents: 69d6059
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jan 29 11:04:23 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 docs/preprocessor/install-plugins.sh    |  2 +-
 docs/src/reference/index.asciidoc       |  2 +
 docs/src/reference/transpilers.asciidoc | 66 ++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6dffbc54/docs/preprocessor/install-plugins.sh
----------------------------------------------------------------------
diff --git a/docs/preprocessor/install-plugins.sh b/docs/preprocessor/install-plugins.sh
index 0a7ca31..f1da197 100755
--- a/docs/preprocessor/install-plugins.sh
+++ b/docs/preprocessor/install-plugins.sh
@@ -25,7 +25,7 @@ TMP_DIR=$3
 INSTALL_TEMPLATE="docs/preprocessor/install-plugins.groovy"
 INSTALL_FILE="${TMP_DIR}/install-plugins.groovy"
 
-plugins=("hadoop-gremlin" "spark-gremlin" "neo4j-gremlin")
+plugins=("hadoop-gremlin" "spark-gremlin" "neo4j-gremlin", "sparql-gremlin")
 # plugins=()
 pluginsCount=${#plugins[@]}
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6dffbc54/docs/src/reference/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/index.asciidoc b/docs/src/reference/index.asciidoc
index 6e81bf2..02a218b 100644
--- a/docs/src/reference/index.asciidoc
+++ b/docs/src/reference/index.asciidoc
@@ -45,6 +45,8 @@ include::implementations-hadoop-end.asciidoc[]
 
 include::gremlin-variants.asciidoc[]
 
+include::transpilers.asciidoc[]
+
 include::conclusion.asciidoc[]
 
 include::acknowledgements.asciidoc[]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6dffbc54/docs/src/reference/transpilers.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/transpilers.asciidoc b/docs/src/reference/transpilers.asciidoc
new file mode 100644
index 0000000..305e3dc
--- /dev/null
+++ b/docs/src/reference/transpilers.asciidoc
@@ -0,0 +1,66 @@
+////
+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.
+////
+[[transpilers]]
+= Gremlin Transpilers
+
+There are many languages built to query data. SQL is typically used to query relational data. There is SPARQL for RDF
+data. Cypher is used to do pattern matching in graph data. The list could go on. Transpilers convert languages like
+these to Gremlin so that it becomes possible to use them in any context that Gremlin is used. In other words, a
+Gremlin Transpiler enables a particular query language to work on any TinkerPop-enabled graph system.
+
+== SPARQL-Gremlin
+
+[source,xml]
+----
+<dependency>
+   <groupId>org.apache.tinkerpop</groupId>
+   <artifactId>sparql-gremlin</artifactId>
+   <version>x.y.z</version>
+</dependency>
+----
+
+The SPARQL-Gremlin transpiler converts link:https://en.wikipedia.org/wiki/SPARQL[SPARQL] queries into Gremlin so that
+they can be executed across any TinkerPop-enabled graph system. To use this transpiler in the Gremlin Console, first
+install and activate the "tinkerpop.sparql" plugin:
+
+[source,text]
+----
+gremlin> :install org.apache.tinkerpop sparql-gremlin x.y.z
+==>Loaded: [org.apache.tinkerpop, sparql-gremlin, x.y.z]
+gremlin> :plugin use tinkerpop.sparql
+==>tinkerpop.sparql activated
+----
+
+Installing this plugin will download appropriate dependencies and import certain classes to the console so that they
+may be used as follows:
+
+[gremlin-groovy,modern]
+----
+graph = TinkerFactory.createModern()
+g = graph.traversal(SparqlTraversalSource)                                                             <1>
+g.sparql("""SELECT ?name ?age
+            WHERE { ?person v:name ?name . ?person v:age ?age }
+            ORDER BY ASC(?age)""")                                                                     <2>
+----
+
+<1> Define `g` as a `TraversalSource` that uses the `SparqlTraversalSource` - by default, the `traversal()` method
+usually returns a `GraphTraversalSource` which includes the standard Gremlin starts steps like `V()` or `E()`. In this
+case, the `SparqlTraversalSource` enables starts steps that are specific to SPARQL only - in this case the `sparql()`
+start step.
+<2> Execute a SPARQL query against the TinkerGraph instance. The `SparqlTraversalSource` uses a
+<<traversalstrategy,TraversalStrategy>> to transparently converts that SPARQL query into a standard Gremlin traversal
+and then when finally iterated, executes that against the TinkerGraph.


[03/50] tinkerpop git commit: Remove deprecation from eval() method

Posted by sp...@apache.org.
Remove deprecation from eval() method

This method was never meant to be deprecated. It seems to have been deprecated as a result of a bad merge. Looking back at tp32 it's clear that a previously removed method on this tp33 branch was the original one to be deprecated and this one was meant to stay. CTR


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

Branch: refs/heads/TINKERPOP-1878
Commit: a0b7ce517a45b07535f526c8879e93003639d306
Parents: d7b756b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jun 5 08:17:23 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jun 5 08:17:23 2018 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java   | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a0b7ce51/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index 15d3534..fc171bb 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -329,10 +329,7 @@ public class GremlinExecutor implements AutoCloseable {
 
     /**
      * Evaluates bytecode with bindings for a specific language into a {@link Traversal}.
-     *
-     * @deprecated As of release 3.2.7, replaced by {@link #eval(Bytecode, Bindings, String, String)}
      */
-    @Deprecated
     public Traversal.Admin eval(final Bytecode bytecode, final Bindings boundVars, final String language, final String traversalSource) throws ScriptException {
         final String lang = Optional.ofNullable(language).orElse("gremlin-groovy");
 


[31/50] tinkerpop git commit: TINKERPOP-1878 sparql() step works over remoting

Posted by sp...@apache.org.
TINKERPOP-1878 sparql() step works over remoting

At this point it is only tested to work with Gryo 3.0. Fixed a bug with how dynamic gryo registrations work - they failed if you didn't have a specific serializer specified. Introduced a bit of a hack to make SparqlTraversalSource behave like a GraphTraversalSource and thus more cleanly follow the DSL pattern. Not sure if that's a great approach yet or not, but it seems harmless at this point.


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

Branch: refs/heads/TINKERPOP-1878
Commit: 0731372d4bbe30b931f95c616e3f3b408331ab57
Parents: 651a896
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jan 25 17:00:54 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java | 5 ++++-
 sparql-gremlin/pom.xml                                          | 4 ----
 .../process/traversal/dsl/sparql/SparqlTraversalSource.java     | 3 +++
 .../sparql/process/traversal/strategy/SparqlStrategy.java       | 5 +++--
 4 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0731372d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
index 6bb7b34..4a325dd 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
@@ -382,6 +382,9 @@ public enum GryoVersion {
                     "org.apache.tinkerpop.gremlin.driver.ser.RequestMessageGryoSerializer", 167);
             tryAddDynamicType(this, "org.apache.tinkerpop.gremlin.driver.message.ResponseMessage",
                     "org.apache.tinkerpop.gremlin.driver.ser.ResponseMessageGryoSerializer", 169);
+
+            tryAddDynamicType(this, "org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy.SparqlStrategy",
+                    null, 1690);
         }};
     }
 
@@ -560,7 +563,7 @@ public enum GryoVersion {
                                             final String serializer, final int registrationId) {
         try {
             final Class typeClass = Class.forName(type);
-            final Optional<SerializerShim<?>> serializerInstance = Optional.of(serializer)
+            final Optional<SerializerShim<?>> serializerInstance = Optional.ofNullable(serializer)
                     .map(FunctionUtils.wrapFunction(Class::forName))
                     .map(FunctionUtils.wrapFunction(c -> (SerializerShim<?>) c.getConstructor().newInstance()));
             if (serializerInstance.isPresent()) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0731372d/sparql-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/sparql-gremlin/pom.xml b/sparql-gremlin/pom.xml
index 0dceb85..0e3da38 100644
--- a/sparql-gremlin/pom.xml
+++ b/sparql-gremlin/pom.xml
@@ -11,10 +11,6 @@
     <artifactId>sparql-gremlin</artifactId>
     <name>Apache TinkerPop :: SPARQL Gremlin</name>
 
-    <properties>
-        <query.dir>src/test/resources/sparql/queries</query.dir>
-    </properties>
-
     <dependencies>
         <dependency>
             <groupId>org.apache.jena</groupId>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0731372d/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
index b156ed1..3889d95 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
@@ -27,6 +27,7 @@ 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.step.map.ConstantStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.InjectStep;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Transaction;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
@@ -123,8 +124,10 @@ public class SparqlTraversalSource implements TraversalSource {
      */
     public <S> SparqlTraversal<S,String> sparql(final String query) {
         final SparqlTraversalSource clone = this.clone();
+        clone.bytecode.addStep(GraphTraversal.Symbols.inject);
         clone.bytecode.addStep(GraphTraversal.Symbols.constant, query);
         final SparqlTraversal.Admin<S, S> traversal = new DefaultSparqlTraversal<>(clone);
+        traversal.addStep(new InjectStep<S>(traversal));
         return traversal.addStep(new ConstantStep<S,String>(traversal, query));
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0731372d/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
index bb0b326..d74ac3e 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy;
 
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
+import org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ConstantStep;
@@ -44,7 +45,7 @@ public class SparqlStrategy extends AbstractTraversalStrategy<TraversalStrategy.
         implements TraversalStrategy.DecorationStrategy {
     private static final SparqlStrategy INSTANCE = new SparqlStrategy();
 
-    private static final Set<Class<? extends DecorationStrategy>> POSTS = Collections.singleton(VertexProgramStrategy.class);
+    private static final Set<Class<? extends DecorationStrategy>> POSTS = Collections.singleton(RemoteStrategy.class);
 
     private SparqlStrategy() {}
 
@@ -63,7 +64,7 @@ public class SparqlStrategy extends AbstractTraversalStrategy<TraversalStrategy.
         if (!(traversal.getParent() instanceof EmptyStep))
             return;
 
-        if (traversal.getSteps().size() == 1 && traversal.getEndStep() instanceof ConstantStep) {
+        if (traversal.getSteps().size() == 2 && traversal.getEndStep() instanceof ConstantStep) {
             final ConstantStep stepWithSparql = (ConstantStep) traversal.getEndStep();
             final Object constant = stepWithSparql.getConstant();
             if (constant instanceof String) {


[13/50] tinkerpop git commit: TINKERPOP-1518 Minor refactoring - extracted requirement check function

Posted by sp...@apache.org.
TINKERPOP-1518 Minor refactoring - extracted requirement check function


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

Branch: refs/heads/TINKERPOP-1878
Commit: 221fda584c6baf7c65eb4e6eebf72bb0ba251de4
Parents: aec1709
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jun 8 07:45:29 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 8 07:45:29 2018 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/AbstractGremlinTest.java  | 52 ++++++++++----------
 1 file changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/221fda58/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
index 8f55329..7ca44ba 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
@@ -37,6 +37,7 @@ import org.junit.rules.TestName;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -64,8 +65,6 @@ import static org.junit.Assume.assumeThat;
 public abstract class AbstractGremlinTest {
     private static final Logger logger = LoggerFactory.getLogger(AbstractGremlinTest.class);
 
-    protected static final Map<Pair<Class<?>, String>, Boolean> featureCache = new HashMap<>();
-
     protected Graph graph;
     protected GraphTraversalSource g;
     protected Configuration config;
@@ -84,20 +83,10 @@ public abstract class AbstractGremlinTest {
 
         graphProvider = GraphManager.getGraphProvider();
 
+        // pre-check if available from graph provider to avoid graph creation
         final Optional<Graph.Features> staticFeatures = graphProvider.getStaticFeatures();
         if (staticFeatures.isPresent()) {
-            for (FeatureRequirement fr : featureRequirementSet) {
-                try {
-                    assumeThat(String.format("StaticFeatures of the graph do not support all of the features required by this test so it will be ignored: %s.%s=%s",
-                            fr.featureClass().getSimpleName(), fr.feature(), fr.supported()),
-                            staticFeatures.get().supports(fr.featureClass(), fr.feature()), is(fr.supported()));
-                } catch (NoSuchMethodException nsme) {
-                    throw new NoSuchMethodException(String.format("[supports%s] is not a valid feature on %s", fr.feature(), fr.featureClass()));
-                } catch (UnsupportedOperationException uoe) {
-                    // no worries - it just means that we can't use the cache to support this check and will have to
-                    // incur the cost of instantiating a graph instance directly
-                }
-            }
+            assumeRequirementsAreMetForTest(featureRequirementSet, staticFeatures.get(), true);
         }
 
         graphProvider.getTestListener().ifPresent(l -> l.onTestStart(this.getClass(), name.getMethodName()));
@@ -110,18 +99,10 @@ public abstract class AbstractGremlinTest {
         graph = graphProvider.openTestGraph(config);
         g = graphProvider.traversal(graph);
 
-        for (FeatureRequirement fr : featureRequirementSet) {
-            try {
-                // even if we checked static features above it's of little cost to recheck again with the real graph
-                // once it is instantiated. the real cost savings is preventing graph creation in the first place so
-                // let's double check that all is legit.
-                assumeThat(String.format("%s does not support all of the features required by this test so it will be ignored: %s.%s=%s",
-                                graph.getClass().getSimpleName(), fr.featureClass().getSimpleName(), fr.feature(), fr.supported()),
-                        graph.features().supports(fr.featureClass(), fr.feature()), is(fr.supported()));
-            } catch (NoSuchMethodException nsme) {
-                throw new NoSuchMethodException(String.format("[supports%s] is not a valid feature on %s", fr.feature(), fr.featureClass()));
-            }
-        }
+        // even if we checked static features earlier it's of little cost to recheck again with the real graph
+        // once it is instantiated. the real cost savings is preventing graph creation in the first place so
+        // let's double check that all is legit.
+        assumeRequirementsAreMetForTest(featureRequirementSet, graph.features(), false);
 
         beforeLoadGraphWith(graph);
 
@@ -131,6 +112,25 @@ public abstract class AbstractGremlinTest {
         afterLoadGraphWith(graph);
     }
 
+    private static void assumeRequirementsAreMetForTest(final Set<FeatureRequirement> featureRequirementSet,
+                                                        final Graph.Features features, final boolean staticCheck)
+            throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
+        for (FeatureRequirement fr : featureRequirementSet) {
+            try {
+                assumeThat(String.format("Features of the graph do not support all of the features required by this test so it will be ignored: %s.%s=%s",
+                        fr.featureClass().getSimpleName(), fr.feature(), fr.supported()),
+                        features.supports(fr.featureClass(), fr.feature()), is(fr.supported()));
+            } catch (NoSuchMethodException nsme) {
+                throw new NoSuchMethodException(String.format("[supports%s] is not a valid feature on %s", fr.feature(), fr.featureClass()));
+            } catch (UnsupportedOperationException uoe) {
+                // no worries if this is a check of static features - it just means that we can't use the cache to
+                // support this check and will have to incur the cost of instantiating a graph instance directly. but,
+                // if this is not a static check then something else is amiss and we should throw.
+                if (staticCheck) throw uoe;
+            }
+        }
+    }
+
     protected void beforeLoadGraphWith(final Graph g) throws Exception {
         // do nothing
     }


[43/50] tinkerpop git commit: testing logo

Posted by sp...@apache.org.
testing logo

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

Branch: refs/heads/TINKERPOP-1878
Commit: 1166716886d65ea0aec362b1e93194b52514dd43
Parents: 6dffbc5
Author: Harsh Thakkar <ha...@gmail.com>
Authored: Wed Mar 28 10:29:43 2018 +0200
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 docs/src/reference/transpilers.asciidoc | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11667168/docs/src/reference/transpilers.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/transpilers.asciidoc b/docs/src/reference/transpilers.asciidoc
index 305e3dc..9100f84 100644
--- a/docs/src/reference/transpilers.asciidoc
+++ b/docs/src/reference/transpilers.asciidoc
@@ -17,6 +17,10 @@ limitations under the License.
 [[transpilers]]
 = Gremlin Transpilers
 
+![gremlinator][SPARQL-Gremlin]
+
+[SPARQL-Gremlin]: https://raw.githubusercontent.com/LITMUS-Benchmark-Suite/sparql-to-gremlin/master/docs/images/sparql-gremlin-logo.png
+
 There are many languages built to query data. SQL is typically used to query relational data. There is SPARQL for RDF
 data. Cypher is used to do pattern matching in graph data. The list could go on. Transpilers convert languages like
 these to Gremlin so that it becomes possible to use them in any context that Gremlin is used. In other words, a


[27/50] tinkerpop git commit: TINKERPOP-1878 sparql-gremlin is now building

Posted by sp...@apache.org.
TINKERPOP-1878 sparql-gremlin is now building

Fixed some basic pom.xml issues and resolved dependency conflicts.


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

Branch: refs/heads/TINKERPOP-1878
Commit: 72c6072ba8d22ccb81806826de67331a8fbe653e
Parents: 3dc8d9f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jan 24 15:23:57 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 pom.xml                | 18 ++++++++++++++++
 sparql-gremlin/pom.xml | 52 ++++++++++++++++++---------------------------
 2 files changed, 39 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/72c6072b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 45ff557..3fbdf06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,6 +108,18 @@ limitations under the License.
             <email>twilmes@gmail.com</email>
             <url>https://github.com/twilmes</url>
         </contributor>
+        <contributor>
+            <name>Harsh Thakkar</name>
+            <email>harsh9t@gmail.com</email>
+            <organization>University of Bonn</organization>
+            <organizationUrl>http://harshthakkar.in</organizationUrl>
+        </contributor>
+        <contributor>
+            <name>Dharmen Punjani</name>
+            <email>dharmen.punjani@gmail.com</email>
+            <organization>National and Kapodistrian University of Athens</organization>
+            <organizationUrl>http://wdaqua.eu/students/dharmen-punjani</organizationUrl>
+        </contributor>
     </contributors>
     <prerequisites>
         <maven>3.1.0</maven>
@@ -124,6 +136,7 @@ limitations under the License.
         <module>hadoop-gremlin</module>
         <module>spark-gremlin</module>
         <module>neo4j-gremlin</module>
+        <module>sparql-gremlin</module>
         <module>gremlin-driver</module>
         <module>gremlin-console</module>
         <module>gremlin-server</module>
@@ -692,6 +705,11 @@ limitations under the License.
                 </exclusions>
             </dependency>
             <dependency>
+                <groupId>org.apache.httpcomponents</groupId>
+                <artifactId>httpclient</artifactId>
+                <version>4.5.1</version>
+            </dependency>
+            <dependency>
                 <groupId>commons-httpclient</groupId>
                 <artifactId>commons-httpclient</artifactId>
                 <version>3.1</version>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/72c6072b/sparql-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/sparql-gremlin/pom.xml b/sparql-gremlin/pom.xml
index e134d31..d38a85d 100644
--- a/sparql-gremlin/pom.xml
+++ b/sparql-gremlin/pom.xml
@@ -2,55 +2,46 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
     <parent>
         <artifactId>tinkerpop</artifactId>
         <groupId>org.apache.tinkerpop</groupId>
         <version>3.3.2-SNAPSHOT</version>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
-
     <artifactId>sparql-gremlin</artifactId>
-    <organization>
-        <name>WDAQUA-ITN</name>
-        <url>http://wdaqua.eu</url>
-    </organization>
-    <developers>
-        <developer>
-            <name>Harsh Thakkar</name>
-            <email>harsh9t@gmail.com</email>
-            <organization>University of Bonn</organization>
-            <organizationUrl>http://harshthakkar.in</organizationUrl>
-        </developer>
-        <developer>
-            <name>Dharmen Punjani</name>
-            <email>dharmen.punjani@gmail.com</email>
-            <organization>National and Kapodistrian University of Athens</organization>
-            <organizationUrl>http://wdaqua.eu/students/dharmen-punjani</organizationUrl>
-        </developer>
-    </developers>
+    <name>Apache TinkerPop :: SPARQL Gremlin</name>
 
     <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <jena.version>3.0.0</jena.version>
         <query.dir>src/test/resources/sparql/queries</query.dir>
     </properties>
 
     <dependencies>
-    <dependency>
-        <groupId>org.apache.jena</groupId>
-        <artifactId>apache-jena-libs</artifactId>
-        <type>pom</type>
-        <version>${jena.version}</version>
-    </dependency>
+        <dependency>
+            <groupId>org.apache.jena</groupId>
+            <artifactId>apache-jena-libs</artifactId>
+            <type>pom</type>
+            <version>3.0.0</version>
+            <exclusions>
+                <!-- self-conflict -->
+                <exclusion>
+                    <groupId>org.apache.httpcomponents</groupId>
+                    <artifactId>httpclient</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.apache.tinkerpop</groupId>
             <artifactId>gremlin-core</artifactId>
-            <version>3.3.2-SNAPSHOT</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.tinkerpop</groupId>
             <artifactId>tinkergraph-gremlin</artifactId>
-            <version>3.3.2-SNAPSHOT</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.tinkerpop</groupId>
@@ -59,5 +50,4 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
-
 </project>
\ No newline at end of file


[02/50] tinkerpop git commit: TINKERPOP-1975 Introduced with() step and Configuring interface

Posted by sp...@apache.org.
TINKERPOP-1975 Introduced with() step and Configuring interface

Moved Parameterizing to the package containing the other step interfaces. Changed interface hierarchy with Parameterizing and Mutating now that Configuring is present. Both of those changes make this body of work a breaking change to existing APIs though it should really only affect graph providers and even then the fix is quite simple as described in the upgrade documentation.


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

Branch: refs/heads/TINKERPOP-1878
Commit: 160aef85649de26da94b54f024d7243ebb5de158
Parents: d7843fe
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 31 12:55:13 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jun 5 06:34:49 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  4 ++
 docker/hadoop/Dockerfile                        | 25 -------
 docs/src/reference/the-traversal.asciidoc       | 30 ++++++--
 docs/src/upgrade/release-3.4.x.asciidoc         | 49 +++++++++++++
 .../tinkerpop/gremlin/jsr223/CoreImports.java   |  4 ++
 .../step/map/PageRankVertexProgramStep.java     | 75 ++++++++++++++++++--
 .../step/map/PeerPressureVertexProgramStep.java | 74 +++++++++++++++++--
 .../process/traversal/Parameterizing.java       | 37 ----------
 .../traversal/dsl/graph/GraphTraversal.java     | 24 ++++++-
 .../process/traversal/step/Configuring.java     | 41 +++++++++++
 .../process/traversal/step/Mutating.java        |  5 +-
 .../process/traversal/step/Parameterizing.java  | 39 ++++++++++
 .../process/traversal/step/filter/DropStep.java |  9 ++-
 .../traversal/step/map/AddEdgeStartStep.java    |  6 +-
 .../process/traversal/step/map/AddEdgeStep.java |  7 +-
 .../traversal/step/map/AddVertexStartStep.java  |  7 +-
 .../traversal/step/map/AddVertexStep.java       |  6 +-
 .../traversal/step/map/EdgeOtherVertexStep.java | 15 +++-
 .../traversal/step/map/EdgeVertexStep.java      | 15 +++-
 .../process/traversal/step/map/GraphStep.java   | 15 +++-
 .../traversal/step/map/PropertiesStep.java      | 15 +++-
 .../process/traversal/step/map/VertexStep.java  | 15 +++-
 .../step/sideEffect/AddPropertyStep.java        |  9 +--
 .../process/traversal/step/util/Parameters.java |  2 +
 .../strategy/decoration/ElementIdStrategy.java  |  2 +-
 .../strategy/decoration/PartitionStrategy.java  |  6 +-
 .../traversal/dsl/graph/GraphTraversalTest.java |  2 +-
 .../Process/Traversal/GraphTraversal.cs         |  4 +-
 gremlin-javascript/glv/generate.groovy          |  3 +-
 .../lib/process/graph-traversal.js              |  2 +-
 gremlin-python/glv/generate.groovy              |  1 +
 .../gremlin_python/process/graph_traversal.py   |  2 +-
 .../traversal/step/map/PageRankTest.java        | 41 +++++++++++
 .../traversal/step/map/PeerPressureTest.java    | 31 +++++++-
 34 files changed, 498 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 14b084c..15e12fd 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,10 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 
 This release also includes changes from <<release-3-3-3, 3.3.3>>.
 
+* Moved `Parameterizing` interface to the `org.apache.tinkerpop.gremlin.process.traversal.step` package with other marker interfaces of its type.
+* Replaced `Parameterizing.addPropertyMutations()` with `Configuring.configure()`.
+* Changed interface hierarchy for `Parameterizing` and `Mutating` interfaces as they are tightly related.
+* Introduced the `with()` step modulator which can supply configuration options to `Configuring` steps.
 * Added `supportsUpsert()` option to `VertexFeatures` and `EdgeFeatures`.
 * `min()` and `max()` now support all types implementing `Comparable`.
 * Change the `toString()` of `Path` to be standardized as other graph elements are.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/docker/hadoop/Dockerfile
----------------------------------------------------------------------
diff --git a/docker/hadoop/Dockerfile b/docker/hadoop/Dockerfile
deleted file mode 100644
index 86b2598..0000000
--- a/docker/hadoop/Dockerfile
+++ /dev/null
@@ -1,25 +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.
-
-FROM tinkerpop:base
-
-MAINTAINER Daniel Kuppitz <me...@gremlin.guru>
-
-ENV HADOOP_VERSION 2.7.2
-
-COPY install.sh /usr/local/sbin/install-hadoop.sh
-RUN /usr/local/sbin/install-hadoop.sh

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index b3e5ef5..0d7d67f 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -1705,11 +1705,15 @@ g = graph.traversal().withComputer()
 g.V().pageRank().by('pageRank').values('pageRank')
 g.V().hasLabel('person').
   pageRank().
-    by(outE('knows')).
-    by('friendRank').
+    with(PageRank.EDGES, __.outE('knows')).
+    with(PageRank.PROPERTY_NAME, 'friendRank').
   order().by('friendRank',desc).valueMap('name','friendRank')
 ----
 
+Note the use of the `with()` modulating step which provides configuration options to the algorithm. It takes
+configuration keys from the static `PageRank` inner class on `PageRankVertexProgramStep` and is automatically
+imported to the Gremlin Console.
+
 The <<explain-step,`explain()`>>-step can be used to understand how the traversal is compiled into multiple `GraphComputer` jobs.
 
 [gremlin-groovy,modern]
@@ -1717,8 +1721,8 @@ The <<explain-step,`explain()`>>-step can be used to understand how the traversa
 g = graph.traversal().withComputer()
 g.V().hasLabel('person').
   pageRank().
-    by(outE('knows')).
-    by('friendRank').
+    with(PageRank.EDGES, __.outE('knows')).
+    with(PageRank.PROPERTY_NAME, 'friendRank').
   order().by('friendRank',desc).valueMap('name','friendRank').explain()
 ----
 
@@ -1812,10 +1816,17 @@ IMPORTANT: The `peerPressure()`-step is a `VertexComputing`-step and as such, ca
 g = graph.traversal().withComputer()
 g.V().peerPressure().by('cluster').values('cluster')
 g.V().hasLabel('person').
-  peerPressure().by('cluster').
-  group().by('cluster').by('name')
+  peerPressure().
+    with(PeerPressure.PROPERTY_NAME, 'cluster').
+  group().
+    by('cluster').
+    by('name')
 ----
 
+Note the use of the `with()` modulating step which provides configuration options to the algorithm. It takes
+configuration keys from the static `PeerPressure` inner class on `PeerPressureVertexProgramStep` and is automatically
+imported to the Gremlin Console.
+
 *Additional References*
 
 link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#peerPressure--++[`peerPressure()`]
@@ -2970,6 +2981,13 @@ link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/grem
 link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#where-org.apache.tinkerpop.gremlin.process.traversal.Traversal-++[`where(Traversal)`],
 link:++http://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/P.html++[`P`]
 
+[[with-step]]
+=== With Step
+
+The `with()`-step is not an actual step, but is instead a "step modulator" which modifies the behavior of the step
+prior to it. The `with()`-step provides additional "configuration" information to steps that implement the `Configuring`
+interface. Steps that allow for this type of modulation will explicitly state so in their documentation.
+
 [[a-note-on-predicates]]
 == A Note on Predicates
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.4.x.asciidoc b/docs/src/upgrade/release-3.4.x.asciidoc
index 3c881c3..f99a6d5 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -29,6 +29,42 @@ Please see the link:https://github.com/apache/tinkerpop/blob/3.4.0/CHANGELOG.asc
 
 === Upgrading for Users
 
+==== with() Step
+
+This version of TinkerPop introduces the `with()` step to Gremlin. It isn't really a step but is instead a step
+modulator. This modulator allows the step it is modifying to accept configurations that can be used to alter the
+behavior of the step itself. A good example of its usage is shown with the revised syntax of the `pageRank()` step
+which now uses `with()` to replace the old `by()` options:
+
+[groovy]
+----
+g.V().hasLabel('person').
+  pageRank().
+    with(PageRank.EDGES, __.outE('knows')).
+    with(PageRank.PROPERTY_NAME, 'friendRank').
+  order().
+    by('friendRank',desc).
+  valueMap('name','friendRank')
+----
+
+A similar change was made for `peerPressure()` step:
+
+[groovy]
+----
+g.V().hasLabel('person').
+  peerPressure().
+    with(PeerPressure.PROPERTY_NAME, 'cluster').
+  group().
+    by('cluster').
+    by('name')
+----
+
+Note that the `by()` modulators still work, but should be considered deprecated and open for removal in a future
+release where breaking changes are allowed.
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1975[TINKERPOP-1975],
+link:http://tinkerpop.apache.org/docs/current/reference/#with-step[Reference Documentation]
+
 ==== Removal of Giraph Support
 
 Support for Giraph has been removed as of this version. There were a number of reasons for this decision which were
@@ -198,6 +234,19 @@ See: link:https://issues.apache.org/jira/browse/TINKERPOP-1522[TINKERPOP-1522]
 
 ==== Graph Database Providers
 
+===== Configuring Interface
+
+There were some changes to interfaces that were related to `Step`. A new `Configuring` interface was added that was
+helpful in the implementation of the `with()` step modulator. This new interface extends the `Parameterizing` interface
+(which moved to the `org.apache.tinkerpop.gremlin.process.traversal.step` package with the other step interfaces) and
+in turn is extended by the `Mutating` interface. Making this change meant that the `Mutating.addPropertyMutations()`
+method could be removed in favor of the new `Configuring.configure()` method.
+
+All of the changes above basically mean, that if the `Mutating` interface was being used in prior versions, the
+`addPropertyMutations()` method simply needs to be changed to `configure()`.
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1975[TINKERPOP-1975]
+
 ===== Removed hadoop-gremlin Test Artifact
 
 The `hadoop-gremlin` module no longer generates a test jar that can be used as a test dependency in other modules.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
index 8839dcd..6158285 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
@@ -48,6 +48,8 @@ import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankMa
 import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PageRankVertexProgramStep;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PeerPressureVertexProgramStep;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.GraphFilterStrategy;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
@@ -258,8 +260,10 @@ public final class CoreImports {
         CLASS_IMPORTS.add(ClusterPopulationMapReduce.class);
         CLASS_IMPORTS.add(MemoryTraversalSideEffects.class);
         CLASS_IMPORTS.add(PeerPressureVertexProgram.class);
+        CLASS_IMPORTS.add(PeerPressureVertexProgramStep.PeerPressure.class);
         CLASS_IMPORTS.add(PageRankMapReduce.class);
         CLASS_IMPORTS.add(PageRankVertexProgram.class);
+        CLASS_IMPORTS.add(PageRankVertexProgramStep.PageRank.class);
         CLASS_IMPORTS.add(GraphFilterStrategy.class);
         CLASS_IMPORTS.add(TraversalVertexProgram.class);
         CLASS_IMPORTS.add(VertexProgramStrategy.class);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
index 2f67aeb..1c5b364 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PageRankVertexProgramStep.java
@@ -23,12 +23,16 @@ import org.apache.tinkerpop.gremlin.process.computer.GraphFilter;
 import org.apache.tinkerpop.gremlin.process.computer.Memory;
 import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.lambda.HaltedTraversersCountTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.ByModulating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TimesModulating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.util.PureTraversal;
 import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -42,9 +46,12 @@ import java.util.Set;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public final class PageRankVertexProgramStep extends VertexProgramStep implements TraversalParent, ByModulating, TimesModulating {
+public final class PageRankVertexProgramStep extends VertexProgramStep
+        implements TraversalParent, ByModulating, TimesModulating, Configuring {
 
+    private Parameters parameters = new Parameters();
     private PureTraversal<Vertex, Edge> edgeTraversal;
     private String pageRankProperty = PageRankVertexProgram.PAGE_RANK;
     private int times = 20;
@@ -53,23 +60,59 @@ public final class PageRankVertexProgramStep extends VertexProgramStep implement
     public PageRankVertexProgramStep(final Traversal.Admin traversal, final double alpha) {
         super(traversal);
         this.alpha = alpha;
-        this.modulateBy(__.<Vertex>outE().asAdmin());
+        this.configure(PageRank.EDGES, __.<Vertex>outE().asAdmin());
     }
 
     @Override
+    public void configure(final Object... keyValues) {
+        if (keyValues[0].equals(PageRank.EDGES)) {
+            if (!(keyValues[1] instanceof Traversal))
+                throw new IllegalArgumentException("PageRank.EDGES requires a Traversal as its argument");
+            this.edgeTraversal = new PureTraversal<>(((Traversal<Vertex,Edge>) keyValues[1]).asAdmin());
+            this.integrateChild(this.edgeTraversal.get());
+        } else if (keyValues[0].equals(PageRank.PROPERTY_NAME)) {
+            if (!(keyValues[1] instanceof String))
+                throw new IllegalArgumentException("PageRank.PROPERTY_NAME requires a String as its argument");
+            this.pageRankProperty = (String) keyValues[1];
+        } else if (keyValues[0].equals(PageRank.TIMES)) {
+            if (!(keyValues[1] instanceof Integer))
+                throw new IllegalArgumentException("PageRank.TIMES requires an Integer as its argument");
+            this.times = (int) keyValues[1];
+        }else {
+            this.parameters.set(this, keyValues);
+        }
+    }
+
+    @Override
+    public Parameters getParameters() {
+        return parameters;
+    }
+
+    /**
+     * @deprecated As of release 3.4.0, replaced by {@link #configure(Object...)}
+     */
+    @Deprecated
+    @Override
     public void modulateBy(final Traversal.Admin<?, ?> edgeTraversal) {
-        this.edgeTraversal = new PureTraversal<>((Traversal.Admin<Vertex, Edge>) edgeTraversal);
-        this.integrateChild(this.edgeTraversal.get());
+        configure(PageRank.EDGES, edgeTraversal);
     }
 
+    /**
+     * @deprecated As of release 3.4.0, replaced by {@link #configure(Object...)}
+     */
+    @Deprecated
     @Override
     public void modulateBy(final String pageRankProperty) {
-        this.pageRankProperty = pageRankProperty;
+        configure(PageRank.PROPERTY_NAME, pageRankProperty);
     }
 
+    /**
+     * @deprecated As of release 3.4.0, replaced by {@link #configure(Object...)}
+     */
+    @Deprecated
     @Override
     public void modulateTimes(int times) {
-        this.times = times;
+        configure(PageRank.TIMES, times);
     }
 
     @Override
@@ -118,4 +161,24 @@ public final class PageRankVertexProgramStep extends VertexProgramStep implement
     public int hashCode() {
         return super.hashCode() ^ this.edgeTraversal.hashCode() ^ this.pageRankProperty.hashCode() ^ this.times;
     }
+
+    /**
+     * Configuration options to be passed to the {@link GraphTraversal#with(String, Object)} step.
+     */
+    public static class PageRank {
+        /**
+         * Configures number of iterations that the algorithm should run.
+         */
+        public static final String TIMES = Graph.Hidden.hide("tinkerpop.pageRank.times");
+
+        /**
+         * Configures the edge to traverse when calculating the pagerank.
+         */
+        public static final String EDGES = Graph.Hidden.hide("tinkerpop.pageRank.edges");
+
+        /**
+         * Configures the name of the property within which to store the pagerank value.
+         */
+        public static final String PROPERTY_NAME = Graph.Hidden.hide("tinkerpop.pageRank.propertyName");
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressureVertexProgramStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressureVertexProgramStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressureVertexProgramStep.java
index 47d4160..be65f42 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressureVertexProgramStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/PeerPressureVertexProgramStep.java
@@ -25,10 +25,13 @@ import org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.Pee
 import org.apache.tinkerpop.gremlin.process.computer.traversal.lambda.HaltedTraversersCountTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.ByModulating;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TimesModulating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.util.PureTraversal;
 import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -42,16 +45,44 @@ import java.util.Set;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public final class PeerPressureVertexProgramStep extends VertexProgramStep implements TraversalParent, ByModulating, TimesModulating {
+public final class PeerPressureVertexProgramStep extends VertexProgramStep
+        implements TraversalParent, ByModulating, TimesModulating, Configuring {
 
+    private Parameters parameters = new Parameters();
     private PureTraversal<Vertex, Edge> edgeTraversal;
     private String clusterProperty = PeerPressureVertexProgram.CLUSTER;
     private int times = 30;
 
     public PeerPressureVertexProgramStep(final Traversal.Admin traversal) {
         super(traversal);
-        this.modulateBy(__.<Vertex>outE().asAdmin());
+        this.configure(PeerPressure.EDGES, __.<Vertex>outE().asAdmin());
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        if (keyValues[0].equals(PeerPressureVertexProgramStep.PeerPressure.EDGES)) {
+            if (!(keyValues[1] instanceof Traversal))
+                throw new IllegalArgumentException("PeerPressure.EDGES requires a Traversal as its argument");
+            this.edgeTraversal = new PureTraversal<>(((Traversal<Vertex,Edge>) keyValues[1]).asAdmin());
+            this.integrateChild(this.edgeTraversal.get());
+        } else if (keyValues[0].equals(PeerPressureVertexProgramStep.PeerPressure.PROPERTY_NAME)) {
+            if (!(keyValues[1] instanceof String))
+                throw new IllegalArgumentException("PeerPressure.PROPERTY_NAME requires a String as its argument");
+            this.clusterProperty = (String) keyValues[1];
+        } else if (keyValues[0].equals(PeerPressureVertexProgramStep.PeerPressure.TIMES)) {
+            if (!(keyValues[1] instanceof Integer))
+                throw new IllegalArgumentException("PeerPressure.TIMES requires an Integer as its argument");
+            this.times = (int) keyValues[1];
+        }else {
+            this.parameters.set(this, keyValues);
+        }
+    }
+
+    @Override
+    public Parameters getParameters() {
+        return parameters;
     }
 
     @Override
@@ -59,20 +90,31 @@ public final class PeerPressureVertexProgramStep extends VertexProgramStep imple
         return super.hashCode() ^ this.edgeTraversal.hashCode() ^ this.clusterProperty.hashCode() ^ this.times;
     }
 
+    /**
+     * @deprecated As of release 3.4.0, replaced by {@link #configure(Object...)}
+     */
+    @Deprecated
     @Override
     public void modulateBy(final Traversal.Admin<?, ?> edgeTraversal) {
-        this.edgeTraversal = new PureTraversal<>((Traversal.Admin<Vertex, Edge>) edgeTraversal);
-        this.integrateChild(this.edgeTraversal.get());
+        configure(PeerPressure.EDGES, edgeTraversal);
     }
 
+    /**
+     * @deprecated As of release 3.4.0, replaced by {@link #configure(Object...)}
+     */
+    @Deprecated
     @Override
     public void modulateBy(final String clusterProperty) {
-        this.clusterProperty = clusterProperty;
+        configure(PeerPressure.PROPERTY_NAME, clusterProperty);
     }
 
+    /**
+     * @deprecated As of release 3.4.0, replaced by {@link #configure(Object...)}
+     */
+    @Deprecated
     @Override
     public void modulateTimes(int times) {
-        this.times = times;
+        configure(PeerPressure.TIMES, times);
     }
 
     @Override
@@ -115,4 +157,24 @@ public final class PeerPressureVertexProgramStep extends VertexProgramStep imple
         super.setTraversal(parentTraversal);
         this.integrateChild(this.edgeTraversal.get());
     }
+
+    /**
+     * Configuration options to be passed to the {@link GraphTraversal#with(String, Object)} step.
+     */
+    public static class PeerPressure {
+        /**
+         * Configures number of iterations that the algorithm should run.
+         */
+        public static final String TIMES = Graph.Hidden.hide("tinkerpop.peerPressure.times");
+
+        /**
+         * Configures the edge to traverse when determining clusters.
+         */
+        public static final String EDGES = Graph.Hidden.hide("tinkerpop.peerPressure.edges");
+
+        /**
+         * Configures the name of the property within which to store the cluster value.
+         */
+        public static final String PROPERTY_NAME = Graph.Hidden.hide("tinkerpop.peerPressure.propertyName");
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
deleted file mode 100644
index 9b7e088..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
+++ /dev/null
@@ -1,37 +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.traversal;
-
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
-
-/**
- * An interface for {@link Step} implementations that hold a {@link Parameters} object, which fold in arguments from
- * other steps. It is typically used on mutating steps, such as {@code addV()}, where calls to {@code property(k,v)}
- * are folded in as parameters to that add vertex step.
- *
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public interface Parameterizing {
-
-    /**
-     * Gets the parameters on the step.
-     */
-    public Parameters getParameters();
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
index 0fd3599..7d1e7e4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
@@ -36,6 +36,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.lambda.LoopTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.lambda.PredicateTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.lambda.TrueTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.step.ByModulating;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
 import org.apache.tinkerpop.gremlin.process.traversal.step.FromToModulating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TimesModulating;
@@ -2074,10 +2075,10 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
         final Step endStep = this.asAdmin().getEndStep();
         if ((endStep instanceof AddVertexStep || endStep instanceof AddEdgeStep || endStep instanceof AddVertexStartStep || endStep instanceof AddEdgeStartStep) &&
                 keyValues.length == 0 && null == cardinality) {
-            ((Mutating) endStep).addPropertyMutations(key, value);
+            ((Mutating) endStep).configure(key, value);
         } else {
             this.asAdmin().addStep(new AddPropertyStep(this.asAdmin(), cardinality, key, value));
-            ((AddPropertyStep) this.asAdmin().getEndStep()).addPropertyMutations(keyValues);
+            ((AddPropertyStep) this.asAdmin().getEndStep()).configure(keyValues);
         }
         return this;
     }
@@ -2496,6 +2497,24 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
         return this.asAdmin().addStep(new LambdaCollectingBarrierStep<>(this.asAdmin(), (Consumer) barrierConsumer, Integer.MAX_VALUE));
     }
 
+    //// WITH-MODULATOR
+
+    /**
+     * Provides a configuration to a step in the form of a key and value pair. The key of the configuration must be
+     * step specific and therefore a configuration could be supplied that is not known to be valid until execution.
+     *
+     * @param key the key of the configuration to apply to a step
+     * @param value the value of the configuration to apply to a step
+     * @return the traversal with a modulated step
+     * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#with-step" target="_blank">Reference Documentation - With Step</a>
+     * @since 3.4.0
+     */
+    public default GraphTraversal<S,E> with(final String key, final Object value) {
+        this.asAdmin().getBytecode().addStep(Symbols.with, key, value);
+        final Object[] configPair = { key, value };
+        ((Configuring) this.asAdmin().getEndStep()).configure(configPair);
+        return this;
+    }
 
     //// BY-MODULATORS
 
@@ -2801,6 +2820,7 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
         public static final String program = "program";
 
         public static final String by = "by";
+        public static final String with = "with";
         public static final String times = "times";
         public static final String as = "as";
         public static final String option = "option";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Configuring.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Configuring.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Configuring.java
new file mode 100644
index 0000000..4ac6280
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Configuring.java
@@ -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.traversal.step;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+
+/**
+ * Identifies a {@link Step} as one that can accept configurations via the {@link GraphTraversal#with(String, Object)}
+ * step modulator. The nature of the configuration allowed is specific to the implementation.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface Configuring extends Parameterizing {
+
+    /**
+     * Accept a configuration to the {@link Step}. Note that this interface extends {@link Parameterizing} and so
+     * there is an expectation that the {@link Step} implementation will have a {@link Parameters} instance that will
+     * house any values passed to this method. Storing these configurations in {@link Parameters} is not a requirement
+     * however, IF the configuration is an expected option for the step and can be stored on a member field that can
+     * be accessed on the step by more direct means (i.e. like a getter method).
+     */
+    public void configure(final Object... keyValues);
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Mutating.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Mutating.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Mutating.java
index 50e415a..14553d9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Mutating.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Mutating.java
@@ -28,13 +28,10 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  * @author Matt Frantz (http://github.com/mhfrantz)
  */
-public interface Mutating<E extends Event> {
+public interface Mutating<E extends Event> extends Configuring {
 
     /**
      * Gets the callback registry for events that the step raises.
      */
     public CallbackRegistry<E> getMutatingCallbackRegistry();
-
-    public void addPropertyMutations(final Object... keyValues);
-
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Parameterizing.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Parameterizing.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Parameterizing.java
new file mode 100644
index 0000000..9d8dc22
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Parameterizing.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+
+/**
+ * An interface for {@link Step} implementations that hold a {@link Parameters} object, which fold in arguments from
+ * other steps. It is typically used on mutating steps, such as {@code addV()}, where calls to {@code property(k,v)}
+ * are folded in as parameters to that add vertex step, but it may be used for any step that could benefit from
+ * modulation.
+ *
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface Parameterizing {
+
+    /**
+     * Gets the parameters on the step.
+     */
+    public Parameters getParameters();
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
index cd95e48..e7e14bb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.process.traversal.step.filter;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.CallbackRegistry;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.ListCallbackRegistry;
@@ -94,7 +95,13 @@ public final class DropStep<S> extends FilterStep<S> implements Mutating<Event>
     /**
      * This method doesn't do anything as {@code drop()} doesn't take property mutation arguments.
      */
-    public void addPropertyMutations(final Object... keyValues) {
+    @Override
+    public void configure(final Object... keyValues) {
         // do nothing
     }
+
+    @Override
+    public Parameters getParameters() {
+        return Parameters.EMPTY;
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStartStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStartStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStartStep.java
index 73f69a0..c6a2ef1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStartStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStartStep.java
@@ -19,7 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 
-import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -51,7 +51,7 @@ import java.util.Set;
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
 public final class AddEdgeStartStep extends AbstractStep<Edge, Edge>
-        implements Mutating<Event.EdgeAddedEvent>, TraversalParent, Parameterizing, Scoping, FromToModulating {
+        implements Mutating<Event.EdgeAddedEvent>, TraversalParent, Scoping, FromToModulating {
 
     private static final String FROM = Graph.Hidden.hide("from");
     private static final String TO = Graph.Hidden.hide("to");
@@ -86,7 +86,7 @@ public final class AddEdgeStartStep extends AbstractStep<Edge, Edge>
     }
 
     @Override
-    public void addPropertyMutations(final Object... keyValues) {
+    public void configure(final Object... keyValues) {
         this.parameters.set(this, keyValues);
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
index 81afd03..27197f4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
@@ -18,7 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 
-import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.FromToModulating;
@@ -37,7 +37,6 @@ import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.Attachable;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
 
 import java.util.List;
@@ -48,7 +47,7 @@ import java.util.Set;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class AddEdgeStep<S> extends MapStep<S, Edge>
-        implements Mutating<Event.EdgeAddedEvent>, TraversalParent, Parameterizing, Scoping, FromToModulating {
+        implements Mutating<Event.EdgeAddedEvent>, TraversalParent, Scoping, FromToModulating {
 
     private static final String FROM = Graph.Hidden.hide("from");
     private static final String TO = Graph.Hidden.hide("to");
@@ -82,7 +81,7 @@ public final class AddEdgeStep<S> extends MapStep<S, Edge>
     }
 
     @Override
-    public void addPropertyMutations(final Object... keyValues) {
+    public void configure(final Object... keyValues) {
         this.parameters.set(this, keyValues);
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
index 920fa45..f47e631 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
@@ -18,7 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 
-import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -37,7 +37,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementExce
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
 
 import java.util.List;
 import java.util.Set;
@@ -47,7 +46,7 @@ import java.util.Set;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class AddVertexStartStep extends AbstractStep<Vertex, Vertex>
-        implements Mutating<Event.VertexAddedEvent>, TraversalParent, Parameterizing, Scoping {
+        implements Mutating<Event.VertexAddedEvent>, TraversalParent, Scoping {
 
     private Parameters parameters = new Parameters();
     private boolean first = true;
@@ -79,7 +78,7 @@ public final class AddVertexStartStep extends AbstractStep<Vertex, Vertex>
     }
 
     @Override
-    public void addPropertyMutations(final Object... keyValues) {
+    public void configure(final Object... keyValues) {
         this.parameters.set(this, keyValues);
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
index 13e2fc8..0feecec 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 
-import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
@@ -33,7 +32,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequire
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
 
 import java.util.List;
 import java.util.Set;
@@ -43,7 +41,7 @@ import java.util.Set;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class AddVertexStep<S> extends MapStep<S, Vertex>
-        implements Mutating<Event.VertexAddedEvent>, TraversalParent, Parameterizing, Scoping {
+        implements Mutating<Event.VertexAddedEvent>, TraversalParent, Scoping {
 
     private Parameters parameters = new Parameters();
     private CallbackRegistry<Event.VertexAddedEvent> callbackRegistry;
@@ -74,7 +72,7 @@ public final class AddVertexStep<S> extends MapStep<S, Vertex>
     }
 
     @Override
-    public void addPropertyMutations(final Object... keyValues) {
+    public void configure(final Object... keyValues) {
         this.parameters.set(this, keyValues);
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/EdgeOtherVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/EdgeOtherVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/EdgeOtherVertexStep.java
index 3a5a73b..a53dd50 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/EdgeOtherVertexStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/EdgeOtherVertexStep.java
@@ -20,6 +20,8 @@ package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -32,7 +34,8 @@ import java.util.Set;
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public class EdgeOtherVertexStep extends MapStep<Edge, Vertex> {
+public class EdgeOtherVertexStep extends MapStep<Edge, Vertex> implements Configuring {
+    protected Parameters parameters = new Parameters();
 
     public EdgeOtherVertexStep(final Traversal.Admin traversal) {
         super(traversal);
@@ -52,6 +55,16 @@ public class EdgeOtherVertexStep extends MapStep<Edge, Vertex> {
     }
 
     @Override
+    public Parameters getParameters() {
+        return this.parameters;
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        this.parameters.set(null, keyValues);
+    }
+
+    @Override
     public Set<TraverserRequirement> getRequirements() {
         return Collections.singleton(TraverserRequirement.PATH);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/EdgeVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/EdgeVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/EdgeVertexStep.java
index 8bef835..c15c52a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/EdgeVertexStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/EdgeVertexStep.java
@@ -20,6 +20,8 @@ package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -33,8 +35,9 @@ import java.util.Set;
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public class EdgeVertexStep extends FlatMapStep<Edge, Vertex> implements AutoCloseable {
+public class EdgeVertexStep extends FlatMapStep<Edge, Vertex> implements AutoCloseable, Configuring {
 
+    protected Parameters parameters = new Parameters();
     protected Direction direction;
 
     public EdgeVertexStep(final Traversal.Admin traversal, final Direction direction) {
@@ -43,6 +46,16 @@ public class EdgeVertexStep extends FlatMapStep<Edge, Vertex> implements AutoClo
     }
 
     @Override
+    public Parameters getParameters() {
+        return this.parameters;
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        this.parameters.set(null, keyValues);
+    }
+
+    @Override
     protected Iterator<Vertex> flatMap(final Traverser.Admin<Edge> traverser) {
         return traverser.get().vertices(this.direction);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GraphStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GraphStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GraphStep.java
index e40271c..345eb42 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GraphStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GraphStep.java
@@ -24,9 +24,11 @@ import org.apache.tinkerpop.gremlin.process.traversal.Contains;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
 import org.apache.tinkerpop.gremlin.process.traversal.step.GraphComputing;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Element;
@@ -46,8 +48,9 @@ import java.util.function.Supplier;
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  * @author Pieter Martin
  */
-public class GraphStep<S, E extends Element> extends AbstractStep<S, E> implements GraphComputing, AutoCloseable {
+public class GraphStep<S, E extends Element> extends AbstractStep<S, E> implements GraphComputing, AutoCloseable, Configuring {
 
+    protected Parameters parameters = new Parameters();
     protected final Class<E> returnClass;
     protected Object[] ids;
     protected transient Supplier<Iterator<E>> iteratorSupplier;
@@ -71,6 +74,16 @@ public class GraphStep<S, E extends Element> extends AbstractStep<S, E> implemen
         return StringFactory.stepString(this, this.returnClass.getSimpleName().toLowerCase(), Arrays.toString(this.ids));
     }
 
+    @Override
+    public Parameters getParameters() {
+        return this.parameters;
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        this.parameters.set(null, keyValues);
+    }
+
     public Class<E> getReturnClass() {
         return this.returnClass;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesStep.java
index cbfc475..7cc193a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesStep.java
@@ -20,6 +20,8 @@ package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.structure.Element;
 import org.apache.tinkerpop.gremlin.structure.PropertyType;
@@ -33,8 +35,9 @@ import java.util.Set;
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public class PropertiesStep<E> extends FlatMapStep<Element, E> implements AutoCloseable {
+public class PropertiesStep<E> extends FlatMapStep<Element, E> implements AutoCloseable, Configuring {
 
+    protected Parameters parameters = new Parameters();
     protected final String[] propertyKeys;
     protected final PropertyType returnType;
 
@@ -45,6 +48,16 @@ public class PropertiesStep<E> extends FlatMapStep<Element, E> implements AutoCl
     }
 
     @Override
+    public Parameters getParameters() {
+        return this.parameters;
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        this.parameters.set(null, keyValues);
+    }
+
+    @Override
     protected Iterator<E> flatMap(final Traverser.Admin<Element> traverser) {
         return this.returnType.equals(PropertyType.VALUE) ?
                 traverser.get().values(this.propertyKeys) :

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/VertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/VertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/VertexStep.java
index 9ac6d0c..6825736 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/VertexStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/VertexStep.java
@@ -20,6 +20,8 @@ package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -35,8 +37,9 @@ import java.util.Set;
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public class VertexStep<E extends Element> extends FlatMapStep<Vertex, E> implements AutoCloseable {
+public class VertexStep<E extends Element> extends FlatMapStep<Vertex, E> implements AutoCloseable, Configuring {
 
+    protected Parameters parameters = new Parameters();
     private final String[] edgeLabels;
     private Direction direction;
     private final Class<E> returnClass;
@@ -49,6 +52,16 @@ public class VertexStep<E extends Element> extends FlatMapStep<Vertex, E> implem
     }
 
     @Override
+    public Parameters getParameters() {
+        return this.parameters;
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        this.parameters.set(null, keyValues);
+    }
+
+    @Override
     protected Iterator<E> flatMap(final Traverser.Admin<Vertex> traverser) {
         return Vertex.class.isAssignableFrom(this.returnClass) ?
                 (Iterator<E>) traverser.get().vertices(this.direction, this.edgeLabels) :

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
index 7509f86..04a8414 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
@@ -18,7 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect;
 
-import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
@@ -37,9 +37,6 @@ 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.StringFactory;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
 
 import java.util.List;
 import java.util.Set;
@@ -48,7 +45,7 @@ import java.util.Set;
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
 public final class AddPropertyStep<S extends Element> extends SideEffectStep<S>
-        implements Mutating<Event.ElementPropertyChangedEvent>, TraversalParent, Parameterizing, Scoping {
+        implements Mutating<Event.ElementPropertyChangedEvent>, TraversalParent, Scoping {
 
     private Parameters parameters = new Parameters();
     private final VertexProperty.Cardinality cardinality;
@@ -76,7 +73,7 @@ public final class AddPropertyStep<S extends Element> extends SideEffectStep<S>
     }
 
     @Override
-    public void addPropertyMutations(final Object... keyValues) {
+    public void configure(final Object... keyValues) {
         this.parameters.set(this, keyValues);
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index d368322..40d9330 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -48,6 +48,8 @@ import java.util.function.Supplier;
  */
 public final class Parameters implements Cloneable, Serializable {
 
+    public static final Parameters EMPTY = new Parameters();
+
     private static final Object[] EMPTY_ARRAY = new Object[0];
 
     private Map<Object, List<Object>> parameters = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
index c8f9d22..25a2833 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
@@ -21,7 +21,7 @@ package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.step.HasContainerHolder;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
index 438d8b2..877c2df 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
@@ -21,7 +21,7 @@ package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
@@ -203,7 +203,7 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
             // ends up being a Vertex or not.  AddPropertyStep currently chooses to simply not bother
             // to use the additional "property mutations" if the Element being mutated is a Edge or
             // VertexProperty
-            ((Mutating) step).addPropertyMutations(partitionKey, writePartition);
+            ((Mutating) step).configure(partitionKey, writePartition);
 
             if (includeMetaProperties) {
                 // GraphTraversal folds g.addV().property('k','v') to just AddVertexStep/AddVertexStartStep so this
@@ -216,7 +216,7 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
                         final VertexProperty.Cardinality cardinality = vertexFeatures.getCardinality((String) k);
                         v.forEach(o -> {
                             final AddPropertyStep addPropertyStep = new AddPropertyStep(traversal, cardinality, k, o);
-                            addPropertyStep.addPropertyMutations(partitionKey, writePartition);
+                            addPropertyStep.configure(partitionKey, writePartition);
                             addPropertyStepsToAppend.add(addPropertyStep);
 
                             // need to remove the parameter from the AddVertex/StartStep because it's now being added

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
index 6decbe0..9009d0b 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
@@ -42,7 +42,7 @@ import static org.junit.Assert.assertEquals;
 public class GraphTraversalTest {
     private static final Logger logger = LoggerFactory.getLogger(GraphTraversalTest.class);
 
-    private static Set<String> NO_GRAPH = new HashSet<>(Arrays.asList("asAdmin", "by", "option", "iterate", "to", "from", "profile", "pageRank", "peerPressure", "program", "none"));
+    private static Set<String> NO_GRAPH = new HashSet<>(Arrays.asList("asAdmin", "by", "with", "option", "iterate", "to", "from", "profile", "pageRank", "peerPressure", "program", "none"));
     private static Set<String> NO_ANONYMOUS = new HashSet<>(Arrays.asList("start", "__"));
     private static Set<String> IGNORES_BYTECODE = new HashSet<>(Arrays.asList("asAdmin", "iterate", "mapValues", "mapKeys"));
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index bb3d5d8..537cdbe 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -1679,9 +1679,9 @@ namespace Gremlin.Net.Process.Traversal
         /// <summary>
         ///     Adds the with step to this <see cref="GraphTraversal{SType, EType}" />.
         /// </summary>
-        public GraphTraversal<S, E> With (StepConfiguration modulation)
+        public GraphTraversal<S, E> With (string key, object value)
         {
-            Bytecode.AddStep("with", modulation);
+            Bytecode.AddStep("with", key, value);
             return Wrap<S, E>(this);
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-javascript/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/generate.groovy b/gremlin-javascript/glv/generate.groovy
index 8fd22e3..8778e89 100644
--- a/gremlin-javascript/glv/generate.groovy
+++ b/gremlin-javascript/glv/generate.groovy
@@ -28,7 +28,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
 import java.lang.reflect.Modifier
 
 def toJsMap = ["in": "in_",
-               "from": "from_"]
+               "from": "from_",
+               "with": "with_"]
 
 def toJs = { symbol -> toJsMap.getOrDefault(symbol, symbol) }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
index 901f9b0..f143542 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
@@ -1137,7 +1137,7 @@ class GraphTraversal extends Traversal {
    * @param {...Object} args
    * @returns {GraphTraversal}
    */
-  with(...args) {
+  with_(...args) {
     this.bytecode.addStep('with', args);
     return this;
   }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-python/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/glv/generate.groovy b/gremlin-python/glv/generate.groovy
index 58d0cd3..57cc9c9 100644
--- a/gremlin-python/glv/generate.groovy
+++ b/gremlin-python/glv/generate.groovy
@@ -30,6 +30,7 @@ def toPythonMap = ["global": "global_",
                    "as": "as_",
                    "in": "in_",
                    "and": "and_",
+                   "with": "with_",
                    "or": "or_",
                    "is": "is_",
                    "not": "not_",

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index a492f9c..bb81d87 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -505,7 +505,7 @@ class GraphTraversal(Traversal):
         self.bytecode.add_step("where", *args)
         return self
 
-    def with(self, *args):
+    def with_(self, *args):
         self.bytecode.add_step("with", *args)
         return self
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
index 07a2b04..325621e 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
 import org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PageRankVertexProgramStep.PageRank;
 import org.apache.tinkerpop.gremlin.process.traversal.Order;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
@@ -63,6 +64,8 @@ public abstract class PageRankTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasLabelXsoftwareX_hasXname_rippleX_pageRankX1X_byXinEXcreatedXX_timesX1X_byXpriorsX_inXcreatedX_unionXboth__identityX_valueMapXname_priorsX();
 
+    public abstract Traversal<Vertex, Map<Object, List<Vertex>>> get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXPROPERTY_NAME_pageRankXX_withXEDGES_inEXX_withXTIMES_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX();
+
     public abstract Traversal<Vertex, Map<Object, List<Vertex>>> get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_byXpageRankX_byXinEX_timesX1X_inXcreatedX_groupXmX_byXpageRankX_capXmX();
 
     @Test
@@ -238,6 +241,39 @@ public abstract class PageRankTest extends AbstractGremlinProcessTest {
         });
     }
 
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXPROPERTY_NAME_pageRankXX_withXEDGES_inEXX_withXTIMES_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX() {
+        // [{2.0=[v[4], v[4], v[4], v[4]], 1.0=[v[6], v[6], v[6], v[1], v[1], v[1]], software=[v[5], v[3], v[3], v[3]]}]
+        final Traversal<Vertex, Map<Object, List<Vertex>>> traversal = get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXPROPERTY_NAME_pageRankXX_withXEDGES_inEXX_withXTIMES_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX();
+        printTraversalForm(traversal);
+        final Map<Object, List<Vertex>> map = traversal.next();
+        assertFalse(traversal.hasNext());
+        assertEquals(3, map.size());
+        assertTrue(map.containsKey("software"));
+        map.forEach((k, v) -> {
+            boolean found = false;
+            if (!k.equals("software") && v.size() == 4) {
+                assertEquals(2.0d, ((Number) k).doubleValue(), 0.01d);
+                assertEquals(4, v.stream().filter(vertex -> vertex.id().equals(convertToVertexId(graph, "josh"))).count());
+                found = true;
+            } else if (v.size() == 6) {
+                assertEquals(1.0d, ((Number) k).doubleValue(), 0.01d);
+                assertEquals(3, v.stream().filter(vertex -> vertex.id().equals(convertToVertexId(graph, "peter"))).count());
+                assertEquals(3, v.stream().filter(vertex -> vertex.id().equals(convertToVertexId(graph, "marko"))).count());
+                found = true;
+            } else if (v.size() == 4) {
+                assertEquals("software", k);
+                assertEquals(3, v.stream().filter(vertex -> vertex.id().equals(convertToVertexId(graph, "lop"))).count());
+                assertEquals(1, v.stream().filter(vertex -> vertex.id().equals(convertToVertexId(graph, "ripple"))).count());
+                found = true;
+            }
+
+            if (!found)
+                fail("There are too many key/values: " + k + "--" + v);
+        });
+    }
+
     public static class Traversals extends PageRankTest {
 
         @Override
@@ -284,5 +320,10 @@ public abstract class PageRankTest extends AbstractGremlinProcessTest {
         public Traversal<Vertex, Map<Object, List<Vertex>>> get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_byXpageRankX_byXinEX_timesX1X_inXcreatedX_groupXmX_byXpageRankX_capXmX() {
             return g.V().out("created").group("m").by(T.label).pageRank(1.0).by("pageRank").by(__.inE()).times(1).in("created").group("m").by("pageRank").cap("m");
         }
+
+        @Override
+        public Traversal<Vertex, Map<Object, List<Vertex>>> get_g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_withXPROPERTY_NAME_pageRankXX_withXEDGES_inEXX_withXTIMES_1X_inXcreatedX_groupXmX_byXpageRankX_capXmX() {
+            return g.V().out("created").group("m").by(T.label).pageRank(1.0).with(PageRank.PROPERTY_NAME, "pageRank").with(PageRank.EDGES, __.inE()).with(PageRank.TIMES, 1).in("created").group("m").by("pageRank").cap("m");
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/160aef85/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java
index f9615d5..c76941b 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.TestHelper;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.PeerPressureVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PeerPressureVertexProgramStep.PeerPressure;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -50,6 +51,8 @@ public abstract class PeerPressureTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_byXoutEX_byXclusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX();
 
+    public abstract Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXEDGES_outEX_withXPROPERTY_NAME_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX();
+
     @Test
     @LoadGraphWith(MODERN)
     public void g_V_peerPressure() {
@@ -100,7 +103,28 @@ public abstract class PeerPressureTest extends AbstractGremlinProcessTest {
         assertTrue(ids.contains(convertToVertexId("peter")));
     }
 
-
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXEDGES_outEX_withXPROPERTY_NAME_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX() {
+        TestHelper.assumeNonDeterministic();
+        final Traversal<Vertex, Map<String, List<Object>>> traversal = get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXEDGES_outEX_withXPROPERTY_NAME_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX();
+        printTraversalForm(traversal);
+        final List<Map<String, List<Object>>> results = traversal.toList();
+        assertEquals(6, results.size());
+        final Map<String, Object> clusters = new HashMap<>();
+        results.forEach(m -> clusters.put((String) m.get("name").get(0), m.get("cluster").get(0)));
+        assertEquals(2, results.get(0).size());
+        assertEquals(6, clusters.size());
+        assertEquals(clusters.get("josh"), clusters.get("ripple"));
+        assertEquals(clusters.get("josh"), clusters.get("lop"));
+        final Set<Object> ids = new HashSet<>(clusters.values());
+        assertEquals(4, ids.size());
+        assertTrue(ids.contains(convertToVertexId("marko")));
+        assertTrue(ids.contains(convertToVertexId("vadas")));
+        assertTrue(ids.contains(convertToVertexId("josh")));
+        assertTrue(ids.contains(convertToVertexId("peter")));
+    }
+    
     public static class Traversals extends PeerPressureTest {
 
         @Override
@@ -117,5 +141,10 @@ public abstract class PeerPressureTest extends AbstractGremlinProcessTest {
         public Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_byXoutEX_byXclusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX() {
             return g.V().has("name", "ripple").in("created").peerPressure().by(__.outE()).by("cluster").repeat(__.union(__.identity(), __.both())).times(2).dedup().valueMap("name", "cluster");
         }
+
+        @Override
+        public Traversal<Vertex, Map<String, List<Object>>> get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_withXEDGES_outEX_withXPROPERTY_NAME_clusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX() {
+            return g.V().has("name", "ripple").in("created").peerPressure().with(PeerPressure.EDGES,__.outE()).with(PeerPressure.PROPERTY_NAME, "cluster").repeat(__.union(__.identity(), __.both())).times(2).dedup().valueMap("name", "cluster");
+        }
     }
 }
\ No newline at end of file


[11/50] tinkerpop git commit: TINKERPOP-1831 Refactored EventStrategy

Posted by sp...@apache.org.
TINKERPOP-1831 Refactored EventStrategy

Removed deprecated method. Used VertexProperty.empty() and Property.empty() to represent the "old" value for new property events. Created a enum for configuring detachment on the EventStrategy builder.


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

Branch: refs/heads/TINKERPOP-1878
Commit: 7963fdfb4407347a37ff35d40f5efdd1ba5f039f
Parents: ae2f304
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 7 09:10:47 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 7 09:10:47 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   3 +
 docs/src/upgrade/release-3.4.x.asciidoc         |  22 +++
 .../bulkloading/BulkLoaderVertexProgram.java    |   6 -
 .../step/sideEffect/AddPropertyStep.java        |   6 +-
 .../util/event/ConsoleMutationListener.java     |   5 -
 .../step/util/event/MutationListener.java       |  11 +-
 .../strategy/decoration/EventStrategy.java      | 108 +++++-----
 .../strategy/decoration/EventStrategyTest.java  |   1 -
 .../decoration/EventStrategyProcessTest.java    | 197 ++++---------------
 9 files changed, 130 insertions(+), 229 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7963fdfb/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e886107..7317aeb 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -37,6 +37,9 @@ This release also includes changes from <<release-3-3-3, 3.3.3>>.
 * Changed the order of `select()` scopes. The order is now: maps, side-effects, paths.
 * Removed previously deprecated Credentials DSL infrastructure.
 * Moved `TraversalEngine` to `gremlin-test` as it has long been only used in testing infrastructure.
+* Events from `EventStrategy`raised from "new" mutations will now return a true "empty" property from `VertexProperty.empty()` or `Property.empty()` as is appropriate.
+* `MutationListener#vertexPropertyChanged(Vertex, VertexProperty, Object, Object...)` no longer has a default implementation.
+* Removed previously deprecated `MutationListener#vertexPropertyChanged(Vertex, Property, Object, Object...)`.
 * Removed previously deprecated `OpSelectorHandler` constructor.
 * Removed previously deprecated `close()` from `GremlinGroovyScriptEngine` which no longer implements `AutoCloseable`.
 * Removed previously deprecated `getGraphInputFormat()` and `getGraphOutputFormat()` from `HadoopConfiguration`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7963fdfb/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.4.x.asciidoc b/docs/src/upgrade/release-3.4.x.asciidoc
index 851d458..68e0c51 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -113,6 +113,27 @@ gremlin> g.V().values('name').max()
 ==>vadas
 ----
 
+==== EventStrategy API
+
+There were some minor modifications to how `EventStrategy` is constructed and what can be expected from events raised
+from the addition of new properties.
+
+With respect to the change in terms of `EventStrategy` construction, the `detach()` builder method formerly took a
+`Class` as an argument and that `Class` was meant to be one of the various "detachment factories" or `null`. That
+approach was a bit confusing, so that signature has changed to `detach(EventStrategy.Detachment)` where the argument
+is a more handy enum of detachment options.
+
+As for the changes related to events themselves, it is first worth noting that the previously deprecated
+`vertexPropertyChanged(Vertex, Property, Object, Object...)` on `MutationListener` has been removed for what should
+have originally been the correct signature of `vertexPropertyChanged(Vertex, VertexProperty, Object, Object...)`. In
+prior versions when this method and its related `edgePropertyChanged()` and `vertexPropertyPropertyChanged()` were
+triggered by way of the addition of a new property a "fake" property was included with a `null` value for the
+"oldValue" argument to these methods (as it did not exist prior to this event). That was a bit awkward to reason about
+when dealing with that event. To make this easier, the event now raises with a `VertexProperty.empty()` or
+`Property.empty()` instance, which can be evaluated with `equals()` easily to determine if the property is new or not.
+
+link:https://issues.apache.org/jira/browse/TINKERPOP-1831[TINKERPOP-1831]
+
 ==== Deprecation Removal
 
 The following deprecated classes, methods or fields have been removed in this version:
@@ -122,6 +143,7 @@ The following deprecated classes, methods or fields have been removed in this ve
 ** `org.apache.tinkerpop.gremlin.process.traversal.engine.*`
 ** `org.apache.tinkerpop.gremlin.process.traversal.step.map.LambdaCollectingBarrierStep.Consumers`
 ** `org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer#makeHasContainers(String, P)`
+** `org.apache.tinkerpop.gremlin.process.traversal.step.util.event.MutationListener#vertexPropertyChanged(Vertex, Property, Object, Object...)`
 ** `org.apache.tinkerpop.gremlin.structure.Element.Exceptions#elementAlreadyRemoved(Class, Object)`
 ** `org.apache.tinkerpop.gremlin.structure.Graph.Exceptions#elementNotFound(Class, Object)`
 ** `org.apache.tinkerpop.gremlin.structure.Graph.Exceptions#elementNotFound(Class, Object, Exception)`

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7963fdfb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
index 508af3e..c637880 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkloading/BulkLoaderVertexProgram.java
@@ -460,12 +460,6 @@ public class BulkLoaderVertexProgram implements VertexProgram<Tuple> {
         }
 
         @Override
-        public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue,
-                                          final Object... vertexPropertyKeyValues) {
-            // do nothing - deprecated
-        }
-
-        @Override
         public void vertexPropertyRemoved(final VertexProperty vertexProperty) {
             this.counter++;
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7963fdfb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
index 04a8414..3589c0c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
@@ -97,17 +97,17 @@ public final class AddPropertyStep<S extends Element> extends SideEffectStep<S>
             if (element instanceof Vertex)
                 evt = new Event.VertexPropertyChangedEvent(eventStrategy.detach((Vertex) element),
                         newProperty ?
-                                eventStrategy.empty(element, key) :
+                                VertexProperty.empty() :
                                 eventStrategy.detach((VertexProperty) currentProperty), value, vertexPropertyKeyValues);
             else if (element instanceof Edge)
                 evt = new Event.EdgePropertyChangedEvent(eventStrategy.detach((Edge) element),
                         newProperty ?
-                                eventStrategy.empty(element, key) :
+                                Property.empty() :
                                 eventStrategy.detach(currentProperty), value);
             else if (element instanceof VertexProperty)
                 evt = new Event.VertexPropertyPropertyChangedEvent(eventStrategy.detach((VertexProperty) element),
                         newProperty ?
-                                eventStrategy.empty(element, key) :
+                                Property.empty() :
                                 eventStrategy.detach(currentProperty), value);
             else
                 throw new IllegalStateException(String.format("The incoming object cannot be processed by change eventing in %s:  %s", AddPropertyStep.class.getName(), element));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7963fdfb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/ConsoleMutationListener.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/ConsoleMutationListener.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/ConsoleMutationListener.java
index 937f414..1bfdf24 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/ConsoleMutationListener.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/ConsoleMutationListener.java
@@ -83,11 +83,6 @@ public class ConsoleMutationListener implements MutationListener {
     }
 
     @Override
-    public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
-        // do nothing - deprecated
-    }
-
-    @Override
     public void vertexPropertyChanged(final Vertex element, final VertexProperty oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
         System.out.println("Vertex [" + element.toString() + "] property [" + oldValue + "] change to [" + setValue + "] in graph [" + graph.toString() + "]");
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7963fdfb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/MutationListener.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/MutationListener.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/MutationListener.java
index 00e49ed..8525d5d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/MutationListener.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/event/MutationListener.java
@@ -52,19 +52,10 @@ public interface MutationListener {
     /**
      * Raised after the property of a {@link Vertex} changed.
      *
-     * @deprecated As of release 3.2.7, replaced by {@link #vertexPropertyChanged(Vertex, VertexProperty, Object, Object...)}.
-     */
-    public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues);
-
-    /**
-     * Raised after the property of a {@link Vertex} changed.
-     *
      * @param element  the {@link Vertex} that changed
      * @param setValue the new value of the property
      */
-    public default void vertexPropertyChanged(final Vertex element, final VertexProperty oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
-        vertexPropertyChanged(element, (Property) oldValue, setValue, vertexPropertyKeyValues);
-    }
+    public void vertexPropertyChanged(final Vertex element, final VertexProperty oldValue, final Object setValue, final Object... vertexPropertyKeyValues);
 
     /**
      * Raised after a {@link VertexProperty} was removed from the graph.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7963fdfb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategy.java
index b4824c8..094b43d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategy.java
@@ -57,53 +57,23 @@ import java.util.List;
  */
 public final class EventStrategy extends AbstractTraversalStrategy<TraversalStrategy.DecorationStrategy> implements TraversalStrategy.DecorationStrategy {
     private final EventQueue eventQueue;
-    private final Class<?> detachmentFactory;
+    private final Detachment detachment;
 
     private EventStrategy(final Builder builder) {
         this.eventQueue = builder.eventQueue;
         this.eventQueue.setListeners(builder.listeners);
-        this.detachmentFactory = builder.detachmentFactory;
+        this.detachment = builder.detachment;
     }
 
-    public Class<?> getDetachmentFactory() {
-        return this.detachmentFactory;
+    public Detachment getDetachment() {
+        return this.detachment;
     }
 
     /**
      * Applies the appropriate detach operation to elements that will be raised in mutation events.
      */
     public <R> R detach(final R attached) {
-        if (null == detachmentFactory)
-            return attached;
-        else if (detachmentFactory.equals(DetachedFactory.class))
-            return DetachedFactory.detach(attached, true);
-        else if (detachmentFactory.equals(ReferenceFactory.class))
-            return ReferenceFactory.detach(attached);
-        else
-            throw new IllegalStateException("Unknown detachment option using " + detachmentFactory.getSimpleName());
-    }
-
-    /**
-     * For newly created properties that do not yet exist, an empty {@link Property} is required that just contains
-     * a key as a reference.
-     */
-    public <R extends Property> R empty(final Element element, final String key) {
-        // currently the "no detachment" model simply returns a Detached value to maintain consistency with the
-        // original API that already existed (where returning "Detached" was the only option). This could probably
-        // change in the future to use an "empty" property or perhaps the "change" event API could change all together
-        // and have a different return.
-        if (null == detachmentFactory || detachmentFactory.equals(DetachedFactory.class)) {
-            if (element instanceof Vertex)
-                return (R) new DetachedVertexProperty(null, key, null, null);
-            else
-                return (R) new DetachedProperty(key, null);
-        } else if (detachmentFactory.equals(ReferenceFactory.class)) {
-            if (element instanceof Vertex)
-                return (R) new ReferenceVertexProperty(new DetachedVertexProperty(null, key, null, null));
-            else
-                return (R) new ReferenceProperty(new DetachedProperty(key, null));
-        } else
-            throw new IllegalStateException("Unknown empty detachment option using " + detachmentFactory.getSimpleName());
+        return (R) detachment.detach(attached);
     }
 
     @Override
@@ -132,7 +102,7 @@ public final class EventStrategy extends AbstractTraversalStrategy<TraversalStra
     public final static class Builder {
         private final List<MutationListener> listeners = new ArrayList<>();
         private EventQueue eventQueue = new DefaultEventQueue();
-        private Class<?> detachmentFactory = DetachedFactory.class;
+        private Detachment detachment = Detachment.DETACHED_WITH_PROPERTIES;
 
         Builder() {}
 
@@ -147,15 +117,11 @@ public final class EventStrategy extends AbstractTraversalStrategy<TraversalStra
         }
 
         /**
-         * Configures the method of detachment for element provided in mutation callback events. If configured with
-         * {@code null} for no detachment with a transactional graph, be aware that accessing the evented elements
-         * after {@code commit()} will likely open new transactions.
-         *
-         * @param factoryClass must be either {@code null} (for no detachment), {@link ReferenceFactory} for elements
-         *                     with no properties or {@link DetachedFactory} for elements with properties.
+         * Configures the method of detachment for element provided in mutation callback events. The default is
+         * {@link Detachment#DETACHED_WITH_PROPERTIES}.
          */
-        public Builder detach(final Class<?> factoryClass) {
-            detachmentFactory = factoryClass;
+        public Builder detach(final Detachment detachment) {
+            this.detachment = detachment;
             return this;
         }
 
@@ -165,6 +131,60 @@ public final class EventStrategy extends AbstractTraversalStrategy<TraversalStra
     }
 
     /**
+     * A common interface for detachment.
+     */
+    public interface Detacher {
+        public Object detach(final Object object);
+    }
+
+    /**
+     * Options for detaching elements from the graph during eventing.
+     */
+    public enum Detachment implements Detacher {
+        /**
+         * Does not detach the element from the graph. It should be noted that if this option is used with
+         * transactional graphs new transactions may be opened if these elements are accessed after a {@code commit()}
+         * is called.
+         */
+        NONE {
+            @Override
+            public Object detach(final Object object) {
+                return object;
+            }
+        },
+
+        /**
+         * Uses {@link DetachedFactory} to detach and includes properties of elements that have them.
+         */
+        DETACHED_WITH_PROPERTIES {
+            @Override
+            public Object detach(final Object object) {
+                return DetachedFactory.detach(object, true);
+            }
+        },
+
+        /**
+         * Uses {@link DetachedFactory} to detach and does not include properties of elements that have them.
+         */
+        DETACHED_NO_PROPERTIES {
+            @Override
+            public Object detach(final Object object) {
+                return DetachedFactory.detach(object, false);
+            }
+        },
+
+        /**
+         * Uses {@link ReferenceFactory} to detach which only includes id and label of elements.
+         */
+        REFERENCE {
+            @Override
+            public Object detach(final Object object) {
+                return ReferenceFactory.detach(object);
+            }
+        }
+    }
+
+    /**
      * Gathers messages from callbacks and fires them to listeners.  When the event is sent to the listener is
      * up to the implementation of this interface.
      */

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7963fdfb/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyTest.java
index 27d9b7e..911ef41 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyTest.java
@@ -23,7 +23,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTrav
 import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.ConsoleMutationListener;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.MutationListener;
-import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
 import org.junit.Test;
 import org.junit.runner.RunWith;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7963fdfb/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
index e7a392c..b527340 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
@@ -32,7 +32,6 @@ import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge;
-import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexProperty;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
@@ -634,8 +633,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertThat(element, instanceOf(DetachedVertexProperty.class));
                 assertEquals(label, element.label());
                 assertEquals(value, element.value());
-                assertEquals(null, oldValue.value());
-                assertEquals("new", oldValue.key());
+                assertEquals(Property.empty(), oldValue);
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
@@ -752,8 +750,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertEquals(label, element.label());
                 assertEquals(inId, element.inVertex().id());
                 assertEquals(outId, element.outVertex().id());
-                assertEquals(null, oldValue.value());
-                assertEquals("new", oldValue.key());
+                assertEquals(Property.empty(), oldValue);
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
@@ -928,44 +925,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertThat(element, instanceOf(DetachedVertex.class));
                 assertEquals(label, element.label());
                 assertEquals(id, element.id());
-                assertEquals("new", oldValue.key());
-                assertEquals(null, oldValue.value());
-                assertEquals("dah", setValue);
-                triggered.set(true);
-            }
-        };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener);
-
-        if (graph.features().graph().supportsTransactions())
-            builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
-
-        final EventStrategy eventStrategy = builder.create();
-        final GraphTraversalSource gts = create(eventStrategy);
-
-        gts.V(v).property(VertexProperty.Cardinality.single, "new", "dah").iterate();
-        tryCommit(graph);
-
-        assertEquals(2, IteratorUtils.count(g.V(v).properties()));
-        assertThat(triggered.get(), is(true));
-    }
-
-    @Test
-    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
-    public void shouldDetachVertexPropertyWhenNewDeprecated() {
-        final AtomicBoolean triggered = new AtomicBoolean(false);
-        final Vertex v = graph.addVertex();
-        final String label = v.label();
-        final Object id = v.id();
-        v.property("old","blah");
-
-        final MutationListener listener = new AbstractMutationListener() {
-            @Override
-            public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
-                assertThat(element, instanceOf(DetachedVertex.class));
-                assertEquals(label, element.label());
-                assertEquals(id, element.id());
-                assertEquals("new", oldValue.key());
-                assertEquals(null, oldValue.value());
+                assertEquals(VertexProperty.empty(), oldValue);
                 assertEquals("dah", setValue);
                 triggered.set(true);
             }
@@ -1069,7 +1029,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1109,7 +1069,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1142,13 +1102,12 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertThat(element, instanceOf(ReferenceVertexProperty.class));
                 assertEquals(label, element.label());
                 assertEquals(value, element.value());
-                assertEquals(null, oldValue.value());
-                assertEquals("new", oldValue.key());
+                assertEquals(Property.empty(), oldValue);
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1187,7 +1146,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1227,7 +1186,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1260,13 +1219,12 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertEquals(label, element.label());
                 assertEquals(inId, element.inVertex().id());
                 assertEquals(outId, element.outVertex().id());
-                assertEquals(null, oldValue.value());
-                assertEquals("new", oldValue.key());
+                assertEquals(Property.empty(), oldValue);
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1302,7 +1260,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1335,7 +1293,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1369,7 +1327,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1408,7 +1366,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1425,7 +1383,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
 
     @Test
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
-    public void shouldRefereceVertexPropertyWhenNew() {
+    public void shouldReferenceVertexPropertyWhenNew() {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final String label = v.label();
@@ -1438,49 +1396,12 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertThat(element, instanceOf(ReferenceVertex.class));
                 assertEquals(label, element.label());
                 assertEquals(id, element.id());
-                assertEquals("new", oldValue.key());
-                assertEquals(null, oldValue.value());
-                assertEquals("dah", setValue);
-                triggered.set(true);
-            }
-        };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
-
-        if (graph.features().graph().supportsTransactions())
-            builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
-
-        final EventStrategy eventStrategy = builder.create();
-        final GraphTraversalSource gts = create(eventStrategy);
-
-        gts.V(v).property(VertexProperty.Cardinality.single, "new", "dah").iterate();
-        tryCommit(graph);
-
-        assertEquals(2, IteratorUtils.count(g.V(v).properties()));
-        assertThat(triggered.get(), is(true));
-    }
-
-    @Test
-    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
-    public void shouldReferenceVertexPropertyWhenNewDeprecated() {
-        final AtomicBoolean triggered = new AtomicBoolean(false);
-        final Vertex v = graph.addVertex();
-        final String label = v.label();
-        final Object id = v.id();
-        v.property("old","blah");
-
-        final MutationListener listener = new AbstractMutationListener() {
-            @Override
-            public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
-                assertThat(element, instanceOf(ReferenceVertex.class));
-                assertEquals(label, element.label());
-                assertEquals(id, element.id());
-                assertEquals("new", oldValue.key());
-                assertEquals(null, oldValue.value());
+                assertEquals(VertexProperty.empty(), oldValue);
                 assertEquals("dah", setValue);
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1512,7 +1433,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1541,7 +1462,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1578,7 +1499,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1618,7 +1539,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1651,13 +1572,12 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertEquals(vp, element);
                 assertEquals(label, element.label());
                 assertEquals(value, element.value());
-                assertEquals(null, oldValue.value());
-                assertEquals("new", oldValue.key());
+                assertEquals(Property.empty(), oldValue);
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1696,7 +1616,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1736,7 +1656,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1769,13 +1689,12 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertEquals(label, element.label());
                 assertEquals(inId, element.inVertex().id());
                 assertEquals(outId, element.outVertex().id());
-                assertEquals(null, oldValue.value());
-                assertEquals("new", oldValue.key());
+                assertEquals(Property.empty(), oldValue);
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1811,7 +1730,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1845,7 +1764,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1880,7 +1799,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1917,7 +1836,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -1947,49 +1866,12 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 assertEquals(v, element);
                 assertEquals(label, element.label());
                 assertEquals(id, element.id());
-                assertEquals("new", oldValue.key());
-                assertEquals(null, oldValue.value());
+                assertEquals(VertexProperty.empty(), oldValue);
                 assertEquals("dah", setValue);
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
-
-        if (graph.features().graph().supportsTransactions())
-            builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
-
-        final EventStrategy eventStrategy = builder.create();
-        final GraphTraversalSource gts = create(eventStrategy);
-
-        gts.V(v).property(VertexProperty.Cardinality.single, "new", "dah").iterate();
-        tryCommit(graph);
-
-        assertEquals(2, IteratorUtils.count(g.V(v).properties()));
-        assertThat(triggered.get(), is(true));
-    }
-
-    @Test
-    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
-    public void shouldUseActualVertexPropertyWhenNewDeprecated() {
-        final AtomicBoolean triggered = new AtomicBoolean(false);
-        final Vertex v = graph.addVertex();
-        final String label = v.label();
-        final Object id = v.id();
-        v.property("old","blah");
-
-        final MutationListener listener = new AbstractMutationListener() {
-            @Override
-            public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
-                assertEquals(v, element);
-                assertEquals(label, element.label());
-                assertEquals(id, element.id());
-                assertEquals("new", oldValue.key());
-                assertEquals(null, oldValue.value());
-                assertEquals("dah", setValue);
-                triggered.set(true);
-            }
-        };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -2021,7 +1903,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -2051,7 +1933,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
                 triggered.set(true);
             }
         };
-        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(ReferenceFactory.class);
+        final EventStrategy.Builder builder = EventStrategy.build().addListener(listener).detach(EventStrategy.Detachment.REFERENCE);
 
         if (graph.features().graph().supportsTransactions())
             builder.eventQueue(new EventStrategy.TransactionalEventQueue(graph));
@@ -2083,7 +1965,7 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         }
 
         @Override
-        public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
+        public void vertexPropertyChanged(final Vertex element, final VertexProperty oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
 
         }
 
@@ -2211,11 +2093,6 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         }
 
         @Override
-        public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
-            // do nothing - deprecated
-        }
-
-        @Override
         public void vertexPropertyChanged(final Vertex element, final VertexProperty oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
             vertexPropertyChangedEvent.incrementAndGet();
             order.add("v-property-changed-" + element.id());


[50/50] tinkerpop git commit: Update transpilers.asciidoc

Posted by sp...@apache.org.
Update transpilers.asciidoc

Changes:
- fixed non-working queries (queries which returned no results)
- updated documentation with more examples in the limitations section
- updated execution tags for queries which are for reference only
- commented out the pattern filter examples for now

To Do:
- fix OPTIONAL queries 
- fix Pattern filter queries
- inspect and patch special cases in code

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

Branch: refs/heads/TINKERPOP-1878
Commit: 916130c613742caefa7625bf6fde0942608a06d9
Parents: 682deb2
Author: Harsh Thakkar <ha...@gmail.com>
Authored: Fri Jun 15 11:24:57 2018 +0200
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 docs/src/reference/transpilers.asciidoc | 94 +++++++++++++++++++++-------
 1 file changed, 72 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/916130c6/docs/src/reference/transpilers.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/transpilers.asciidoc b/docs/src/reference/transpilers.asciidoc
index 3211857..1bb7728 100644
--- a/docs/src/reference/transpilers.asciidoc
+++ b/docs/src/reference/transpilers.asciidoc
@@ -131,7 +131,7 @@ The current implementation of SPARQL-Gremlin transpiler (i.e. SPARQL-Gremlin) do
 * SPARQL queries with variables in the predicate position are not currently covered, with an exception of the following
 case:
 
-[source,groovy]
+[source,text]
 ----
 g.sparql("""SELECT * WHERE { ?x ?y ?z . }""")
 ----
@@ -141,24 +141,72 @@ SPARQL query has the same number of patterns on both the side of the union opera
 SPARQL query cannot be mapped using Gremlinator, since a union is executed between different number of graph patterns
 (two patterns `union` 1 pattern).
 
-[source,groovy]
+[source,text]
 ----
-g.sparql("""SELECT * 
-	WHERE {
-	{?person e:created ?software . 
-	?person v:name "daniel" .}
+g.sparql("""SELECT * WHERE {
+	{?person e:created ?software .
+	?person v:name "josh" .}
 	UNION
 	{?software v:lang "java" .} }""")
 ----
 
-* order by
-....
-Adding more here...
-....
+* A non-Group key variable cannot be projected in a SPARQL query. This is a SPARQL langauge limitation rather than that of Gremlin/TinkerPop. Apache Jena throws the exception " Non-group key variable in SELECT" if this occurs.
+For instance, in a SPARQL query with GROUP-BY clause, only the variable on which the grouping is declared, can be projected. The following query is valid:
+
+[source,groovy]
+----
+g.sparql("""SELECT ?age WHERE {
+    ?person v:label "person" .
+    ?person v:age ?age .
+    ?person v:name ?name .} GROUP BY (?age)""")
+----
+
+Whereas, the following SPARQL query will be invalid:
+
+[source,text]
+----
+g.sparql("""SELECT ?person WHERE {
+      ?person v:label "person" .
+      ?person v:age ?age .
+      ?person v:name ?name .} GROUP BY (?age)""")
+----
+
+
+* In a SPARQL query with an ORDER-BY clause, the ordering occurs wrt to the first projected variable in the query. You may choose any number of variable to be projected, however, the first variable in the selection will be the ordering decider.
+For instance, in the query:
+
+
+[source,groovy]
+----
+g.sparql("""SELECT ?name ?age WHERE {
+    ?person v:label "person" .
+    ?person v:age ?age .
+    ?person v:name ?name . } ORDER BY (?age)""")
+----
 
-* group by
+the result set will be ordered according to the `?name` variable (in ascending order by default) despite having passed `?age` in the order by. Whereas, for the following query:
+
+[source,groovy]
+----
+g.sparql("""SELECT ?age ?name WHERE {
+    ?person v:label "person" .
+    ?person v:age ?age .
+    ?person v:name ?name . } ORDER BY (?age)""")
+----
+
+the result set will be ordered according to the `?age` (as it is the first projected variable). Finally, for the select all case (`SELECT *`):
+
+[source,groovy]
+----
+g.sparql("""SELECT *
+WHERE { ?person v:label "person" . ?person v:age ?age . ?person v:name ?name . } ORDER BY (?age)""")
+----
+
+The the variable encountered first will be the ordering decider, i.e. since we have `?person` being encountered first, the result set will be ordered according to the `?person` variable (which are vertex id).
+
+* OPTIONAL
 ....
-Adding more here...
+currently fixing this...
 ....
 
 [[examples]]
@@ -264,6 +312,7 @@ WHERE {
     FILTER (?age > 30 && ?lang = "java") }""")
 ----
 
+////
 [[pattern-filters]]
 ==== Pattern Filter(s)
 
@@ -288,6 +337,7 @@ WHERE {
   ?person v:name ?name .
     FILTER NOT EXISTS { ?person e:created ?project } }""")
 ----
+////
 
 [[union]]
 ==== Union
@@ -325,11 +375,12 @@ Select all vertices with the label `person` and order them by their age.
 
 [gremlin-groovy,existing]
 ----
-g.sparql("""SELECT * 
+g.sparql("""SELECT ?age ?name
 WHERE {
   ?person v:label "person" .
   ?person v:age ?age .
-} ORDER BY (?age)""")
+  ?person v:name ?name .
+} ORDER BY (?age))
 ----
 
 [[group-by]]
@@ -337,9 +388,9 @@ WHERE {
 
 Select all vertices with the label `person` and group them by their age.
 
-[source,groovy]
+[gremlin-groovy,existing]
 ----
-g.sparql("""SELECT * 
+g.sparql("""SELECT ?age 
 WHERE {
   ?person v:label "person" .
   ?person v:age ?age .
@@ -354,7 +405,7 @@ the top two.
 
 [source,groovy]
 ----
-g.sparql("""SELECT COUNT(?project) 
+g.sparql("""SELECT (COUNT(?project) as ?p)
 WHERE {
   ?person v:label "person" .
   ?person v:age ?age . FILTER (?age < 30)
@@ -388,12 +439,11 @@ can be perceived as path queries or neighborhood queries. For instance, getting
 
 [gremlin-groovy,existing]
 ----
-g.sparql("""SELECT ?age ?software ?name ?location ?startTime 
+g.sparql("""SELECT ?age ?software ?lang ?name
 WHERE {
-  ?person v:name "daniel" .
+  ?person v:name "josh" .
   ?person v:age ?age .
   ?person e:created ?software .
-  ?person p:location ?location .
-  ?location v:value ?name .
-  ?location v:startTime ?startTime }""")
+  ?software v:lang ?lang .
+  ?software v:name ?name . }""")
 ----


[15/50] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by sp...@apache.org.
Merge branch 'tp32' into tp33


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

Branch: refs/heads/TINKERPOP-1878
Commit: d4c76a698c133c2f491ec6a358492cc4b5c140a3
Parents: 55fcbdc eba1df3
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Sat Jun 9 13:34:32 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Sat Jun 9 13:34:32 2018 +0200

----------------------------------------------------------------------
 .travis.yml | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[30/50] tinkerpop git commit: TINKERPOP-1878 Minor javadoc and code cleanup

Posted by sp...@apache.org.
TINKERPOP-1878 Minor javadoc and code cleanup


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

Branch: refs/heads/TINKERPOP-1878
Commit: 651a89673d24b6179021f11495ce22fc2f75d76d
Parents: f3053ae
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jan 25 15:36:53 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 .../process/traversal/dsl/sparql/SparqlTraversal.java   | 12 +++---------
 .../traversal/dsl/sparql/SparqlTraversalSource.java     |  8 +++++++-
 .../process/traversal/strategy/SparqlStrategy.java      | 11 ++++++++---
 3 files changed, 18 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/651a8967/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversal.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversal.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversal.java
index efa9489..843267d 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversal.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversal.java
@@ -22,6 +22,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 
 /**
+ * The {@code SparqlTraversal} has no additional traversal steps. The only step available for "SPARQL" is the
+ * {@link SparqlTraversalSource#sparql(String)} start step.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface SparqlTraversal<S, E> extends Traversal<S, E> {
@@ -56,13 +59,4 @@ public interface SparqlTraversal<S, E> extends Traversal<S, E> {
         Traversal.super.iterate();
         return this;
     }
-
-    public static final class Symbols {
-
-        private Symbols() {
-            // static fields only
-        }
-
-        public static final String sparql = "sparql";
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/651a8967/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
index 3596716..b156ed1 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
@@ -25,12 +25,15 @@ import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 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.step.map.ConstantStep;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Transaction;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 /**
+ * A {@link TraversalSource} implementation that spawns {@link SparqlTraversal} instances.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class SparqlTraversalSource implements TraversalSource {
@@ -115,9 +118,12 @@ public class SparqlTraversalSource implements TraversalSource {
         return (SparqlTraversalSource) clone;
     }
 
+    /**
+     * The start step for a SPARQL based traversal that accepts a string representation of the query to execute.
+     */
     public <S> SparqlTraversal<S,String> sparql(final String query) {
         final SparqlTraversalSource clone = this.clone();
-        clone.bytecode.addStep(SparqlTraversal.Symbols.sparql, query);
+        clone.bytecode.addStep(GraphTraversal.Symbols.constant, query);
         final SparqlTraversal.Admin<S, S> traversal = new DefaultSparqlTraversal<>(clone);
         return traversal.addStep(new ConstantStep<S,String>(traversal, query));
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/651a8967/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
index 07ac4cf..bb0b326 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
@@ -22,17 +22,22 @@ import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decorati
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ConstantStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.TraversalMapStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 import org.apache.tinkerpop.gremlin.sparql.SparqlToGremlinCompiler;
+import org.apache.tinkerpop.gremlin.sparql.process.traversal.dsl.sparql.SparqlTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 
 import java.util.Collections;
 import java.util.Set;
 
 /**
+ * This {@link TraversalStrategy} is used in conjunction with the {@link SparqlTraversalSource} which has a single
+ * {@code sparql()} start step. That step adds a {@link ConstantStep} to the traversal with the SPARQL query within
+ * it as a string value. This strategy finds that step and transpiles it to a Gremlin traversal which then replaces
+ * the {@link ConstantStep}.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class SparqlStrategy extends AbstractTraversalStrategy<TraversalStrategy.DecorationStrategy>
@@ -69,11 +74,11 @@ public class SparqlStrategy extends AbstractTraversalStrategy<TraversalStrategy.
                 sparqlTraversal.asAdmin().getSteps().forEach(s -> traversal.addStep(s));
             } else {
                 // The ConstantStep expects a string value
-                throw new IllegalStateException("SparqlStrategy cannot be applied to this traversal");
+                throw new IllegalStateException("SparqlStrategy cannot be applied to a traversal that does not consist of a single ConstantStep<?,String>");
             }
         } else {
             // SparqlStrategy requires that there be one step and it be a ConstantStep that contains some SPARQL
-            throw new IllegalStateException("SparqlStrategy cannot be applied to this traversal");
+            throw new IllegalStateException("SparqlStrategy cannot be applied to a traversal that does not consist of a single ConstantStep<?,String>");
         }
     }
 }


[38/50] tinkerpop git commit: TINKERPOP-1878 Bump sparql-gremlin to 3.4.0-SNAPSHOT

Posted by sp...@apache.org.
TINKERPOP-1878 Bump sparql-gremlin to 3.4.0-SNAPSHOT


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

Branch: refs/heads/TINKERPOP-1878
Commit: 682deb2225c4a13337d64652cb1acde9a0d67e30
Parents: 45c1c20
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sun May 13 11:07:10 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 sparql-gremlin/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/682deb22/sparql-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/sparql-gremlin/pom.xml b/sparql-gremlin/pom.xml
index 731b822..8608cc6 100644
--- a/sparql-gremlin/pom.xml
+++ b/sparql-gremlin/pom.xml
@@ -6,7 +6,7 @@
     <parent>
         <artifactId>tinkerpop</artifactId>
         <groupId>org.apache.tinkerpop</groupId>
-        <version>3.3.2-SNAPSHOT</version>
+        <version>3.4.0-SNAPSHOT</version>
     </parent>
     <artifactId>sparql-gremlin</artifactId>
     <name>Apache TinkerPop :: SPARQL Gremlin</name>


[42/50] tinkerpop git commit: TINKERPOP-1878 Testing for DISTINCT

Posted by sp...@apache.org.
TINKERPOP-1878 Testing for DISTINCT

Refactoring around the distinct and ordering - much less code there now.


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

Branch: refs/heads/TINKERPOP-1878
Commit: af7a8ca46be25573bd868918556b6691a6c024ea
Parents: a63309f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 26 16:56:14 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 .../sparql/SparqlToGremlinTranspiler.java       | 44 ++++++++------------
 .../dsl/sparql/SparqlTraversalSourceTest.java   | 23 ++++++++++
 2 files changed, 41 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af7a8ca4/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
index 1b28a1d..67ac1e1 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
@@ -107,39 +107,28 @@ public class SparqlToGremlinTranspiler {
 
         final List<String> vars = query.getResultVars();
         if (!query.isQueryResultStar() && !query.hasGroupBy()) {
-            // the result sizes have special handling to get the right signatures of select() called. perhaps this
-            // could be refactored to work more nicely
-            switch (vars.size()) {
+            final String[] all = new String[vars.size()];
+            vars.toArray(all);
+            if (query.isDistinct()) {
+                traversal = traversal.dedup(all);
+            }
+
+            // apply ordering from ORDER BY
+            orderingIndex.forEach((k, v) -> traversal = traversal.order().by(__.select(k), v));
+
+            // the result sizes have special handling to get the right signatures of select() called.
+            switch (all.length) {
                 case 0:
                     throw new IllegalStateException();
                 case 1:
-                    if (query.isDistinct())
-                        traversal = traversal.dedup(vars.get(0));
-
-                    orderingIndex.forEach((k, v) -> traversal = traversal.order().by(__.select(k), v));
-                    traversal = traversal.select(vars.get(0));
-
+                    traversal = traversal.select(all[0]);
                     break;
                 case 2:
-                    if (query.isDistinct())
-                        traversal = traversal.dedup(vars.get(0), vars.get(1));
-
-                    orderingIndex.forEach((k, v) -> traversal = traversal.order().by(__.select(k), v));
-                    traversal = traversal.select(vars.get(0), vars.get(1));
-
+                    traversal = traversal.select(all[0], all[1]);
                     break;
                 default:
-                    final String[] all = new String[vars.size()];
-                    vars.toArray(all);
-                    if (query.isDistinct())
-                        traversal = traversal.dedup(all);
-
-                    orderingIndex.forEach((k, v) -> traversal = traversal.order().by(__.select(k), v));
-
-                    // just some shenanigans to get the right signature of select() called
                     final String[] others = Arrays.copyOfRange(all, 2, vars.size());
-                    traversal = traversal.select(vars.get(0), vars.get(1), others);
-
+                    traversal = traversal.select(all[0], all[1], others);
                     break;
             }
         }
@@ -207,7 +196,10 @@ public class SparqlToGremlinTranspiler {
 
             for (SortCondition sortCondition : sortingConditions) {
                 final Expr expr = sortCondition.getExpression();
-                orderingIndex.put(expr.getVarName(), sortCondition.getDirection() == 1 ? Order.incr : Order.decr);
+
+                // by default, the sort will be ascending. getDirection() returns -2 if the DESC/ASC isn't
+                // supplied - weird
+                orderingIndex.put(expr.getVarName(), sortCondition.getDirection() == -1 ? Order.decr : Order.incr);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af7a8ca4/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
index 4092e58..56d62c9 100644
--- a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
+++ b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
@@ -111,4 +111,27 @@ public class SparqlTraversalSourceTest {
         assertEquals(x.get("b"), _g.V(4).next());
         assertEquals(x.get("c"), _g.V(3).next());
     }
+
+    @Test
+    public void shouldDistinct() {
+        final List<?> x = g.sparql(
+                "SELECT DISTINCT ?name\n" +
+                "WHERE {\n" +
+                "    ?a e:created ?b .\n" +
+                "    ?a v:name ?name .\n" +
+                "}").toList();
+        assertThat(x, containsInAnyOrder("marko", "josh", "peter"));
+    }
+
+    @Test
+    public void shouldDistinctAndOrder() {
+        final List<?> x = g.sparql(
+                "SELECT DISTINCT ?name\n" +
+                        "WHERE {\n" +
+                        "    ?a e:created ?b .\n" +
+                        "    ?a v:name ?name .\n" +
+                        "}" +
+                        "ORDER BY ?name").toList();
+        assertThat(x, contains("josh", "marko", "peter"));
+    }
 }


[19/50] tinkerpop git commit: Removed a non-link in docs CTR

Posted by sp...@apache.org.
Removed a non-link in docs CTR


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

Branch: refs/heads/TINKERPOP-1878
Commit: 89c23bd9c1d925e0b4e2e6d20d77301b723a506d
Parents: ad19a11
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jun 13 05:48:28 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jun 13 05:48:28 2018 -0400

----------------------------------------------------------------------
 docs/src/upgrade/release-3.4.x.asciidoc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/89c23bd9/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.4.x.asciidoc b/docs/src/upgrade/release-3.4.x.asciidoc
index 5035831..d44f69d 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -63,7 +63,7 @@ Note that the `by()` modulators still work, but should be considered deprecated
 release where breaking changes are allowed.
 
 See: link:https://issues.apache.org/jira/browse/TINKERPOP-1975[TINKERPOP-1975],
-link:http://tinkerpop.apache.org/docs/current/reference/#with-step[Reference Documentation]
+link:http://tinkerpop.apache.org/docs/3.4.0/reference/#with-step[Reference Documentation]
 
 ==== Removal of Giraph Support
 
@@ -258,8 +258,7 @@ This method can be implemented to return a cacheable set of features for a `Grap
 Assuming this method is faster than the cost of creating a new `Graph` instance, the test suite should execute
 significantly faster depending on how many tests end up being ignored.
 
-See: link:https://issues.apache.org/jira/browse/TINKERPOP-1518[TINKERPOP-1518],
-link:
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1518[TINKERPOP-1518]
 
 ===== Configuring Interface
 


[45/50] tinkerpop git commit: TINKERPOP-1878 Fixed up formatting of sparql-gremlin image

Posted by sp...@apache.org.
TINKERPOP-1878 Fixed up formatting of sparql-gremlin image


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

Branch: refs/heads/TINKERPOP-1878
Commit: 45c1c20e9a909cd2da22a28f40f92a6dd5913a04
Parents: f74bc69
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sun May 13 11:02:26 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 docs/src/reference/transpilers.asciidoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/45c1c20e/docs/src/reference/transpilers.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/transpilers.asciidoc b/docs/src/reference/transpilers.asciidoc
index 390d4f4..3211857 100644
--- a/docs/src/reference/transpilers.asciidoc
+++ b/docs/src/reference/transpilers.asciidoc
@@ -24,7 +24,7 @@ Gremlin Transpiler enables a particular query language to work on any TinkerPop-
 
 == SPARQL-Gremlin
 
-image::gremlin-standing.png[]
+image::gremlintron.png[width=225]
 
 The SPARQL-Gremlin transpiler, transforms link:https://en.wikipedia.org/wiki/SPARQL[SPARQL] queries into Gremlin
 traversals. It uses the https://jena.apache.org/index.html[Apache Jena] SPARQL processor


[46/50] tinkerpop git commit: TINKERPOP-1878 Test for FILTER

Posted by sp...@apache.org.
TINKERPOP-1878 Test for FILTER

Also fixed how the SparqlStrategy was being added to the TraversalStrategies in SparqlTraversalSource...it was adding it globally and all spawned TraversalSource instances were getting that strategy.


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

Branch: refs/heads/TINKERPOP-1878
Commit: a63309fd85ac4f012c9246739a974b4bab502f58
Parents: 5ec45f1
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 26 16:29:55 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:31 2018 -0400

----------------------------------------------------------------------
 .../dsl/sparql/SparqlTraversalSource.java       |  2 +-
 .../dsl/sparql/SparqlTraversalSourceTest.java   | 23 ++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a63309fd/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
index cc54aa5..f78708b 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
@@ -47,7 +47,6 @@ public class SparqlTraversalSource implements TraversalSource {
     public SparqlTraversalSource(final Graph graph, final TraversalStrategies traversalStrategies) {
         this.graph = graph;
         this.strategies = traversalStrategies;
-        this.strategies.addStrategies(SparqlStrategy.instance());
     }
 
     public SparqlTraversalSource(final Graph graph) {
@@ -126,6 +125,7 @@ public class SparqlTraversalSource implements TraversalSource {
      */
     public <S> SparqlTraversal<S,?> sparql(final String query) {
         final SparqlTraversalSource clone = this.clone();
+        clone.getStrategies().addStrategies(SparqlStrategy.instance());
 
         // this is a bit of a hack to get remote traversals to work cleanly. on the remote side, we'd expect a
         // GraphTraversalSource not a SparqlTraversalSource (given that sparql-gremlin is to be implemented in the

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a63309fd/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
index 1b39813..4092e58 100644
--- a/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
+++ b/sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java
@@ -18,16 +18,21 @@
  */
 package org.apache.tinkerpop.gremlin.sparql.process.traversal.dsl.sparql;
 
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy.SparqlStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
 import org.junit.Test;
 
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
 import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
+import static org.junit.Assert.assertEquals;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -36,6 +41,7 @@ public class SparqlTraversalSourceTest {
 
     private static final Graph graph = TinkerFactory.createModern();
     private static final SparqlTraversalSource g = graph.traversal(SparqlTraversalSource.class);
+    private static final GraphTraversalSource _g = graph.traversal();
 
     @Test
     public void shouldFindAllPersonsNamesAndAges() {
@@ -88,4 +94,21 @@ public class SparqlTraversalSourceTest {
         final List<?> x = g.sparql("SELECT ?name WHERE { ?person v:name ?name } ORDER BY DESC(?name)").toList();
         assertThat(x, contains("vadas", "ripple", "peter", "marko", "lop", "josh"));
     }
+
+    @Test
+    public void shouldFilter() {
+        final Map<String,Vertex> x = (Map) g.sparql(  "SELECT ?a ?b ?c\n" +
+                                                            "WHERE {\n" +
+                                                            "  ?a v:label \"person\" .\n" +
+                                                            "  ?a e:knows ?b .\n" +
+                                                            "  ?a e:created ?c .\n" +
+                                                            "  ?b e:created ?c .\n" +
+                                                            "  ?a v:age ?d .\n" +
+                                                            "    FILTER (?d < 30)\n" +
+                                                            "}").next();
+
+        assertEquals(x.get("a"), _g.V(1).next());
+        assertEquals(x.get("b"), _g.V(4).next());
+        assertEquals(x.get("c"), _g.V(3).next());
+    }
 }


[09/50] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by sp...@apache.org.
Merge branch 'tp32' into tp33


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

Branch: refs/heads/TINKERPOP-1878
Commit: 55fcbdc45bf3c6a78d7ecbbe2b13fe24fbb5ba1c
Parents: a0b7ce5 e8e22af
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 7 07:37:35 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 7 07:37:35 2018 -0400

----------------------------------------------------------------------
 hadoop-gremlin/pom.xml | 18 ------------------
 1 file changed, 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/55fcbdc4/hadoop-gremlin/pom.xml
----------------------------------------------------------------------


[37/50] tinkerpop git commit: TINKERPOP-1878 Major refactoring of sparql-gremlin classes

Posted by sp...@apache.org.
TINKERPOP-1878 Major refactoring of sparql-gremlin classes

Renamed the "compiler" to a "transpiler" since it's really transforming sparql to a language of a similar level of abstraction in Gremlin. Lots of code reformatting and dead code pruning.


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

Branch: refs/heads/TINKERPOP-1878
Commit: 2d4c8c94c1878de3d7a9921e702e26a8b0332bda
Parents: 1dedf4f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 26 13:36:29 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 .../gremlin/sparql/SparqlToGremlinCompiler.java | 381 -------------------
 .../sparql/SparqlToGremlinTranspiler.java       | 286 ++++++++++++++
 .../gremlin/sparql/TraversalBuilder.java        |   7 +-
 .../gremlin/sparql/WhereTraversalBuilder.java   |  66 ++--
 .../traversal/strategy/SparqlStrategy.java      |   5 +-
 5 files changed, 322 insertions(+), 423 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d4c8c94/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompiler.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompiler.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompiler.java
deleted file mode 100644
index adb36e9..0000000
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinCompiler.java
+++ /dev/null
@@ -1,381 +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.sparql;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.jena.graph.Triple;
-import org.apache.jena.query.Query;
-import org.apache.jena.query.QueryFactory;
-import org.apache.jena.query.SortCondition;
-import org.apache.jena.query.Syntax;
-import org.apache.jena.sparql.algebra.Algebra;
-import org.apache.jena.sparql.algebra.Op;
-import org.apache.jena.sparql.algebra.OpVisitorBase;
-import org.apache.jena.sparql.algebra.OpWalker;
-import org.apache.jena.sparql.algebra.op.OpBGP;
-import org.apache.jena.sparql.algebra.op.OpFilter;
-import org.apache.jena.sparql.algebra.op.OpLeftJoin;
-import org.apache.jena.sparql.algebra.op.OpUnion;
-import org.apache.jena.sparql.core.Var;
-import org.apache.jena.sparql.core.VarExprList;
-import org.apache.jena.sparql.expr.Expr;
-import org.apache.jena.sparql.expr.ExprAggregator;
-import org.apache.tinkerpop.gremlin.process.traversal.Order;
-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.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-// TODO: implement OpVisitor, don't extend OpVisitorBase
-public class SparqlToGremlinCompiler extends OpVisitorBase {
-
-	private GraphTraversal<Vertex, ?> traversal;
-
-	List<Traversal> traversalList = new ArrayList<Traversal>();
-
-	String groupVariable = "";
-	int sortingDirection = 0;
-	long offsetLimit = 0;
-	String sortingVariable = "";
-
-	GraphTraversalSource temp;
-	Graph graph;
-
-	private SparqlToGremlinCompiler(final GraphTraversal<Vertex, ?> traversal) {
-		this.traversal = traversal;
-	}
-
-	private SparqlToGremlinCompiler(final GraphTraversalSource g) {
-		this(g.V());
-		temp = g;
-
-	}
-
-	private SparqlToGremlinCompiler(final Graph g) {
-		this.traversal = (GraphTraversal<Vertex, ?>) g.traversal();
-		graph = g;
-	}
-
-	public String createMatchStep(String step) {
-		String st = "";
-		step = step.substring(1, step.length() - 2);
-		String first = step.substring(0, step.indexOf(","));
-		String second = step.substring(step.indexOf(",") + 1);
-		//System.out.println("First : " + first);
-		//System.out.println("Second : " + second);
-		st = first.substring(first.indexOf("["), first.length() - 1);
-		st = "[" + st + "," + second + "]";
-		return st;
-	}
-
-	GraphTraversal<Vertex, ?> convertToGremlinTraversal(final Query query) {
-		
-		// long startTime = System.currentTimeMillis();
-		// long endTime;
-		final Op op = Algebra.compile(query); // SPARQL query compiles here to
-												// OP
-//		System.out.println("OP Tree: " + op.toString());
-
-		
-		OpWalker.walk(op, this); // OP is being walked here
-		
-		
-		
-		
-		//System.out.println("time taken for opWalker:"+ (endTime-startTime));
-		// startTime = System.currentTimeMillis();
-		int traversalIndex = 0;
-		int numberOfTraversal = traversalList.size();
-		Traversal arrayOfAllTraversals[] = new Traversal[numberOfTraversal];
-
-		if (query.hasOrderBy() && !query.hasGroupBy()) {
-			List<SortCondition> sortingConditions = query.getOrderBy();
-			int directionOfSort = 0;
-
-			for (SortCondition sortCondition : sortingConditions) {
-				Expr expr = sortCondition.getExpression();
-				directionOfSort = sortCondition.getDirection();
-				sortingVariable = expr.getVarName();
-
-			}
-
-			Order orderDirection = Order.incr;
-			if (directionOfSort == -1) {
-				orderDirection = Order.decr;
-			}
-		}
-		for (Traversal tempTrav : traversalList) {
-
-			arrayOfAllTraversals[traversalIndex++] = tempTrav;
-		}
-
-		int directionOfSort = 0;
-		Order orderDirection = Order.incr;
-		if (query.hasOrderBy()) {
-			List<SortCondition> sortingConditions = query.getOrderBy();
-
-			//
-			for (SortCondition sortCondition : sortingConditions) {
-				Expr expr = sortCondition.getExpression();
-				directionOfSort = sortCondition.getDirection();
-				sortingVariable = expr.getVarName();
-//				System.out.println("order by var: "+sortingDirection);
-			}
-			//
-
-			if (directionOfSort == -1) {
-				orderDirection = Order.decr;
-			}
-
-		}
-
-		if (traversalList.size() > 0)
-			traversal = traversal.match(arrayOfAllTraversals);
-
-		final List<String> vars = query.getResultVars();
-		List<ExprAggregator> lstexpr = query.getAggregators();
-		if (!query.isQueryResultStar() && !query.hasGroupBy()) {
-
-			switch (vars.size()) {
-			case 0:
-				throw new IllegalStateException();
-			case 1:
-				if (query.isDistinct()) {
-//					System.out.println("Inside ------------------- >Select 1------------------------> Distinct");
-					traversal = traversal.dedup(vars.get(0));
-				}
-				if (query.hasOrderBy()) {
-//					System.out.println("Inside ------------------- >Select 1");
-					traversal = traversal.order().by(sortingVariable, orderDirection);
-				} else {
-
-					traversal = traversal.select(vars.get(0));
-				}
-				break;
-			case 2:
-				if (query.isDistinct()) {
-					traversal = traversal.dedup(vars.get(0), vars.get(1));
-				}
-				if (query.hasOrderBy()) {
-//					System.out.println("Inside ------------------- >Select 1");
-					traversal = traversal.order().by(__.select(vars.get(0)), orderDirection).by(__.select(vars.get(1)));
-				} else
-					traversal = traversal.select(vars.get(0), vars.get(1));
-				break;
-			default:
-				final String[] all = new String[vars.size()];
-				vars.toArray(all);
-				if (query.isDistinct()) {
-
-					traversal = traversal.dedup(all);
-				}
-				final String[] others = Arrays.copyOfRange(all, 2, vars.size());
-				if (query.hasOrderBy()) {
-
-					traversal = traversal.order().by(__.select(vars.get(0)), orderDirection).by(__.select(vars.get(1)));
-
-				} else
-					traversal = traversal.select(vars.get(0), vars.get(1), others);
-
-				break;
-			}
-
-		}
-		
-		
-		if (query.hasGroupBy()) {
-			VarExprList lstExpr = query.getGroupBy();
-			String grpVar = "";
-			Traversal tempTrav;
-			for (Var expr : lstExpr.getVars()) {
-				grpVar = expr.getName();
-				// System.out.println("The Group by var: " + expr.getName());
-			}
-
-			if (query.hasLimit()) {
-				long limit = query.getLimit(), offset = 0;
-
-				if (query.hasOffset()) {
-					offset = query.getOffset();
-
-				}
-				// if (query.hasGroupBy() && query.hasOrderBy())
-				// traversal = traversal.range( offset, offset + limit);
-				// else
-				// traversal = traversal.range(offset, offset + limit);
-
-			}
-
-			if (!grpVar.isEmpty())
-				traversal = traversal.select(grpVar);
-			if (query.hasAggregators()) {
-				List<ExprAggregator> exprAgg = query.getAggregators();
-				for (ExprAggregator expr : exprAgg) {
-
-//					System.out.println("The Aggregator by var: " + expr.getAggregator().getExprList().toString()
-//							+ " is :" + expr.getAggregator().toString());
-					if (expr.getAggregator().getName().contains("COUNT")) {
-						if (!query.toString().contains("GROUP")) {
-							if (expr.getAggregator().toString().contains("DISTINCT")) {
-								traversal = traversal
-										.dedup(expr.getAggregator().getExprList().get(0).toString().substring(1));
-							} else {
-								traversal = traversal
-										.select(expr.getAggregator().getExprList().get(0).toString().substring(1));
-							}
-							traversal = traversal.count();
-						} else
-							traversal = traversal.groupCount();
-					}
-					if (expr.getAggregator().getName().contains("MAX")) {
-						traversal = traversal.max();
-					}
-				}
-
-			} else {
-
-				traversal = traversal.group();
-			}
-			
-			
-		}
-
-
-		if (query.hasOrderBy() && query.hasGroupBy()) {
-
-			traversal = traversal.order().by(sortingVariable, orderDirection);
-		}
-		if (query.hasLimit()) {
-			long limit = query.getLimit(), offset = 0;
-
-			if (query.hasOffset()) {
-				offset = query.getOffset();
-
-			}
-			if (query.hasGroupBy() && query.hasOrderBy())
-				traversal = traversal.range(Scope.local, offset, offset + limit);
-			else
-				traversal = traversal.range(offset, offset + limit);
-
-		}
-		// endTime = System.currentTimeMillis();
-		// System.out.println("time taken for convertToGremlinTraversal Function : "+ (endTime-startTime)+" mili seconds");
-		
-		return traversal;
-	}
-
-	private static GraphTraversal<Vertex, ?> convertToGremlinTraversal(final GraphTraversalSource g,
-			final Query query) {
-		return new SparqlToGremlinCompiler(g).convertToGremlinTraversal(query);
-	}
-
-	public static GraphTraversal<Vertex, ?> convertToGremlinTraversal(final Graph graph, final String query) {
-		return convertToGremlinTraversal(graph.traversal(),	QueryFactory.create(Prefixes.prepend(query)));
-	}
-
-	public static GraphTraversal<Vertex, ?> convertToGremlinTraversal(final GraphTraversalSource g,
-			final String query) {
-		return convertToGremlinTraversal(g, QueryFactory.create(Prefixes.prepend(query), Syntax.syntaxSPARQL));
-	}
-
-	// VISITING SPARQL ALGEBRA OP BASIC TRIPLE PATTERNS - MAYBE
-	@Override
-	public void visit(final OpBGP opBGP) {
-		{
-			
-			// System.out.println("Inside opBGP ---------------------------------------------->");
-			final List<Triple> triples = opBGP.getPattern().getList();
-			final Traversal[] matchTraversals = new Traversal[triples.size()];
-			int i = 0;
-			for (final Triple triple : triples) {
-
-				matchTraversals[i++] = TraversalBuilder.transform(triple);
-				traversalList.add(matchTraversals[i - 1]);
-			}
-
-		}
-
-	}
-
-	// VISITING SPARQL ALGEBRA OP FILTER - MAYBE
-	@Override
-	public void visit(final OpFilter opFilter) {
-
-		// System.out.println("Inside opFilter ---------------------------------------------->");
-		Traversal traversal = null;
-
-		for (Expr expr : opFilter.getExprs().getList()) {
-			if (expr != null) {
-
-				traversal = __.where(WhereTraversalBuilder.transform(expr));
-				traversalList.add(traversal);
-			}
-		}
-
-	}
-	// TODO: add more functions for operators other than FILTER, such as
-	// OPTIONAL
-	// This can be done by understanding how Jena handles these other
-	// operators/filters inherently and then map them to Gremlin
-
-	public void visit(final OpLeftJoin opLeftJoin) {
-
-//		System.out.println("Inside opOptional ---------------------------------------------->");
-//		System.out.println(opLeftJoin.getRight().toString());
-
-	}
-
-	@Override
-	public void visit(final OpUnion opUnion) {
-
-		// System.out.println("Inside opUnion ---------------------------------------------->");
-		Traversal unionTemp[] = new Traversal[2];
-		Traversal unionTemp1[] = new Traversal[traversalList.size() / 2];
-		Traversal unionTemp2[] = new Traversal[traversalList.size() / 2];
-
-		int count = 0;
-
-		for (int i = 0; i < traversalList.size(); i++) {
-
-			if (i < traversalList.size() / 2) {
-
-				unionTemp1[i] = traversalList.get(i);
-			} else {
-				unionTemp2[count++] = traversalList.get(i);
-			}
-		}
-
-		unionTemp[1] = __.match(unionTemp2);
-		unionTemp[0] = __.match(unionTemp1);
-
-		traversalList.clear();
-		traversal = (GraphTraversal<Vertex, ?>) traversal.union(unionTemp);
-		// System.out.println("Getting out from Union -------------------> :
-		// "+traversal);
-		// traversalList.add(__.union(unionTemp));
-		// traversalList.clear();
-	}
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d4c8c94/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
new file mode 100644
index 0000000..9db7d82
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/SparqlToGremlinTranspiler.java
@@ -0,0 +1,286 @@
+/*
+ * 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.sparql;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.jena.graph.Triple;
+import org.apache.jena.query.Query;
+import org.apache.jena.query.QueryFactory;
+import org.apache.jena.query.SortCondition;
+import org.apache.jena.query.Syntax;
+import org.apache.jena.sparql.algebra.Algebra;
+import org.apache.jena.sparql.algebra.Op;
+import org.apache.jena.sparql.algebra.OpVisitorBase;
+import org.apache.jena.sparql.algebra.OpWalker;
+import org.apache.jena.sparql.algebra.op.OpBGP;
+import org.apache.jena.sparql.algebra.op.OpFilter;
+import org.apache.jena.sparql.algebra.op.OpUnion;
+import org.apache.jena.sparql.core.Var;
+import org.apache.jena.sparql.core.VarExprList;
+import org.apache.jena.sparql.expr.Expr;
+import org.apache.jena.sparql.expr.ExprAggregator;
+import org.apache.tinkerpop.gremlin.process.traversal.Order;
+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.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
+/**
+ * The engine that transpiles SPARQL to Gremlin traversals thus enabling SPARQL to be executed on any TinkerPop-enabled
+ * graph system.
+ */
+public class SparqlToGremlinTranspiler {
+
+	private GraphTraversal<Vertex, ?> traversal;
+
+    private List<Traversal> traversalList = new ArrayList<>();
+
+    private String sortingVariable = "";
+
+	private SparqlToGremlinTranspiler(final GraphTraversal<Vertex, ?> traversal) {
+		this.traversal = traversal;
+	}
+
+	private SparqlToGremlinTranspiler(final GraphTraversalSource g) {
+		this(g.V());
+	}
+
+    /**
+     * Converts SPARQL to a Gremlin traversal.
+     *
+     * @param graph the {@link Graph} instance to execute the traversal from
+     * @param sparqlQuery the query to transpile to Gremlin
+     */
+    public static GraphTraversal<Vertex, ?> transpile(final Graph graph, final String sparqlQuery) {
+        return transpile(graph.traversal(),	sparqlQuery);
+    }
+
+    /**
+     * Converts SPARQL to a Gremlin traversal.
+     *
+     * @param g the {@link GraphTraversalSource} instance to execute the traversal from
+     * @param sparqlQuery the query to transpile to Gremlin
+     */
+    public static GraphTraversal<Vertex, ?> transpile(final GraphTraversalSource g, final String sparqlQuery) {
+        return transpile(g, QueryFactory.create(Prefixes.prepend(sparqlQuery), Syntax.syntaxSPARQL));
+    }
+
+	private GraphTraversal<Vertex, ?> transpile(final Query query) {
+		final Op op = Algebra.compile(query);
+		OpWalker.walk(op, new GremlinOpVisitor());
+
+		int traversalIndex = 0;
+		final int numberOfTraversal = traversalList.size();
+        final Traversal arrayOfAllTraversals[] = new Traversal[numberOfTraversal];
+
+		if (query.hasOrderBy() && !query.hasGroupBy()) {
+            final List<SortCondition> sortingConditions = query.getOrderBy();
+
+			for (SortCondition sortCondition : sortingConditions) {
+                final Expr expr = sortCondition.getExpression();
+				sortingVariable = expr.getVarName();
+			}
+		}
+
+		for (Traversal tempTrav : traversalList) {
+			arrayOfAllTraversals[traversalIndex++] = tempTrav;
+		}
+
+		Order orderDirection = Order.incr;
+		if (query.hasOrderBy()) {
+            int directionOfSort = 0;
+            final List<SortCondition> sortingConditions = query.getOrderBy();
+
+			for (SortCondition sortCondition : sortingConditions) {
+                final Expr expr = sortCondition.getExpression();
+				directionOfSort = sortCondition.getDirection();
+				sortingVariable = expr.getVarName();
+			}
+
+			if (directionOfSort == -1) orderDirection = Order.decr;
+		}
+
+		if (traversalList.size() > 0)
+			traversal = traversal.match(arrayOfAllTraversals);
+
+		final List<String> vars = query.getResultVars();
+		if (!query.isQueryResultStar() && !query.hasGroupBy()) {
+            switch (vars.size()) {
+                case 0:
+                    throw new IllegalStateException();
+                case 1:
+                    if (query.isDistinct())
+                        traversal = traversal.dedup(vars.get(0));
+
+                    if (query.hasOrderBy())
+                        traversal = traversal.order().by(sortingVariable, orderDirection);
+                    else
+                        traversal = traversal.select(vars.get(0));
+
+                    break;
+                case 2:
+                    if (query.isDistinct())
+                        traversal = traversal.dedup(vars.get(0), vars.get(1));
+
+                    if (query.hasOrderBy())
+                        traversal = traversal.order().by(__.select(vars.get(0)), orderDirection).by(__.select(vars.get(1)));
+                    else
+                        traversal = traversal.select(vars.get(0), vars.get(1));
+
+                    break;
+                default:
+                    final String[] all = new String[vars.size()];
+                    vars.toArray(all);
+                    if (query.isDistinct())
+                        traversal = traversal.dedup(all);
+
+                    final String[] others = Arrays.copyOfRange(all, 2, vars.size());
+                    if (query.hasOrderBy())
+                        traversal = traversal.order().by(__.select(vars.get(0)), orderDirection).by(__.select(vars.get(1)));
+                    else
+                        traversal = traversal.select(vars.get(0), vars.get(1), others);
+
+                    break;
+            }
+		}
+
+		if (query.hasGroupBy()) {
+			final VarExprList lstExpr = query.getGroupBy();
+			String grpVar = "";
+			for (Var expr : lstExpr.getVars()) {
+				grpVar = expr.getName();
+			}
+
+			if (!grpVar.isEmpty())
+				traversal = traversal.select(grpVar);
+			if (query.hasAggregators()) {
+                final List<ExprAggregator> exprAgg = query.getAggregators();
+				for (ExprAggregator expr : exprAgg) {
+					if (expr.getAggregator().getName().contains("COUNT")) {
+						if (!query.toString().contains("GROUP")) {
+							if (expr.getAggregator().toString().contains("DISTINCT"))
+								traversal = traversal.dedup(expr.getAggregator().getExprList().get(0).toString().substring(1));
+							else
+								traversal = traversal.select(expr.getAggregator().getExprList().get(0).toString().substring(1));
+
+							traversal = traversal.count();
+						} else {
+                            traversal = traversal.groupCount();
+                        }
+					}
+
+					if (expr.getAggregator().getName().contains("MAX")) {
+						traversal = traversal.max();
+					}
+				}
+			} else {
+                traversal = traversal.group();
+            }
+		}
+
+		if (query.hasOrderBy() && query.hasGroupBy())
+			traversal = traversal.order().by(sortingVariable, orderDirection);
+
+		if (query.hasLimit()) {
+			long limit = query.getLimit(), offset = 0;
+
+			if (query.hasOffset())
+				offset = query.getOffset();
+
+			if (query.hasGroupBy() && query.hasOrderBy())
+				traversal = traversal.range(Scope.local, offset, offset + limit);
+			else
+				traversal = traversal.range(offset, offset + limit);
+		}
+
+		return traversal;
+	}
+
+    private static GraphTraversal<Vertex, ?> transpile(final GraphTraversalSource g, final Query query) {
+        return new SparqlToGremlinTranspiler(g).transpile(query);
+    }
+
+    /**
+     * An {@code OpVisitor} implementation that reads SPARQL algebra operations into Gremlin traversals.
+     */
+    private class GremlinOpVisitor extends OpVisitorBase {
+
+        /**
+         * Visiting triple patterns in SPARQL algebra.
+         */
+        @Override
+        public void visit(final OpBGP opBGP) {
+            final List<Triple> triples = opBGP.getPattern().getList();
+            final Traversal[] matchTraversals = new Traversal[triples.size()];
+            int i = 0;
+            for (final Triple triple : triples) {
+
+                matchTraversals[i++] = TraversalBuilder.transform(triple);
+                traversalList.add(matchTraversals[i - 1]);
+            }
+        }
+
+        /**
+         * Visiting filters in SPARQL algebra.
+         */
+        @Override
+        public void visit(final OpFilter opFilter) {
+            Traversal traversal;
+            for (Expr expr : opFilter.getExprs().getList()) {
+                if (expr != null) {
+                    traversal = __.where(WhereTraversalBuilder.transform(expr));
+                    traversalList.add(traversal);
+                }
+            }
+        }
+
+        /**
+         * Visiting unions in SPARQL algebra.
+         */
+        @Override
+        public void visit(final OpUnion opUnion) {
+            final Traversal unionTemp[] = new Traversal[2];
+            final Traversal unionTemp1[] = new Traversal[traversalList.size() / 2];
+            final Traversal unionTemp2[] = new Traversal[traversalList.size() / 2];
+
+            int count = 0;
+
+            for (int i = 0; i < traversalList.size(); i++) {
+                if (i < traversalList.size() / 2)
+                    unionTemp1[i] = traversalList.get(i);
+                else
+                    unionTemp2[count++] = traversalList.get(i);
+            }
+
+            unionTemp[1] = __.match(unionTemp2);
+            unionTemp[0] = __.match(unionTemp1);
+
+            traversalList.clear();
+            traversal = (GraphTraversal<Vertex, ?>) traversal.union(unionTemp);
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d4c8c94/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/TraversalBuilder.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/TraversalBuilder.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/TraversalBuilder.java
index 72a32a5..6d29442 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/TraversalBuilder.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/TraversalBuilder.java
@@ -26,10 +26,12 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.PropertyType;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 
-
+/**
+ * Converts triple patterns into {@link GraphTraversal} instances.
+ */
 class TraversalBuilder {
 
-    public static GraphTraversal<?, ?> transform(final Triple triple) {
+    static GraphTraversal<?, ?> transform(final Triple triple) {
         final GraphTraversal<Vertex, ?> matchTraversal = __.as(triple.getSubject().getName());
         
         final Node predicate = triple.getPredicate();
@@ -53,7 +55,6 @@ class TraversalBuilder {
                                                       final PropertyType type, final Node object) {
         switch (propertyName) {
             case "id":
-         
                 return object.isConcrete()
                         ? traversal.hasId(object.getLiteralValue())
                         : traversal.id().as(object.getName());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d4c8c94/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/WhereTraversalBuilder.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/WhereTraversalBuilder.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/WhereTraversalBuilder.java
index f4d49b6..80da707 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/WhereTraversalBuilder.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/WhereTraversalBuilder.java
@@ -33,61 +33,77 @@ import org.apache.jena.sparql.expr.E_LogicalAnd;
 import org.apache.jena.sparql.expr.E_LogicalOr;
 import org.apache.jena.sparql.expr.E_NotEquals;
 import org.apache.jena.sparql.expr.E_NotExists;
-import org.apache.jena.sparql.expr.E_StrLength;
 import org.apache.jena.sparql.expr.Expr;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 
+/**
+ * Converts SPARQL "where" expressions to Gremlin predicates.
+ */
 class WhereTraversalBuilder {
 
-    public static GraphTraversal<?, ?> transform(final E_Equals expression) {
-    //	System.out.println("The aggr one : "+expression.getArg1().getClass().getName() + "The aggr one :"+expression.getArg2().getClass().getName());
+    /**
+     * Converts a general {@code Expr} to an anonymous {@link GraphTraversal}.
+     */
+    static GraphTraversal<?, ?> transform(final Expr expression) {
+        if (expression instanceof E_Equals) return transform((E_Equals) expression);
+        if (expression instanceof E_NotEquals) return transform((E_NotEquals) expression);
+        if (expression instanceof E_LessThan) return transform((E_LessThan) expression);
+        if (expression instanceof E_LessThanOrEqual) return transform((E_LessThanOrEqual) expression);
+        if (expression instanceof E_GreaterThan) return transform((E_GreaterThan) expression);
+        if (expression instanceof E_GreaterThanOrEqual) return transform((E_GreaterThanOrEqual) expression);
+        if (expression instanceof E_LogicalAnd) return transform((E_LogicalAnd) expression);
+        if (expression instanceof E_LogicalOr) return transform((E_LogicalOr) expression);
+        if (expression instanceof E_Exists) return transform((E_Exists) expression);
+        if (expression instanceof E_NotExists) return transform((E_NotExists) expression);
+        throw new IllegalStateException(String.format("Unhandled expression: %s", expression));
+    }
+
+    private static GraphTraversal<?, ?> transform(final E_Equals expression) {
         final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
         return __.as(expression.getArg1().getVarName()).is(P.eq(value));
     }
 
-    public static GraphTraversal<?, ?> transform(final E_NotEquals expression) {
+    private static GraphTraversal<?, ?> transform(final E_NotEquals expression) {
         final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
         return __.as(expression.getArg1().getVarName()).is(P.neq(value));
     }
 
-    public static GraphTraversal<?, ?> transform(final E_LessThan expression) {
-    //	System.out.println("The aggr one : "+expression.getArg1().getClass().getName() + "The aggr one :"+expression.getArg2().getClass().getName());
+    private static GraphTraversal<?, ?> transform(final E_LessThan expression) {
     	final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
         return __.as(expression.getArg1().getVarName()).is(P.lt(value));
     }
 
-    public static GraphTraversal<?, ?> transform(final E_LessThanOrEqual expression) {
-    //	System.out.println("The aggr one : "+expression.getArg1().getClass().getName() + "The aggr one :"+expression.getArg2().getClass().getName());
+    private static GraphTraversal<?, ?> transform(final E_LessThanOrEqual expression) {
         final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
         return __.as(expression.getArg1().getVarName()).is(P.lte(value));
     }
 
-    public static GraphTraversal<?, ?> transform(final E_GreaterThan expression) {
+    private static GraphTraversal<?, ?> transform(final E_GreaterThan expression) {
         final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
         return __.as(expression.getArg1().getVarName()).is(P.gt(value));
     }
 
-    public static GraphTraversal<?, ?> transform(final E_GreaterThanOrEqual expression) {
+    private static GraphTraversal<?, ?> transform(final E_GreaterThanOrEqual expression) {
         final Object value = expression.getArg2().getConstant().getNode().getLiteralValue();
         return __.as(expression.getArg1().getVarName()).is(P.gte(value));
     }
 
-    public static GraphTraversal<?, ?> transform(final E_LogicalAnd expression) {
+    private static GraphTraversal<?, ?> transform(final E_LogicalAnd expression) {
         return __.and(
                 transform(expression.getArg1()),
                 transform(expression.getArg2()));
     }
 
-    public static GraphTraversal<?, ?> transform(final E_LogicalOr expression) {
+    private static GraphTraversal<?, ?> transform(final E_LogicalOr expression) {
         return __.or(
                 transform(expression.getArg1()),
                 transform(expression.getArg2()));
     }
 
-    public static GraphTraversal<?, ?> transform(final E_Exists expression) {
+    private static GraphTraversal<?, ?> transform(final E_Exists expression) {
         final OpBGP opBGP = (OpBGP) expression.getGraphPattern();
         final List<Triple> triples = opBGP.getPattern().getList();
         if (triples.size() != 1) throw new IllegalStateException("Unhandled EXISTS pattern");
@@ -99,7 +115,7 @@ class WhereTraversalBuilder {
     }
     
 
-    public static GraphTraversal<?, ?> transform(final E_NotExists expression) {
+    private static GraphTraversal<?, ?> transform(final E_NotExists expression) {
         final OpBGP opBGP = (OpBGP) expression.getGraphPattern();
         final List<Triple> triples = opBGP.getPattern().getList();
         if (triples.size() != 1) throw new IllegalStateException("Unhandled NOT EXISTS pattern");
@@ -109,26 +125,4 @@ class WhereTraversalBuilder {
         endStep.removeLabel(label);
         return __.not(traversal);
     }
-    
-    public static int getStrLength(final E_StrLength expression){
-    	
-    	return expression.getArg().toString().length();
-    	
-    }
-    
-    
-    //what does <?, ?> signify? possibly <S,E>
-    public static GraphTraversal<?, ?> transform(final Expr expression) {
-        if (expression instanceof E_Equals) return transform((E_Equals) expression);
-        if (expression instanceof E_NotEquals) return transform((E_NotEquals) expression);
-        if (expression instanceof E_LessThan) return transform((E_LessThan) expression);
-        if (expression instanceof E_LessThanOrEqual) return transform((E_LessThanOrEqual) expression);
-        if (expression instanceof E_GreaterThan) return transform((E_GreaterThan) expression);
-        if (expression instanceof E_GreaterThanOrEqual) return transform((E_GreaterThanOrEqual) expression);
-        if (expression instanceof E_LogicalAnd) return transform((E_LogicalAnd) expression);
-        if (expression instanceof E_LogicalOr) return transform((E_LogicalOr) expression);
-        if (expression instanceof E_Exists) return transform((E_Exists) expression);
-        if (expression instanceof E_NotExists) return transform((E_NotExists) expression);
-        throw new IllegalStateException(String.format("Unhandled expression: %s", expression));
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d4c8c94/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
index d74ac3e..4073ec2 100644
--- a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy;
 
-import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
 import org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
@@ -26,7 +25,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.ConstantStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.sparql.SparqlToGremlinCompiler;
+import org.apache.tinkerpop.gremlin.sparql.SparqlToGremlinTranspiler;
 import org.apache.tinkerpop.gremlin.sparql.process.traversal.dsl.sparql.SparqlTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 
@@ -69,7 +68,7 @@ public class SparqlStrategy extends AbstractTraversalStrategy<TraversalStrategy.
             final Object constant = stepWithSparql.getConstant();
             if (constant instanceof String) {
                 final String sparql = (String) constant;
-                final Traversal<Vertex, ?> sparqlTraversal = SparqlToGremlinCompiler.convertToGremlinTraversal(
+                final Traversal<Vertex, ?> sparqlTraversal = SparqlToGremlinTranspiler.transpile(
                         traversal.getGraph().get(), sparql);
                 TraversalHelper.removeAllSteps(traversal);
                 sparqlTraversal.asAdmin().getSteps().forEach(s -> traversal.addStep(s));


[26/50] tinkerpop git commit: TINKERPOP-1878 Added some Traversal infrastructure

Posted by sp...@apache.org.
TINKERPOP-1878 Added some Traversal infrastructure

This is the start of getting Sparql working as a DSL in TinkerPop


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

Branch: refs/heads/TINKERPOP-1878
Commit: c5e75436af4be662a7e21ff0972581034948cf60
Parents: 72c6072
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jan 24 17:04:27 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 .../dsl/sparql/DefaultSparqlTraversal.java      |  55 ++++++++
 .../traversal/dsl/sparql/SparqlTraversal.java   |  68 +++++++++
 .../dsl/sparql/SparqlTraversalSource.java       | 138 +++++++++++++++++++
 .../traversal/strategy/SparqlStrategy.java      |  25 ++++
 4 files changed, 286 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c5e75436/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/DefaultSparqlTraversal.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/DefaultSparqlTraversal.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/DefaultSparqlTraversal.java
new file mode 100644
index 0000000..133d4be
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/DefaultSparqlTraversal.java
@@ -0,0 +1,55 @@
+/*
+ * 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.sparql.process.traversal.dsl.sparql;
+
+import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DefaultSparqlTraversal<S, E> extends DefaultTraversal<S, E> implements SparqlTraversal.Admin<S, E> {
+
+    public DefaultSparqlTraversal() {
+        super();
+    }
+
+    public DefaultSparqlTraversal(final SparqlTraversalSource sparqlTraversalSource) {
+        super(sparqlTraversalSource);
+    }
+
+    public DefaultSparqlTraversal(final Graph graph) {
+        super(graph);
+    }
+
+    @Override
+    public SparqlTraversal.Admin<S, E> asAdmin() {
+        return this;
+    }
+
+    @Override
+    public SparqlTraversal<S, E> iterate() {
+        return SparqlTraversal.Admin.super.iterate();
+    }
+
+    @Override
+    public DefaultSparqlTraversal<S, E> clone() {
+        return (DefaultSparqlTraversal<S, E>) super.clone();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c5e75436/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversal.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversal.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversal.java
new file mode 100644
index 0000000..efa9489
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversal.java
@@ -0,0 +1,68 @@
+/*
+ * 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.sparql.process.traversal.dsl.sparql;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface SparqlTraversal<S, E> extends Traversal<S, E> {
+    public interface Admin<S, E> extends Traversal.Admin<S, E>, SparqlTraversal<S, E> {
+
+        @Override
+        public default <E2> SparqlTraversal.Admin<S, E2> addStep(final Step<?, E2> step) {
+            return (SparqlTraversal.Admin<S, E2>) Traversal.Admin.super.addStep((Step) step);
+        }
+
+        @Override
+        public default SparqlTraversal<S, E> iterate() {
+            return SparqlTraversal.super.iterate();
+        }
+
+        @Override
+        public SparqlTraversal.Admin<S, E> clone();
+    }
+
+    @Override
+    public default SparqlTraversal.Admin<S, E> asAdmin() {
+        return (SparqlTraversal.Admin<S, E>) this;
+    }
+
+    ////
+
+    /**
+     * Iterates the traversal presumably for the generation of side-effects.
+     */
+    @Override
+    public default SparqlTraversal<S, E> iterate() {
+        Traversal.super.iterate();
+        return this;
+    }
+
+    public static final class Symbols {
+
+        private Symbols() {
+            // static fields only
+        }
+
+        public static final String sparql = "sparql";
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c5e75436/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
new file mode 100644
index 0000000..3596716
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSource.java
@@ -0,0 +1,138 @@
+/*
+ * 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.sparql.process.traversal.dsl.sparql;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
+import org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ConstantStep;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Transaction;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class SparqlTraversalSource implements TraversalSource {
+    protected transient RemoteConnection connection;
+    protected final Graph graph;
+    protected TraversalStrategies strategies;
+    protected Bytecode bytecode = new Bytecode();
+
+    public SparqlTraversalSource(final Graph graph, final TraversalStrategies traversalStrategies) {
+        this.graph = graph;
+        this.strategies = traversalStrategies;
+    }
+
+    public SparqlTraversalSource(final Graph graph) {
+        this(graph, TraversalStrategies.GlobalCache.getStrategies(graph.getClass()));
+    }
+
+    @Override
+    public TraversalStrategies getStrategies() {
+        return this.strategies;
+    }
+
+    @Override
+    public Graph getGraph() {
+        return this.graph;
+    }
+
+    @Override
+    public Bytecode getBytecode() {
+        return this.bytecode;
+    }
+
+    @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException")
+    public SparqlTraversalSource clone() {
+        try {
+            final SparqlTraversalSource clone = (SparqlTraversalSource) super.clone();
+            clone.strategies = this.strategies.clone();
+            clone.bytecode = this.bytecode.clone();
+            return clone;
+        } catch (final CloneNotSupportedException e) {
+            throw new IllegalStateException(e.getMessage(), e);
+        }
+    }
+
+    //// CONFIGURATIONS
+
+    @Override
+    public SparqlTraversalSource withStrategies(final TraversalStrategy... traversalStrategies) {
+        return (SparqlTraversalSource) TraversalSource.super.withStrategies(traversalStrategies);
+    }
+
+    @Override
+    @SuppressWarnings({"unchecked"})
+    public SparqlTraversalSource withoutStrategies(final Class<? extends TraversalStrategy>... traversalStrategyClasses) {
+        return (SparqlTraversalSource) TraversalSource.super.withoutStrategies(traversalStrategyClasses);
+    }
+
+    @Override
+    public SparqlTraversalSource withRemote(final Configuration conf) {
+        return (SparqlTraversalSource) TraversalSource.super.withRemote(conf);
+    }
+
+    @Override
+    public SparqlTraversalSource withRemote(final String configFile) throws Exception {
+        return (SparqlTraversalSource) TraversalSource.super.withRemote(configFile);
+    }
+
+    @Override
+    public SparqlTraversalSource withRemote(final RemoteConnection connection) {
+        try {
+            // check if someone called withRemote() more than once, so just release resources on the initial
+            // connection as you can't have more than one. maybe better to toss IllegalStateException??
+            if (this.connection != null)
+                this.connection.close();
+        } catch (Exception ignored) {
+            // not sure there's anything to do here
+        }
+
+        this.connection = connection;
+        final TraversalSource clone = this.clone();
+        clone.getStrategies().addStrategies(new RemoteStrategy(connection));
+        return (SparqlTraversalSource) clone;
+    }
+
+    public <S> SparqlTraversal<S,String> sparql(final String query) {
+        final SparqlTraversalSource clone = this.clone();
+        clone.bytecode.addStep(SparqlTraversal.Symbols.sparql, query);
+        final SparqlTraversal.Admin<S, S> traversal = new DefaultSparqlTraversal<>(clone);
+        return traversal.addStep(new ConstantStep<S,String>(traversal, query));
+    }
+
+    public Transaction tx() {
+        return this.graph.tx();
+    }
+
+    @Override
+    public void close() throws Exception {
+        if (connection != null) connection.close();
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.traversalSourceString(this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c5e75436/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
----------------------------------------------------------------------
diff --git a/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
new file mode 100644
index 0000000..6440127
--- /dev/null
+++ b/sparql-gremlin/src/main/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/strategy/SparqlStrategy.java
@@ -0,0 +1,25 @@
+/*
+ * 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.sparql.process.traversal.strategy;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class SparqlStrategy {
+}


[34/50] tinkerpop git commit: TINKERPOP-1878 Changed gryo version of SparqlStrategy

Posted by sp...@apache.org.
TINKERPOP-1878 Changed gryo version of SparqlStrategy

Was using some temporary nonsense before...


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

Branch: refs/heads/TINKERPOP-1878
Commit: 56089eaba0da3902baaf08c34047c7b1f6fa802c
Parents: 5a163f2
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 26 08:16:24 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 15 08:17:30 2018 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/io/gryo/GryoVersion.java      | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/56089eab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
index 4a325dd..f922411 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
@@ -373,7 +373,7 @@ public enum GryoVersion {
             add(GryoTypeReg.of(RangeGlobalStep.RangeBiOperator.class, 114));
             add(GryoTypeReg.of(OrderGlobalStep.OrderBiOperator.class, 118));
             add(GryoTypeReg.of(ProfileStep.ProfileBiOperator.class, 119));
-            add(GryoTypeReg.of(IndexedTraverserSet.VertexIndexedTraverserSet.class, 173));                 // ***LAST ID***
+            add(GryoTypeReg.of(IndexedTraverserSet.VertexIndexedTraverserSet.class, 173));
 
             // placeholder serializers for classes that don't live here in core. this will allow them to be used if
             // present  or ignored if the class isn't available. either way the registration numbers are held as
@@ -383,8 +383,9 @@ public enum GryoVersion {
             tryAddDynamicType(this, "org.apache.tinkerpop.gremlin.driver.message.ResponseMessage",
                     "org.apache.tinkerpop.gremlin.driver.ser.ResponseMessageGryoSerializer", 169);
 
-            tryAddDynamicType(this, "org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy.SparqlStrategy",
-                    null, 1690);
+            tryAddDynamicType(this,
+                    "org.apache.tinkerpop.gremlin.sparql.process.traversal.strategy.SparqlStrategy",
+                    null, 174);                 // ***LAST ID***
         }};
     }
 


[10/50] tinkerpop git commit: Merge branch 'tp33'

Posted by sp...@apache.org.
Merge branch 'tp33'


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

Branch: refs/heads/TINKERPOP-1878
Commit: ae2f304d47a0c9280ec7894ce53d32ad270b157f
Parents: a3677e2 55fcbdc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 7 07:37:44 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 7 07:37:44 2018 -0400

----------------------------------------------------------------------
 hadoop-gremlin/pom.xml | 18 ------------------
 1 file changed, 18 deletions(-)
----------------------------------------------------------------------


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