[04/20] incubator-tinkerpop git commit: TraverserExecutor is smart to not do another iteration if the traversers will simply be returned to the master traversals as output. Updated the PageRankTest wi

2016-05-27 Thread dkuppitz
TraverserExecutor is smart to not do another iteration if the traversers will 
simply be returned to the master traversals as output. Updated the PageRankTest 
with a better test.


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

Branch: refs/heads/TINKERPOP-1298
Commit: 07e12995ae6bed0a3b1da3942bc54371d94a66a9
Parents: 4ee3028
Author: Marko A. Rodriguez 
Authored: Wed May 18 17:02:22 2016 -0600
Committer: Marko A. Rodriguez 
Committed: Wed May 18 17:02:22 2016 -0600

--
 .../process/computer/traversal/TraverserExecutor.java | 10 --
 .../process/traversal/step/map/GroovyPageRankTest.groovy  |  4 ++--
 .../gremlin/process/traversal/step/map/PageRankTest.java  | 10 ++
 3 files changed, 16 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/07e12995/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
index f5facdb..c5f9bb5 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
@@ -159,7 +159,10 @@ public final class TraverserExecutor {
 final TraverserSet barrierSet = 
barrier.nextBarrier();
 
IteratorUtils.removeOnNext(barrierSet.iterator()).forEachRemaining(traverser -> 
{
 traverser.addLabels(step.getLabels());  // this might 
need to be generalized for working with global barriers too
-if (traverser.isHalted() && ((!(traverser.get() 
instanceof Element) && !(traverser.get() instanceof Property)) || 
getHostingVertex(traverser.get()).equals(vertex))) {
+if (traverser.isHalted() &&
+(returnHaltedTraversers ||
+(!(traverser.get() instanceof Element) 
&& !(traverser.get() instanceof Property)) ||
+
getHostingVertex(traverser.get()).equals(vertex))) {
 traverser.detach();
 if (returnHaltedTraversers)
 
memory.add(TraversalVertexProgram.HALTED_TRAVERSERS, new 
TraverserSet<>(traverser));
@@ -181,7 +184,10 @@ public final class TraverserExecutor {
 }
 } else { // LOCAL PROCESSING
 step.forEachRemaining(traverser -> {
-if (traverser.isHalted() && ((!(traverser.get() instanceof 
Element) && !(traverser.get() instanceof Property)) || 
getHostingVertex(traverser.get()).equals(vertex))) {
+if (traverser.isHalted() &&
+(returnHaltedTraversers ||
+(!(traverser.get() instanceof Element) && 
!(traverser.get() instanceof Property)) ||
+
getHostingVertex(traverser.get()).equals(vertex))) {
 traverser.detach();
 if (returnHaltedTraversers)
 memory.add(TraversalVertexProgram.HALTED_TRAVERSERS, 
new TraverserSet<>(traverser));

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/07e12995/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyPageRankTest.groovy
--
diff --git 
a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyPageRankTest.groovy
 
b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyPageRankTest.groovy
index e27e8c0..8608c4d 100644
--- 
a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyPageRankTest.groovy
+++ 
b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyPageRankTest.groovy
@@ -71,8 +71,8 @@ public abstract class GroovyPageRankTest {
 }
 
 @Override
-public Traversal> 
get_g_V_outXcreatedX_pageRank_byXbothEX_byXprojectRankX_valueMapXname_projectRankX()
 {
-new ScriptTraversal<>(g, 

[11/20] incubator-tinkerpop git commit: Added "cycle detection" recipe. CTR

2016-05-27 Thread dkuppitz
Added "cycle detection" recipe. CTR


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

Branch: refs/heads/TINKERPOP-1298
Commit: 62f0e2d2da911520898f1f2204bbf413ba023368
Parents: 66a82ce
Author: Stephen Mallette 
Authored: Thu May 19 16:49:30 2016 -0400
Committer: Stephen Mallette 
Committed: Thu May 19 16:49:30 2016 -0400

--
 docs/src/recipes/cycle-detection.asciidoc |  61 +
 docs/static/images/graph-cycle.png| Bin 0 -> 774901 bytes
 2 files changed, 61 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/62f0e2d2/docs/src/recipes/cycle-detection.asciidoc
--
diff --git a/docs/src/recipes/cycle-detection.asciidoc 
b/docs/src/recipes/cycle-detection.asciidoc
new file mode 100644
index 000..864b760
--- /dev/null
+++ b/docs/src/recipes/cycle-detection.asciidoc
@@ -0,0 +1,61 @@
+
+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.
+
+[[cycle-detection]]
+Cycle Detection
+---
+
+A cycle occurs in a graph where a path loops back on itself to the originating 
vertex. For example, in the graph
+depticted below Gremlin could be use to detect the cycle among vertices 
`A-B-C`.
+
+image:graph-cycle.png[width=250]
+
+[gremlin-groovy]
+
+vA = graph.addVertex(id, 'a')
+vB = graph.addVertex(id, 'b')
+vC = graph.addVertex(id, 'c')
+vD = graph.addVertex(id, 'd')
+vA.addEdge("knows", vB)
+vB.addEdge("knows", vC)
+vC.addEdge("knows", vA)
+vA.addEdge("knows", vD)
+vC.addEdge("knows", vD)
+g.V().as("a").repeat(out().simplePath()).times(2).
+  where(out().as("a")).path()  <1>
+g.V().as("a").repeat(out().simplePath()).times(2).
+  where(out().as("a")).path().
+  dedup().by(unfold().order().by(id).dedup().fold())   <2>
+
+
+<1> Gremlin starts its traversal from a vertex labeled "a" and traverses 
`out()` from each vertex filtering on the
+`simplePath`, which removes paths with repeated objects. The steps going 
`out()` are repeated twice as in this case
+the length of the cycle is known to be three and there is no need to exceed 
that. The traversal filters with a
+`where()` to see only return paths that end with where it started at "a".
+<2> The previous query returned the `A-B-C` cycle, but it returned three paths 
which were all technically the same
+cycle. It returned three, because there was one for each vertex that started 
the cycle (i.e. one for `A`, one for `B`
+and one for `C`). This next line introduce deduplication to only return unique 
cycles.
+
+The above case assumed that the need was to only detect cycles over a path 
length of three. It also respected the
+directionality of the edges by only considering outgoing ones. What would need 
to change to detect cycles of
+arbitrary length over both incoming and outgoing edges in the modern graph?
+
+[gremlin-groovy,modern]
+
+g.V().as("a").repeat(both().simplePath()).emit(loops().is(gt(1))).
+  both().where(eq("a")).path().
+  dedup().by(unfold().order().by(id).dedup().fold())
+
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/62f0e2d2/docs/static/images/graph-cycle.png
--
diff --git a/docs/static/images/graph-cycle.png 
b/docs/static/images/graph-cycle.png
new file mode 100644
index 000..967e0ad
Binary files /dev/null and b/docs/static/images/graph-cycle.png differ



[18/20] incubator-tinkerpop git commit: Added script and configuration file that can be used for OLAP CSV exports.

2016-05-27 Thread dkuppitz
Added script and configuration file that can be used for OLAP CSV exports.


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

Branch: refs/heads/TINKERPOP-1298
Commit: e13f91aacddd4cb5722ac3a6e100fdf70b0c33fd
Parents: 8ad5b62
Author: Daniel Kuppitz 
Authored: Mon May 23 18:24:22 2016 +0200
Committer: Daniel Kuppitz 
Committed: Tue May 24 19:51:22 2016 +0200

--
 data/script-csv-export.groovy   | 43 +++
 .../conf/hadoop-csv-export.properties   | 56 
 2 files changed, 99 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e13f91aa/data/script-csv-export.groovy
--
diff --git a/data/script-csv-export.groovy b/data/script-csv-export.groovy
new file mode 100644
index 000..7a6da22
--- /dev/null
+++ b/data/script-csv-export.groovy
@@ -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.
+ */
+@Grab(group = 'com.opencsv', module = 'opencsv', version = '3.7')
+import com.opencsv.*
+
+import 
org.apache.tinkerpop.gremlin.process.computer.bulkdumping.BulkExportVertexProgram
+
+def stringify(vertex) {
+  def result = null
+  def haltedTraversers = 
vertex.property(TraversalVertexProgram.HALTED_TRAVERSERS)
+  if (haltedTraversers.isPresent()) {
+def properties = 
vertex.value(BulkExportVertexProgram.BULK_EXPORT_PROPERTIES).split("\1")*.split("\2",
 2)*.toList()
+def writer = new StringWriter()
+def w = new CSVWriter(writer)
+haltedTraversers.value().each { def t ->
+  def values = []
+  properties.each { def property, def format ->
+def value = t.path(property)
+values << (format.isEmpty() ? value.toString() : String.format(format, 
value))
+  }
+  w.writeNext((String[]) values, false)
+}
+result = writer.toString().trim()
+writer.close()
+  }
+  return result
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e13f91aa/hadoop-gremlin/conf/hadoop-csv-export.properties
--
diff --git a/hadoop-gremlin/conf/hadoop-csv-export.properties 
b/hadoop-gremlin/conf/hadoop-csv-export.properties
new file mode 100644
index 000..3e1f8da
--- /dev/null
+++ b/hadoop-gremlin/conf/hadoop-csv-export.properties
@@ -0,0 +1,56 @@
+# 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.
+gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
+gremlin.hadoop.graphReader=org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat
+gremlin.hadoop.graphWriter=org.apache.tinkerpop.gremlin.hadoop.structure.io.script.ScriptOutputFormat
+gremlin.hadoop.jarsInDistributedCache=true
+gremlin.hadoop.defaultGraphComputer=org.apache.tinkerpop.gremlin.spark.process.computer.SparkGraphComputer
+
+gremlin.hadoop.inputLocation=output
+gremlin.hadoop.scriptOutputFormat.script=script-csv-export.groovy
+gremlin.hadoop.outputLocation=export
+
+
+# 

[03/20] incubator-tinkerpop git commit: fixed HALTED_TRAVERSER bug where traversers were not at their 'resting location'. This only shows up in multi-OLAP job chains. HALTED_TRAVERESERS (master traves

2016-05-27 Thread dkuppitz
fixed HALTED_TRAVERSER bug where traversers were not at their 'resting 
location'. This only shows up in multi-OLAP job chains. HALTED_TRAVERESERS 
(master travesal) are now propagated via Configuration and NOT via sideEffects. 
This is more elegant and there are now helper methods in TraversalVertexProgram 
to make getting master halted traversers easy. Updated the-travesal.asciidoc to 
reflect how to use ProgramStep with it. Had to change a method signature in 
VertexComputing to account for this... its slight (breaking), but no one is 
using this right now, I'm sure of it. And if they are, the chaneg is trivial, 
just add a new argument to a method signature and ignore it to make it be like 
how it is in 3.2.0. ImmutablePath.TailPath was not serializable and this caused 
issues for HALTED_TRAVERSERS as well. Everything else fixed up.


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

Branch: refs/heads/TINKERPOP-1298
Commit: 4ee302899da37a0ad0ebab6bc4954ed39b69d6d9
Parents: c61095f
Author: Marko A. Rodriguez 
Authored: Wed May 18 16:15:40 2016 -0600
Committer: Marko A. Rodriguez 
Committed: Wed May 18 16:15:40 2016 -0600

--
 docs/src/reference/the-traversal.asciidoc   | 23 +++--
 .../process/computer/GiraphGraphComputer.java   |  6 +++
 .../traversal/MemoryTraversalSideEffects.java   |  1 -
 .../traversal/TraversalVertexProgram.java   | 50 +---
 .../computer/traversal/TraverserExecutor.java   | 21 +---
 .../traversal/step/VertexComputing.java |  8 +++-
 .../step/map/PageRankVertexProgramStep.java |  7 +--
 .../step/map/PeerPressureVertexProgramStep.java | 11 -
 .../step/map/ProgramVertexProgramStep.java  | 10 +++-
 .../step/map/TraversalVertexProgramStep.java| 13 +++--
 .../traversal/step/map/VertexProgramStep.java   | 21 +++-
 .../optimization/GraphFilterStrategy.java   |  3 +-
 .../traversal/step/util/ImmutablePath.java  |  3 +-
 .../step/map/GroovyPageRankTest.groovy  |  5 ++
 .../traversal/step/map/PageRankTest.java| 22 +
 .../process/traversal/step/map/ProgramTest.java | 38 ---
 .../process/computer/SparkGraphComputer.java|  7 ++-
 .../optimization/SparkInterceptorStrategy.java  |  5 +-
 .../SparkSingleIterationStrategy.java   |  4 +-
 19 files changed, 185 insertions(+), 73 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4ee30289/docs/src/reference/the-traversal.asciidoc
--
diff --git a/docs/src/reference/the-traversal.asciidoc 
b/docs/src/reference/the-traversal.asciidoc
index 71708e2..3394e90 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -1436,6 +1436,8 @@ are provided below.
 
 [source,java]
 
+private TraverserSet haltedTraversers;
+
 public void loadState(final Graph graph, final Configuration configuration) {
   VertexProgram.super.loadState(graph, configuration);
   this.traversal = PureTraversal.loadState(configuration, 
VertexProgramStep.ROOT_TRAVERSAL, graph);
@@ -1444,18 +1446,29 @@ public void loadState(final Graph graph, final 
Configuration configuration) {
   
this.memoryComputeKeys.addAll(MemoryTraversalSideEffects.getMemoryComputeKeys(this.traversal.get()));
   // if master-traversal traversers may be propagated, create a memory compute 
key
   
this.memoryComputeKeys.add(MemoryComputeKey.of(TraversalVertexProgram.HALTED_TRAVERSERS,
 Operator.addAll, false, false));
+  // returns an empty traverser set if there are no halted traversers
+  this.haltedTraversers = 
TraversalVertexProgram.getHaltedTraversers(configuration);
+}
+
+public void storeState(final Configuration configuration) {
+  VertexProgram.super.storeState(configuration);
+  // if halted traversers is null or empty, it does nothing
+  TraversalVertexProgram.storeHaltedTraversers(configuration, 
this.haltedTraversers);
 }
 
 public void setup(final Memory memory) {
-  if(sideEffects.exists(TraversalVertexProgram.HALTED_TRAVERSERS)) {
-// haltedTraversers in setup() represent master-traversal traversers
-// for example, from a traversal of the form 
g.V().groupCount().program(...)
-TraverserSet haltedTraversers = 
sideEffects.get(TraversalVertexProgram.HALTED_TRAVERSERS);
-// do as you please with this information
+  if(null != this.haltedTraversers) {
+// do what you like with the halted master traversal traversers
   }
+  // once used, no need to keep that information around 

[10/20] incubator-tinkerpop git commit: added a style guide to the recipes cook book. CTR as the style model was DISCUSS in dev.

2016-05-27 Thread dkuppitz
added a style guide to the recipes cook book. CTR as the style model was 
DISCUSS in dev.


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

Branch: refs/heads/TINKERPOP-1298
Commit: 66a82cece601af2b04080e6b7a0f4da959a48078
Parents: c61095f
Author: Marko A. Rodriguez 
Authored: Thu May 19 08:12:56 2016 -0600
Committer: Marko A. Rodriguez 
Committed: Thu May 19 08:12:56 2016 -0600

--
 CHANGELOG.asciidoc|  1 +
 docs/src/recipes/index.asciidoc   |  2 +
 docs/src/recipes/style-guide.asciidoc | 81 ++
 3 files changed, 84 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/66a82cec/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 3de3702..628b4f4 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ 
image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
 TinkerPop 3.2.1 (NOT OFFICIALLY RELEASED YET)
 ~
 
+* Added a traversal style guide to the recipes cookbook.
 * Fixed a bug in master-traversal traverser propagation.
 * Added useful methods for custom `VertexPrograms` to be used with 
`program()`-step.
 * Increased the test coverage around traverser propagation within a multi-job 
OLAP traversal.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/66a82cec/docs/src/recipes/index.asciidoc
--
diff --git a/docs/src/recipes/index.asciidoc b/docs/src/recipes/index.asciidoc
index fcda27b..8a64818 100644
--- a/docs/src/recipes/index.asciidoc
+++ b/docs/src/recipes/index.asciidoc
@@ -36,6 +36,8 @@ 
link:http://tinkerpop.apache.org/docs/x.y.z/tutorials/the-gremlin-console/[The G
 Traversal Recipes
 =
 
+include::style-guide.asciidoc[]
+
 include::between-vertices.asciidoc[]
 
 include::shortest-path.asciidoc[]

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/66a82cec/docs/src/recipes/style-guide.asciidoc
--
diff --git a/docs/src/recipes/style-guide.asciidoc 
b/docs/src/recipes/style-guide.asciidoc
new file mode 100644
index 000..14cbad9
--- /dev/null
+++ b/docs/src/recipes/style-guide.asciidoc
@@ -0,0 +1,81 @@
+
+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.
+
+[[style-guide]]
+Style Guide
+---
+
+Gremlin is a data flow language where each new step concatenation alters the 
stream accordingly. This aspect of the
+language allows users to easily "build-up" a traversal (literally) 
step-by-step until the expected results are
+returned. For instance:
+
+[gremlin-groovy,modern]
+
+g.V(1)
+g.V(1).out('knows')
+g.V(1).out('knows').out('created')
+g.V(1).out('knows').out('created').groupCount()
+g.V(1).out('knows').out('created').groupCount().by('name')
+
+
+A drawback of building up a traversal is that users tend to create long, 
single line traversal that are hard to read.
+For simple traversals, a single line is fine. For complex traversals, there 
are few formatting patterns that should be followed
+which will yield cleaner, easier to understand traversals. For instance, the 
last traversal above would be written:
+
+[gremlin-groovy,modern]
+
+g.V(1).out('knows').out('created').
+  groupCount().by('name')
+
+
+Lets look at a complex traversal and analyze each line according to the 
recommended formatting rule is subscribes to.
+
+[gremlin-groovy,modern]
+
+g.V().out('knows').out('created').  <1>
+  group().by('lang').by().  <2>
+select('java').unfold().<3>
+  in('created').hasLabel('person'). <4>
+  order().  <5>
+by(inE().count(),decr).   

[04/10] incubator-tinkerpop git commit: Merge branch 'master' into TINKERPOP-1310

2016-05-27 Thread okram
Merge branch 'master' into TINKERPOP-1310


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

Branch: refs/heads/master
Commit: 7255844c03fc1b6d447a2631250100758c4f84cb
Parents: 3978e7b 6113c92
Author: Marko A. Rodriguez 
Authored: Wed May 25 12:25:51 2016 -0600
Committer: Marko A. Rodriguez 
Committed: Wed May 25 12:25:51 2016 -0600

--
 CHANGELOG.asciidoc  |   1 +
 .../process/traversal/step/map/GroupStep.java   | 307 ---
 .../step/sideEffect/GroupSideEffectStep.java|  61 ++--
 .../step/sideEffect/GroovyGroupTest.groovy  |  10 +
 .../traversal/step/sideEffect/GroupTest.java|  77 +
 .../gremlin/hadoop/structure/HadoopGraph.java   | 124 ++--
 .../SparkStarBarrierInterceptor.java|   1 -
 .../structure/TinkerGraphPlayTest.java  |   4 +-
 8 files changed, 390 insertions(+), 195 deletions(-)
--




[5/6] incubator-tinkerpop git commit: Added gryo "lite" serializer.

2016-05-27 Thread spmallette
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5b6394c5/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
--
diff --git 
a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
 
b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
index adb0fe3..86245b5 100644
--- 
a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
+++ 
b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
@@ -38,6 +38,7 @@ scriptEngines: {
   staticImports: [java.lang.Math.PI]}}
 serializers:
   - { className: 
org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { 
useMapperFromGraph: graph, custom: 
[groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}}
+  - { className: 
org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: 
{ useMapperFromGraph: graph, custom: 
[groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}}
   - { className: 
org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { 
serializeResultToString: true}}
   - { className: 
org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, 
config: { useMapperFromGraph: graph }}
   - { className: 
org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: 
{ useMapperFromGraph: graph }}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5b6394c5/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
--
diff --git 
a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
 
b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
index fe674aa..c1a5214 100644
--- 
a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
+++ 
b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
@@ -34,6 +34,7 @@ scriptEngines: {
   staticImports: [java.lang.Math.PI]}}
 serializers:
   - { className: 
org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { 
useMapperFromGraph: graph, custom: 
[groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}}
+  - { className: 
org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: 
{ useMapperFromGraph: graph, custom: 
[groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}}
   - { className: 
org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { 
serializeResultToString: true}}
   - { className: 
org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, 
config: { useMapperFromGraph: graph }}
   - { className: 
org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: 
{ useMapperFromGraph: graph }}



incubator-tinkerpop git commit: Convert DOS to Unix. CTR.

2016-05-27 Thread pluradj
Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 0397f252f -> 985170ecb


Convert DOS to Unix. CTR.


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

Branch: refs/heads/master
Commit: 985170ecb5346008510ddd34a2c272a8faac390b
Parents: 0397f25
Author: Jason Plurad 
Authored: Fri May 27 10:45:49 2016 -0400
Committer: Jason Plurad 
Committed: Fri May 27 10:45:49 2016 -0400

--
 gremlin-groovy/pom.xml | 276 ++--
 gremlin-test/pom.xml   | 184 ++---
 2 files changed, 230 insertions(+), 230 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/985170ec/gremlin-groovy/pom.xml
--
diff --git a/gremlin-groovy/pom.xml b/gremlin-groovy/pom.xml
index d94c35f..266962f 100644
--- a/gremlin-groovy/pom.xml
+++ b/gremlin-groovy/pom.xml
@@ -1,138 +1,138 @@
-
-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;>
-4.0.0
-
-org.apache.tinkerpop
-tinkerpop
-3.2.1-SNAPSHOT
-
-gremlin-groovy
-Apache TinkerPop :: Gremlin Groovy
-
-
-org.apache.tinkerpop
-gremlin-core
-${project.version}
-
-
-org.apache.ivy
-ivy
-2.3.0
-
-
-org.codehaus.groovy
-groovy
-${groovy.version}
-indy
-
-
-org.codehaus.groovy
-groovy-groovysh
-${groovy.version}
-indy
-
-
-org.codehaus.groovy
-groovy-json
-${groovy.version}
-indy
-
-
-org.codehaus.groovy
-groovy-jsr223
-${groovy.version}
-indy
-
-
-org.apache.commons
-commons-lang3
-3.3.1
-
-
-com.github.jeremyh
-jBCrypt
-jbcrypt-0.4
-
-
-org.apache.tinkerpop
-gremlin-test
-${project.version}
-test
-
-
-
-
-hyracks-releases
-
http://obelix.ics.uci.edu/nexus/content/groups/hyracks-public-releases/
-
-
-jitpack.io
-https://jitpack.io
-
-
-
-${basedir}/target
-${project.artifactId}-${project.version}
-
-
-${basedir}/src/main/resources
-
-
-
-
-
-${basedir}/src/test/resources
-
-
-
-
-
-org.codehaus.gmavenplus
-gmavenplus-plugin
-1.2
-
-
-
-addSources
-addTestSources
-generateStubs
-compile
-testGenerateStubs
-testCompile
-removeStubs
-removeTestStubs
-
-
-
-
-true
-
-
-
-org.apache.maven.plugins
-maven-surefire-plugin
-
-
-org.apache.maven.plugins
-maven-failsafe-plugin
-
-
-
-
+
+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;>
+4.0.0
+
+org.apache.tinkerpop
+tinkerpop
+3.2.1-SNAPSHOT
+
+gremlin-groovy
+Apache TinkerPop :: Gremlin Groovy
+
+
+org.apache.tinkerpop
+gremlin-core
+${project.version}
+
+
+org.apache.ivy
+ivy
+2.3.0
+
+
+org.codehaus.groovy
+groovy
+${groovy.version}
+indy
+
+
+org.codehaus.groovy
+groovy-groovysh
+

[11/12] incubator-tinkerpop git commit: Forgot to handle `FilterSteps`.

2016-05-27 Thread dkuppitz
Forgot to handle `FilterSteps`.


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

Branch: refs/heads/master
Commit: 5d38bbeb591a49f5c47ed0aa7d9aece12cf3dd21
Parents: ef53888
Author: Daniel Kuppitz 
Authored: Thu May 26 22:18:25 2016 +0200
Committer: Daniel Kuppitz 
Committed: Fri May 27 13:25:39 2016 +0200

--
 .../strategy/optimization/RangeByIsCountStrategy.java | 10 +-
 .../strategy/optimization/RangeByIsCountStrategyTest.java |  1 +
 2 files changed, 6 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5d38bbeb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
index 835a8f9..451d561 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
@@ -27,6 +27,7 @@ import 
org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.RepeatStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.IsStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.NotStep;
 import 
org.apache.tinkerpop.gremlin.process.traversal.step.filter.RangeGlobalStep;
@@ -95,17 +96,16 @@ public final class RangeByIsCountStrategy extends 
AbstractTraversalStrategy highRange;
 if (update) {
-final boolean isNested = !(parent instanceof 
EmptyStep);
-if (isNested) {
+if (parent instanceof EmptyStep) {
+useNotStep = true;
+} else {
 if (parent instanceof RepeatStep) {
 final RepeatStep repeatStep = 
(RepeatStep) parent;
 useNotStep = Objects.equals(traversal, 
repeatStep.getUntilTraversal())
 || Objects.equals(traversal, 
repeatStep.getEmitTraversal());
 } else {
-useNotStep = parent instanceof 
SideEffectStep;
+useNotStep = parent instanceof 
FilterStep || parent instanceof SideEffectStep;
 }
-} else {
-useNotStep = true;
 }
 highRange = highRangeCandidate;
 useNotStep &= curr.getLabels().isEmpty() && 
next.getLabels().isEmpty()

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5d38bbeb/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
--
diff --git 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
index 8b42e7f..03d5176 100644
--- 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
+++ 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
@@ -142,6 +142,7 @@ public class RangeByIsCountStrategyTest {
 {__.out().count().is(without(2, 6, 4)), 
__.out().limit(6).count().is(without(2, 6, 4))},
 {__.map(__.count().is(0)), 
__.map(__.limit(1).count().is(0))},
 

[09/12] incubator-tinkerpop git commit: Fixed `DefaultTraversal`'s hash code calculation.

2016-05-27 Thread dkuppitz
Fixed `DefaultTraversal`'s hash code calculation.


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

Branch: refs/heads/master
Commit: ef53888c9e5bcd16445c129d0692ec7c73d5343a
Parents: 05ab599
Author: Daniel Kuppitz 
Authored: Thu May 26 15:55:02 2016 +0200
Committer: Daniel Kuppitz 
Committed: Fri May 27 13:25:38 2016 +0200

--
 .../gremlin/process/traversal/util/DefaultTraversal.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ef53888c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
index 43fc692..977e4ac 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
@@ -303,9 +303,10 @@ public class DefaultTraversal implements 
Traversal.Admin {
 
 @Override
 public int hashCode() {
+int index = 0;
 int result = this.getClass().hashCode();
 for (final Step step : this.asAdmin().getSteps()) {
-result ^= step.hashCode();
+result ^= Integer.rotateLeft(step.hashCode(), index++);
 }
 return result;
 }



[01/12] incubator-tinkerpop git commit: Updated CHANGELOG

2016-05-27 Thread dkuppitz
Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 67fd4ee96 -> 0397f252f


Updated CHANGELOG


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

Branch: refs/heads/master
Commit: a73ec2ff82697439a0f684045228a854ba2ef374
Parents: 572736d
Author: Daniel Kuppitz 
Authored: Wed May 25 21:24:58 2016 +0200
Committer: Daniel Kuppitz 
Committed: Fri May 27 13:25:34 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/a73ec2ff/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 3d1f51f..9cd6998 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ 
image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
 TinkerPop 3.1.3 (NOT OFFICIALLY RELEASED YET)
 ~
 
+* Optimized a few special cases in `RangeByIsCountStrategy`.
 * Named the thread pool used by Gremlin Server sessions: 
"gremlin-server-session-$n".
 * Fixed a bug in `BulkSet.equals()` which made itself apparent when using 
`store()` and `aggregate()` with labeled `cap()`.
 * Ensured that all asserts of vertex and edge counts were being applied 
properly in the test suite.



[04/12] incubator-tinkerpop git commit: Increase step offset by 2 if `foo.count().is(0)` was replaced by `not(foo)`.

2016-05-27 Thread dkuppitz
Increase step offset by 2 if `foo.count().is(0)` was replaced by `not(foo)`.


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

Branch: refs/heads/master
Commit: bffa77f22dda6831c32aa70cd2f1f32d9652993f
Parents: a73ec2f
Author: Daniel Kuppitz 
Authored: Wed May 25 21:33:44 2016 +0200
Committer: Daniel Kuppitz 
Committed: Fri May 27 13:25:36 2016 +0200

--
 .../traversal/strategy/optimization/RangeByIsCountStrategy.java | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bffa77f2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
index f3168a3..1b544c2 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
@@ -109,6 +109,7 @@ public final class RangeByIsCountStrategy extends 
AbstractTraversalStrategy(traversal, inner), traversal);



[05/12] incubator-tinkerpop git commit: Don't over-optimize in `RangeByIsCountStrategy` if `count()` or `is()` is labeled.

2016-05-27 Thread dkuppitz
Don't over-optimize in `RangeByIsCountStrategy` if `count()` or `is()` is 
labeled.


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

Branch: refs/heads/master
Commit: d55897afcd3833d9161d0871ad46cc21cf3db7ce
Parents: 51f55df
Author: Daniel Kuppitz 
Authored: Thu May 26 11:13:17 2016 +0200
Committer: Daniel Kuppitz 
Committed: Fri May 27 13:25:37 2016 +0200

--
 .../traversal/strategy/optimization/RangeByIsCountStrategy.java | 5 +++--
 .../strategy/optimization/RangeByIsCountStrategyTest.java   | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d55897af/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
index efa79e6..2994085 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
@@ -90,8 +90,9 @@ public final class RangeByIsCountStrategy extends 
AbstractTraversalStrategy highRange;
 if (update) {
 highRange = highRangeCandidate;
-useNotStep = (highRange <= 1L && 
predicate.equals(Compare.lt)) ||
-(highRange == 1L && 
(predicate.equals(Compare.eq) || predicate.equals(Compare.lte)));
+useNotStep = curr.getLabels().isEmpty() && 
next.getLabels().isEmpty()
+&& ((highRange <= 1L && 
predicate.equals(Compare.lt))
+|| (highRange == 1L && 
(predicate.equals(Compare.eq) || predicate.equals(Compare.lte;
 }
 } else {
 final Long highRangeOffset = 
RANGE_PREDICATES.get(predicate);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d55897af/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
--
diff --git 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
index b6d0e27..f07c267 100644
--- 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
+++ 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
@@ -127,6 +127,8 @@ public class RangeByIsCountStrategyTest {
 {__.out().count().is(0), __.not(__.out())},
 {__.out().count().is(lt(1)), __.not(__.out())},
 {__.out().count().is(lte(0)), __.not(__.out())},
+{__.out().count().is(0).as("a"), 
__.out().limit(1).count().is(0).as("a")},
+{__.out().count().as("a").is(0), 
__.out().limit(1).count().as("a").is(0)},
 {__.out().count().is(neq(4)), 
__.out().limit(5).count().is(neq(4))},
 {__.out().count().is(lte(3)), 
__.out().limit(4).count().is(lte(3))},
 {__.out().count().is(lt(3)), 
__.out().limit(3).count().is(lt(3))},



[09/11] incubator-tinkerpop git commit: Fixed some typos.

2016-05-27 Thread dkuppitz
Fixed some typos.


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

Branch: refs/heads/tp31
Commit: 05ab5992cbf40d1e1e1908089d3fb62f8578ea44
Parents: 70e8c2a
Author: Daniel Kuppitz 
Authored: Thu May 26 15:44:23 2016 +0200
Committer: Daniel Kuppitz 
Committed: Fri May 27 13:25:38 2016 +0200

--
 .../strategy/optimization/RangeByIsCountStrategyTest.java | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/05ab5992/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
--
diff --git 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
index 820d4cc..8b42e7f 100644
--- 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
+++ 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
@@ -107,7 +107,7 @@ public class RangeByIsCountStrategyTest {
 
 protected TraversalEngine traversalEngine;
 
-void applyAdjacentToIncidentStrategy(final Traversal traversal) {
+void applyRangeByIsCountStrategy(final Traversal traversal) {
 final TraversalStrategies strategies = new 
DefaultTraversalStrategies();
 strategies.addStrategies(RangeByIsCountStrategy.instance());
 
@@ -117,7 +117,7 @@ public class RangeByIsCountStrategyTest {
 }
 
 public void doTest(final Traversal traversal, final Traversal 
optimized) {
-applyAdjacentToIncidentStrategy(traversal);
+applyRangeByIsCountStrategy(traversal);
 assertEquals(optimized, traversal);
 }
 
@@ -140,10 +140,10 @@ public class RangeByIsCountStrategyTest {
 {__.out().count().is(outside(2, 4)), 
__.out().limit(5).count().is(outside(2, 4))},
 {__.out().count().is(within(2, 6, 4)), 
__.out().limit(7).count().is(within(2, 6, 4))},
 {__.out().count().is(without(2, 6, 4)), 
__.out().limit(6).count().is(without(2, 6, 4))},
-{__.map(__.count().is(0)), 
__.map(__.count().limit(1).is(0))},
-{__.flatMap(__.count().is(0)), 
__.flatMap(__.count().limit(1).is(0))},
+{__.map(__.count().is(0)), 
__.map(__.limit(1).count().is(0))},
+{__.flatMap(__.count().is(0)), 
__.flatMap(__.limit(1).count().is(0))},
 {__.sideEffect(__.count().is(0)), 
__.sideEffect(__.not(__.identity()))},
-{__.branch(__.count().is(0)), 
__.branch(__.count().limit(1).is(0))},
+{__.branch(__.count().is(0)), 
__.branch(__.limit(1).count().is(0))},
 {__.count().is(0).store("x"), 
__.limit(1).count().is(0).store("x")},
 {__.repeat(__.out()).until(__.outE().count().is(0)), 
__.repeat(__.out()).until(__.not(__.outE()))},
 {__.repeat(__.out()).emit(__.outE().count().is(0)), 
__.repeat(__.out()).emit(__.not(__.outE()))},