You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by fl...@apache.org on 2018/01/27 13:12:36 UTC
[01/50] [abbrv] tinkerpop git commit: Graph,
traversalStrategies and graph as Traversal properties [Forced Update!]
Repository: tinkerpop
Updated Branches:
refs/heads/TINKERPOP-1854 bcf31adcf -> b4586c710 (forced update)
Graph, traversalStrategies and graph as Traversal properties
Expose those properties as in the Python GLV and the Java implementation. Previously, those properties where exposed using the private notation (ie: _graph).
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6b3bd9d8
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6b3bd9d8
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6b3bd9d8
Branch: refs/heads/TINKERPOP-1854
Commit: 6b3bd9d89d56f549a1b2dd67c125264918fc56b9
Parents: 10c7155
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Oct 18 16:22:23 2016 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:14 2018 +0100
----------------------------------------------------------------------
.../GraphTraversalSourceGenerator.groovy | 23 +-
.../javascript/TraversalSourceGenerator.groovy | 12 +-
.../process/graph-traversal.js | 253 ++++++++++---------
.../gremlin-javascript/process/traversal.js | 12 +-
4 files changed, 151 insertions(+), 149 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6b3bd9d8/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
index b569292..a8217e2 100644
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
+++ b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
@@ -80,9 +80,9 @@ class GraphTraversalSourceGenerator {
* @constructor
*/
function GraphTraversalSource(graph, traversalStrategies, bytecode) {
- this._graph = graph;
- this._traversalStrategies = traversalStrategies;
- this._bytecode = bytecode || new Bytecode();
+ this.graph = graph;
+ this.traversalStrategies = traversalStrategies;
+ this.bytecode = bytecode || new Bytecode();
}
/**
@@ -90,9 +90,9 @@ class GraphTraversalSourceGenerator {
* @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withRemote = function (remoteConnection) {
- var traversalStrategy = new t.TraversalStrategies(this._traversalStrategies);
+ var traversalStrategy = new t.TraversalStrategies(this.traversalStrategies);
traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
- return new GraphTraversalSource(this._graph, traversalStrategy, new Bytecode(this._bytecode));
+ return new GraphTraversalSource(this.graph, traversalStrategy, new Bytecode(this.bytecode));
};
/**
@@ -100,7 +100,7 @@ class GraphTraversalSourceGenerator {
* @returns {string}
*/
GraphTraversalSource.prototype.toString = function () {
- return 'graphtraversalsource[' + this._graph.toString() + ']';
+ return 'graphtraversalsource[' + this.graph.toString() + ']';
};
""")
GraphTraversalSource.getMethods(). // SOURCE STEPS
@@ -122,8 +122,8 @@ class GraphTraversalSourceGenerator {
* @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.${method} = function (args) {
- var b = new Bytecode(this._bytecode).addSource('${SymbolHelper.toJava(method)}', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addSource('${SymbolHelper.toJava(method)}', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
""")
}
@@ -141,8 +141,8 @@ class GraphTraversalSourceGenerator {
* @returns {GraphTraversal}
*/
GraphTraversalSource.prototype.${method} = function (args) {
- var b = new Bytecode(this._bytecode).addStep('${SymbolHelper.toJava(method)}', parseArgs.apply(null, arguments));
- return new GraphTraversal(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addStep('${SymbolHelper.toJava(method)}', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
""")
}
@@ -153,6 +153,7 @@ class GraphTraversalSourceGenerator {
"""
/**
* Represents a graph traversal.
+ * @extends Traversal
* @constructor
*/
function GraphTraversal(graph, traversalStrategies, bytecode) {
@@ -175,7 +176,7 @@ class GraphTraversalSourceGenerator {
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.${method} = function (args) {
- this._bytecode.addStep('${SymbolHelper.toJava(method)}', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('${SymbolHelper.toJava(method)}', parseArgs.apply(null, arguments));
return this;
};
""")
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6b3bd9d8/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
index 5b07a32..46f65a4 100644
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
+++ b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
@@ -61,22 +61,22 @@ class TraversalSourceGenerator {
"use strict";
function Traversal(graph, traversalStrategies, bytecode) {
- this._graph = graph;
- this._traversalStrategies = traversalStrategies;
- this._bytecode = bytecode;
+ this.graph = graph;
+ this.traversalStrategies = traversalStrategies;
+ this.bytecode = bytecode;
this.traversers = null;
this.sideEffects = null;
}
/** @returns {Bytecode} */
Traversal.prototype.getBytecode = function () {
- return this._bytecode;
+ return this.bytecode;
};
/** @param {Function} callback */
Traversal.prototype.list = function (callback) {
var self = this;
- this._traversalStrategies.applyStrategies(this, function (err) {
+ this.traversalStrategies.applyStrategies(this, function (err) {
if (err) {
return callback(err);
}
@@ -96,7 +96,7 @@ class TraversalSourceGenerator {
* @returns {String}
*/
Traversal.prototype.toString = function () {
- return this._bytecode.toString();
+ return this.bytecode.toString();
};
""");
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6b3bd9d8/gremlin-javascript/src/main/javascript/gremlin-javascript/process/graph-traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/graph-traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/graph-traversal.js
index 1a6356b..663a24d 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/graph-traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/graph-traversal.js
@@ -37,9 +37,9 @@
* @constructor
*/
function GraphTraversalSource(graph, traversalStrategies, bytecode) {
- this._graph = graph;
- this._traversalStrategies = traversalStrategies;
- this._bytecode = bytecode || new Bytecode();
+ this.graph = graph;
+ this.traversalStrategies = traversalStrategies;
+ this.bytecode = bytecode || new Bytecode();
}
/**
@@ -47,9 +47,9 @@
* @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withRemote = function (remoteConnection) {
- var traversalStrategy = new t.TraversalStrategies(this._traversalStrategies);
+ var traversalStrategy = new t.TraversalStrategies(this.traversalStrategies);
traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
- return new GraphTraversalSource(this._graph, traversalStrategy, new Bytecode(this._bytecode));
+ return new GraphTraversalSource(this.graph, traversalStrategy, new Bytecode(this.bytecode));
};
/**
@@ -57,7 +57,7 @@
* @returns {string}
*/
GraphTraversalSource.prototype.toString = function () {
- return 'graphtraversalsource[' + this._graph.toString() + ']';
+ return 'graphtraversalsource[' + this.graph.toString() + ']';
};
/**
@@ -66,8 +66,8 @@
* @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withBulk = function (args) {
- var b = new Bytecode(this._bytecode).addSource('withBulk', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addSource('withBulk', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
@@ -76,8 +76,8 @@
* @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withComputer = function (args) {
- var b = new Bytecode(this._bytecode).addSource('withComputer', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addSource('withComputer', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
@@ -86,8 +86,8 @@
* @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withPath = function (args) {
- var b = new Bytecode(this._bytecode).addSource('withPath', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addSource('withPath', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
@@ -96,8 +96,8 @@
* @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withSack = function (args) {
- var b = new Bytecode(this._bytecode).addSource('withSack', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addSource('withSack', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
@@ -106,8 +106,8 @@
* @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withSideEffect = function (args) {
- var b = new Bytecode(this._bytecode).addSource('withSideEffect', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addSource('withSideEffect', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
@@ -116,8 +116,8 @@
* @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withStrategies = function (args) {
- var b = new Bytecode(this._bytecode).addSource('withStrategies', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addSource('withStrategies', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
@@ -126,8 +126,8 @@
* @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withoutStrategies = function (args) {
- var b = new Bytecode(this._bytecode).addSource('withoutStrategies', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addSource('withoutStrategies', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
@@ -136,8 +136,8 @@
* @returns {GraphTraversal}
*/
GraphTraversalSource.prototype.E = function (args) {
- var b = new Bytecode(this._bytecode).addStep('E', parseArgs.apply(null, arguments));
- return new GraphTraversal(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addStep('E', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
@@ -146,8 +146,8 @@
* @returns {GraphTraversal}
*/
GraphTraversalSource.prototype.V = function (args) {
- var b = new Bytecode(this._bytecode).addStep('V', parseArgs.apply(null, arguments));
- return new GraphTraversal(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addStep('V', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
@@ -156,8 +156,8 @@
* @returns {GraphTraversal}
*/
GraphTraversalSource.prototype.addV = function (args) {
- var b = new Bytecode(this._bytecode).addStep('addV', parseArgs.apply(null, arguments));
- return new GraphTraversal(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addStep('addV', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
@@ -166,12 +166,13 @@
* @returns {GraphTraversal}
*/
GraphTraversalSource.prototype.inject = function (args) {
- var b = new Bytecode(this._bytecode).addStep('inject', parseArgs.apply(null, arguments));
- return new GraphTraversal(this._graph, new t.TraversalStrategies(this._traversalStrategies), b);
+ var b = new Bytecode(this.bytecode).addStep('inject', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new t.TraversalStrategies(this.traversalStrategies), b);
};
/**
* Represents a graph traversal.
+ * @extends Traversal
* @constructor
*/
function GraphTraversal(graph, traversalStrategies, bytecode) {
@@ -185,7 +186,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.V = function (args) {
- this._bytecode.addStep('V', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('V', parseArgs.apply(null, arguments));
return this;
};
@@ -194,7 +195,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.addE = function (args) {
- this._bytecode.addStep('addE', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('addE', parseArgs.apply(null, arguments));
return this;
};
@@ -203,7 +204,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.addInE = function (args) {
- this._bytecode.addStep('addInE', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('addInE', parseArgs.apply(null, arguments));
return this;
};
@@ -212,7 +213,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.addOutE = function (args) {
- this._bytecode.addStep('addOutE', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('addOutE', parseArgs.apply(null, arguments));
return this;
};
@@ -221,7 +222,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.addV = function (args) {
- this._bytecode.addStep('addV', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('addV', parseArgs.apply(null, arguments));
return this;
};
@@ -230,7 +231,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.aggregate = function (args) {
- this._bytecode.addStep('aggregate', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('aggregate', parseArgs.apply(null, arguments));
return this;
};
@@ -239,7 +240,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.and = function (args) {
- this._bytecode.addStep('and', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('and', parseArgs.apply(null, arguments));
return this;
};
@@ -248,7 +249,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.as = function (args) {
- this._bytecode.addStep('as', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('as', parseArgs.apply(null, arguments));
return this;
};
@@ -257,7 +258,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.barrier = function (args) {
- this._bytecode.addStep('barrier', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('barrier', parseArgs.apply(null, arguments));
return this;
};
@@ -266,7 +267,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.both = function (args) {
- this._bytecode.addStep('both', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('both', parseArgs.apply(null, arguments));
return this;
};
@@ -275,7 +276,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.bothE = function (args) {
- this._bytecode.addStep('bothE', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('bothE', parseArgs.apply(null, arguments));
return this;
};
@@ -284,7 +285,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.bothV = function (args) {
- this._bytecode.addStep('bothV', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('bothV', parseArgs.apply(null, arguments));
return this;
};
@@ -293,7 +294,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.branch = function (args) {
- this._bytecode.addStep('branch', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('branch', parseArgs.apply(null, arguments));
return this;
};
@@ -302,7 +303,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.by = function (args) {
- this._bytecode.addStep('by', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('by', parseArgs.apply(null, arguments));
return this;
};
@@ -311,7 +312,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.cap = function (args) {
- this._bytecode.addStep('cap', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('cap', parseArgs.apply(null, arguments));
return this;
};
@@ -320,7 +321,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.choose = function (args) {
- this._bytecode.addStep('choose', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('choose', parseArgs.apply(null, arguments));
return this;
};
@@ -329,7 +330,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.coalesce = function (args) {
- this._bytecode.addStep('coalesce', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('coalesce', parseArgs.apply(null, arguments));
return this;
};
@@ -338,7 +339,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.coin = function (args) {
- this._bytecode.addStep('coin', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('coin', parseArgs.apply(null, arguments));
return this;
};
@@ -347,7 +348,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.constant = function (args) {
- this._bytecode.addStep('constant', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('constant', parseArgs.apply(null, arguments));
return this;
};
@@ -356,7 +357,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.count = function (args) {
- this._bytecode.addStep('count', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('count', parseArgs.apply(null, arguments));
return this;
};
@@ -365,7 +366,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.cyclicPath = function (args) {
- this._bytecode.addStep('cyclicPath', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('cyclicPath', parseArgs.apply(null, arguments));
return this;
};
@@ -374,7 +375,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.dedup = function (args) {
- this._bytecode.addStep('dedup', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('dedup', parseArgs.apply(null, arguments));
return this;
};
@@ -383,7 +384,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.drop = function (args) {
- this._bytecode.addStep('drop', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('drop', parseArgs.apply(null, arguments));
return this;
};
@@ -392,7 +393,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.emit = function (args) {
- this._bytecode.addStep('emit', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('emit', parseArgs.apply(null, arguments));
return this;
};
@@ -401,7 +402,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.filter = function (args) {
- this._bytecode.addStep('filter', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('filter', parseArgs.apply(null, arguments));
return this;
};
@@ -410,7 +411,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.flatMap = function (args) {
- this._bytecode.addStep('flatMap', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('flatMap', parseArgs.apply(null, arguments));
return this;
};
@@ -419,7 +420,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.fold = function (args) {
- this._bytecode.addStep('fold', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('fold', parseArgs.apply(null, arguments));
return this;
};
@@ -428,7 +429,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.from_ = function (args) {
- this._bytecode.addStep('from', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('from', parseArgs.apply(null, arguments));
return this;
};
@@ -437,7 +438,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.group = function (args) {
- this._bytecode.addStep('group', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('group', parseArgs.apply(null, arguments));
return this;
};
@@ -446,7 +447,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.groupCount = function (args) {
- this._bytecode.addStep('groupCount', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('groupCount', parseArgs.apply(null, arguments));
return this;
};
@@ -455,7 +456,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.groupV3d0 = function (args) {
- this._bytecode.addStep('groupV3d0', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('groupV3d0', parseArgs.apply(null, arguments));
return this;
};
@@ -464,7 +465,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.has = function (args) {
- this._bytecode.addStep('has', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('has', parseArgs.apply(null, arguments));
return this;
};
@@ -473,7 +474,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.hasId = function (args) {
- this._bytecode.addStep('hasId', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('hasId', parseArgs.apply(null, arguments));
return this;
};
@@ -482,7 +483,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.hasKey = function (args) {
- this._bytecode.addStep('hasKey', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('hasKey', parseArgs.apply(null, arguments));
return this;
};
@@ -491,7 +492,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.hasLabel = function (args) {
- this._bytecode.addStep('hasLabel', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('hasLabel', parseArgs.apply(null, arguments));
return this;
};
@@ -500,7 +501,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.hasNot = function (args) {
- this._bytecode.addStep('hasNot', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('hasNot', parseArgs.apply(null, arguments));
return this;
};
@@ -509,7 +510,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.hasValue = function (args) {
- this._bytecode.addStep('hasValue', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('hasValue', parseArgs.apply(null, arguments));
return this;
};
@@ -518,7 +519,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.id = function (args) {
- this._bytecode.addStep('id', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('id', parseArgs.apply(null, arguments));
return this;
};
@@ -527,7 +528,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.identity = function (args) {
- this._bytecode.addStep('identity', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('identity', parseArgs.apply(null, arguments));
return this;
};
@@ -536,7 +537,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.inE = function (args) {
- this._bytecode.addStep('inE', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('inE', parseArgs.apply(null, arguments));
return this;
};
@@ -545,7 +546,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.inV = function (args) {
- this._bytecode.addStep('inV', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('inV', parseArgs.apply(null, arguments));
return this;
};
@@ -554,7 +555,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.in_ = function (args) {
- this._bytecode.addStep('in', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('in', parseArgs.apply(null, arguments));
return this;
};
@@ -563,7 +564,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.inject = function (args) {
- this._bytecode.addStep('inject', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('inject', parseArgs.apply(null, arguments));
return this;
};
@@ -572,7 +573,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.is = function (args) {
- this._bytecode.addStep('is', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('is', parseArgs.apply(null, arguments));
return this;
};
@@ -581,7 +582,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.key = function (args) {
- this._bytecode.addStep('key', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('key', parseArgs.apply(null, arguments));
return this;
};
@@ -590,7 +591,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.label = function (args) {
- this._bytecode.addStep('label', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('label', parseArgs.apply(null, arguments));
return this;
};
@@ -599,7 +600,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.limit = function (args) {
- this._bytecode.addStep('limit', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('limit', parseArgs.apply(null, arguments));
return this;
};
@@ -608,7 +609,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.local = function (args) {
- this._bytecode.addStep('local', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('local', parseArgs.apply(null, arguments));
return this;
};
@@ -617,7 +618,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.loops = function (args) {
- this._bytecode.addStep('loops', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('loops', parseArgs.apply(null, arguments));
return this;
};
@@ -626,7 +627,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.map = function (args) {
- this._bytecode.addStep('map', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('map', parseArgs.apply(null, arguments));
return this;
};
@@ -635,7 +636,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.mapKeys = function (args) {
- this._bytecode.addStep('mapKeys', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('mapKeys', parseArgs.apply(null, arguments));
return this;
};
@@ -644,7 +645,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.mapValues = function (args) {
- this._bytecode.addStep('mapValues', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('mapValues', parseArgs.apply(null, arguments));
return this;
};
@@ -653,7 +654,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.match = function (args) {
- this._bytecode.addStep('match', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('match', parseArgs.apply(null, arguments));
return this;
};
@@ -662,7 +663,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.max = function (args) {
- this._bytecode.addStep('max', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('max', parseArgs.apply(null, arguments));
return this;
};
@@ -671,7 +672,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.mean = function (args) {
- this._bytecode.addStep('mean', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('mean', parseArgs.apply(null, arguments));
return this;
};
@@ -680,7 +681,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.min = function (args) {
- this._bytecode.addStep('min', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('min', parseArgs.apply(null, arguments));
return this;
};
@@ -689,7 +690,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.not = function (args) {
- this._bytecode.addStep('not', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('not', parseArgs.apply(null, arguments));
return this;
};
@@ -698,7 +699,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.option = function (args) {
- this._bytecode.addStep('option', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('option', parseArgs.apply(null, arguments));
return this;
};
@@ -707,7 +708,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.optional = function (args) {
- this._bytecode.addStep('optional', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('optional', parseArgs.apply(null, arguments));
return this;
};
@@ -716,7 +717,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.or = function (args) {
- this._bytecode.addStep('or', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('or', parseArgs.apply(null, arguments));
return this;
};
@@ -725,7 +726,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.order = function (args) {
- this._bytecode.addStep('order', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('order', parseArgs.apply(null, arguments));
return this;
};
@@ -734,7 +735,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.otherV = function (args) {
- this._bytecode.addStep('otherV', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('otherV', parseArgs.apply(null, arguments));
return this;
};
@@ -743,7 +744,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.out = function (args) {
- this._bytecode.addStep('out', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('out', parseArgs.apply(null, arguments));
return this;
};
@@ -752,7 +753,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.outE = function (args) {
- this._bytecode.addStep('outE', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('outE', parseArgs.apply(null, arguments));
return this;
};
@@ -761,7 +762,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.outV = function (args) {
- this._bytecode.addStep('outV', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('outV', parseArgs.apply(null, arguments));
return this;
};
@@ -770,7 +771,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.pageRank = function (args) {
- this._bytecode.addStep('pageRank', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('pageRank', parseArgs.apply(null, arguments));
return this;
};
@@ -779,7 +780,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.path = function (args) {
- this._bytecode.addStep('path', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('path', parseArgs.apply(null, arguments));
return this;
};
@@ -788,7 +789,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.peerPressure = function (args) {
- this._bytecode.addStep('peerPressure', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('peerPressure', parseArgs.apply(null, arguments));
return this;
};
@@ -797,7 +798,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.profile = function (args) {
- this._bytecode.addStep('profile', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('profile', parseArgs.apply(null, arguments));
return this;
};
@@ -806,7 +807,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.program = function (args) {
- this._bytecode.addStep('program', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('program', parseArgs.apply(null, arguments));
return this;
};
@@ -815,7 +816,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.project = function (args) {
- this._bytecode.addStep('project', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('project', parseArgs.apply(null, arguments));
return this;
};
@@ -824,7 +825,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.properties = function (args) {
- this._bytecode.addStep('properties', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('properties', parseArgs.apply(null, arguments));
return this;
};
@@ -833,7 +834,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.property = function (args) {
- this._bytecode.addStep('property', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('property', parseArgs.apply(null, arguments));
return this;
};
@@ -842,7 +843,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.propertyMap = function (args) {
- this._bytecode.addStep('propertyMap', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('propertyMap', parseArgs.apply(null, arguments));
return this;
};
@@ -851,7 +852,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.range = function (args) {
- this._bytecode.addStep('range', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('range', parseArgs.apply(null, arguments));
return this;
};
@@ -860,7 +861,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.repeat = function (args) {
- this._bytecode.addStep('repeat', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('repeat', parseArgs.apply(null, arguments));
return this;
};
@@ -869,7 +870,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.sack = function (args) {
- this._bytecode.addStep('sack', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('sack', parseArgs.apply(null, arguments));
return this;
};
@@ -878,7 +879,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.sample = function (args) {
- this._bytecode.addStep('sample', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('sample', parseArgs.apply(null, arguments));
return this;
};
@@ -887,7 +888,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.select = function (args) {
- this._bytecode.addStep('select', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('select', parseArgs.apply(null, arguments));
return this;
};
@@ -896,7 +897,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.sideEffect = function (args) {
- this._bytecode.addStep('sideEffect', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('sideEffect', parseArgs.apply(null, arguments));
return this;
};
@@ -905,7 +906,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.simplePath = function (args) {
- this._bytecode.addStep('simplePath', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('simplePath', parseArgs.apply(null, arguments));
return this;
};
@@ -914,7 +915,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.store = function (args) {
- this._bytecode.addStep('store', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('store', parseArgs.apply(null, arguments));
return this;
};
@@ -923,7 +924,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.subgraph = function (args) {
- this._bytecode.addStep('subgraph', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('subgraph', parseArgs.apply(null, arguments));
return this;
};
@@ -932,7 +933,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.sum = function (args) {
- this._bytecode.addStep('sum', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('sum', parseArgs.apply(null, arguments));
return this;
};
@@ -941,7 +942,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.tail = function (args) {
- this._bytecode.addStep('tail', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('tail', parseArgs.apply(null, arguments));
return this;
};
@@ -950,7 +951,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.timeLimit = function (args) {
- this._bytecode.addStep('timeLimit', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('timeLimit', parseArgs.apply(null, arguments));
return this;
};
@@ -959,7 +960,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.times = function (args) {
- this._bytecode.addStep('times', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('times', parseArgs.apply(null, arguments));
return this;
};
@@ -968,7 +969,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.to = function (args) {
- this._bytecode.addStep('to', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('to', parseArgs.apply(null, arguments));
return this;
};
@@ -977,7 +978,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.toE = function (args) {
- this._bytecode.addStep('toE', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('toE', parseArgs.apply(null, arguments));
return this;
};
@@ -986,7 +987,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.toV = function (args) {
- this._bytecode.addStep('toV', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('toV', parseArgs.apply(null, arguments));
return this;
};
@@ -995,7 +996,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.tree = function (args) {
- this._bytecode.addStep('tree', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('tree', parseArgs.apply(null, arguments));
return this;
};
@@ -1004,7 +1005,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.unfold = function (args) {
- this._bytecode.addStep('unfold', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('unfold', parseArgs.apply(null, arguments));
return this;
};
@@ -1013,7 +1014,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.union = function (args) {
- this._bytecode.addStep('union', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('union', parseArgs.apply(null, arguments));
return this;
};
@@ -1022,7 +1023,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.until = function (args) {
- this._bytecode.addStep('until', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('until', parseArgs.apply(null, arguments));
return this;
};
@@ -1031,7 +1032,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.value = function (args) {
- this._bytecode.addStep('value', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('value', parseArgs.apply(null, arguments));
return this;
};
@@ -1040,7 +1041,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.valueMap = function (args) {
- this._bytecode.addStep('valueMap', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('valueMap', parseArgs.apply(null, arguments));
return this;
};
@@ -1049,7 +1050,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.values = function (args) {
- this._bytecode.addStep('values', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('values', parseArgs.apply(null, arguments));
return this;
};
@@ -1058,7 +1059,7 @@
* @returns {GraphTraversal}
*/
GraphTraversal.prototype.where = function (args) {
- this._bytecode.addStep('where', parseArgs.apply(null, arguments));
+ this.bytecode.addStep('where', parseArgs.apply(null, arguments));
return this;
};
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6b3bd9d8/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
index ff2927e..a7a9bb7 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
@@ -24,22 +24,22 @@
"use strict";
function Traversal(graph, traversalStrategies, bytecode) {
- this._graph = graph;
- this._traversalStrategies = traversalStrategies;
- this._bytecode = bytecode;
+ this.graph = graph;
+ this.traversalStrategies = traversalStrategies;
+ this.bytecode = bytecode;
this.traversers = null;
this.sideEffects = null;
}
/** @returns {Bytecode} */
Traversal.prototype.getBytecode = function () {
- return this._bytecode;
+ return this.bytecode;
};
/** @param {Function} callback */
Traversal.prototype.list = function (callback) {
var self = this;
- this._traversalStrategies.applyStrategies(this, function (err) {
+ this.traversalStrategies.applyStrategies(this, function (err) {
if (err) {
return callback(err);
}
@@ -59,7 +59,7 @@
* @returns {String}
*/
Traversal.prototype.toString = function () {
- return this._bytecode.toString();
+ return this.bytecode.toString();
};
/**
[30/50] [abbrv] tinkerpop git commit: Adjust pom.xml to be forward
compatible
Posted by fl...@apache.org.
Adjust pom.xml to be forward compatible
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/843a727d
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/843a727d
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/843a727d
Branch: refs/heads/TINKERPOP-1854
Commit: 843a727d255f33720df029a89ad701e3f18eae25
Parents: d458f76
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 30 16:05:10 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:17 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/pom.xml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/843a727d/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index 830052b..aa219ab 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -150,7 +150,8 @@ def binding = ["enums": CoreImports.getClassImports()
findAll { GraphTraversalSource.class.equals(it.returnType) }.
findAll {
!it.name.equals("clone") &&
- !it.name.equals(TraversalSource.Symbols.withBindings) &&
+ // Use hardcoded name to be for forward-compatibility
+ !it.name.equals("withBindings") &&
!it.name.equals(TraversalSource.Symbols.withRemote) &&
!it.name.equals(TraversalSource.Symbols.withComputer)
}.
@@ -223,6 +224,10 @@ packageJsonFile.newWriter().withWriter{ it << packageJsonTemplate }
<name>executionName</name>
<value>${project.name}</value>
</property>
+ <property>
+ <name>projectBaseDir</name>
+ <value>${project.basedir}</value>
+ </property>
</properties>
<scripts>
<script>${gremlin.server.dir}/src/test/scripts/test-server-start.groovy</script>
[43/50] [abbrv] tinkerpop git commit: Updated changelog CTR
Posted by fl...@apache.org.
Updated changelog CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3e6e08a9
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3e6e08a9
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3e6e08a9
Branch: refs/heads/TINKERPOP-1854
Commit: 3e6e08a9fb55f5e3ab557a807e8665a47ecfb483
Parents: 4d67feb
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jan 23 08:37:38 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jan 23 08:37:38 2018 -0500
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e6e08a9/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 42574d3..1fd0311 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
* Delayed setting of the request identifier until `RequestMessage` construction by the builder.
* Removed hardcoded expectation in metrics serialization test suite as different providers may have different outputs.
+* Added `VertexTraverserSet` which indexes on a `Vertex` thus improving performance in `VertexProgram` implementations.
* Fixed a bug in `ComputerAwareStep` that didn't handle `reset()` properly and thus occasionally produced some extra traversers.
[[release-3-2-7]]
[11/50] [abbrv] tinkerpop git commit: Bump to 3.2.6 in
gremlin-javascript
Posted by fl...@apache.org.
Bump to 3.2.6 in gremlin-javascript
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f5c90496
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f5c90496
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f5c90496
Branch: refs/heads/TINKERPOP-1854
Commit: f5c904969ff0f14129f9bbc0e6402f35ebf77fcf
Parents: 2b4e8e3
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Aug 17 13:35:47 2017 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:15 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/pom.xml | 2 +-
.../src/main/javascript/gremlin-javascript/package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f5c90496/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index 1c9ffcc..452e183 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkerpop</artifactId>
- <version>3.2.5-SNAPSHOT</version>
+ <version>3.2.6-SNAPSHOT</version>
</parent>
<artifactId>gremlin-javascript</artifactId>
<name>Apache TinkerPop :: Gremlin Javascript</name>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f5c90496/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index 0976f31..db6d3fe 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -1,6 +1,6 @@
{
"name": "gremlin-javascript",
- "version": "3.2.5-alpha1",
+ "version": "3.2.6-alpha1",
"description": "JavaScript Gremlin Language Variant",
"author": "Apache TinkerPop team",
"keywords": [
[27/50] [abbrv] tinkerpop git commit: Use ES6 syntax
Posted by fl...@apache.org.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
index d887fe0..2877f02 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
@@ -26,202 +26,209 @@ const utils = require('../utils');
const parseArgs = utils.parseArgs;
const itemDone = Object.freeze({ value: null, done: true });
-function Traversal(graph, traversalStrategies, bytecode) {
- this.graph = graph;
- this.traversalStrategies = traversalStrategies;
- this.bytecode = bytecode;
- /** @type {Array<Traverser>} */
- this.traversers = null;
- this.sideEffects = null;
- this._traversalStrategiesPromise = null;
- this._traversersIteratorIndex = 0;
-}
+class Traversal {
+ constructor(graph, traversalStrategies, bytecode) {
+ this.graph = graph;
+ this.traversalStrategies = traversalStrategies;
+ this.bytecode = bytecode;
+ /** @type {Array<Traverser>} */
+ this.traversers = null;
+ this.sideEffects = null;
+ this._traversalStrategiesPromise = null;
+ this._traversersIteratorIndex = 0;
+ }
-/** @returns {Bytecode} */
-Traversal.prototype.getBytecode = function () {
- return this.bytecode;
-};
+ /** @returns {Bytecode} */
+ getBytecode() {
+ return this.bytecode;
+ }
-/**
- * Returns an Array containing the traverser objects.
- * @returns {Promise.<Array>}
- */
-Traversal.prototype.toList = function () {
- return this._applyStrategies().then(() => {
- const result = [];
- let it;
- while ((it = this._getNext()) && !it.done) {
- result.push(it.value);
+ /**
+ * Returns an Array containing the traverser objects.
+ * @returns {Promise.<Array>}
+ */
+ toList() {
+ return this._applyStrategies().then(() => {
+ const result = [];
+ let it;
+ while ((it = this._getNext()) && !it.done) {
+ result.push(it.value);
+ }
+ return result;
+ });
+ };
+
+ /**
+ * Iterates all Traverser instances in the traversal.
+ * @returns {Promise}
+ */
+ iterate() {
+ return this._applyStrategies().then(() => {
+ let it;
+ while ((it = this._getNext()) && !it.done) {
+ }
+ });
+ }
+
+ /**
+ * Async iterator method implementation.
+ * Returns a promise containing an iterator item.
+ * @returns {Promise.<{value, done}>}
+ */
+ next() {
+ return this._applyStrategies().then(() => this._getNext());
+ }
+
+ /**
+ * Synchronous iterator of traversers including
+ * @private
+ */
+ _getNext() {
+ while (this.traversers && this._traversersIteratorIndex < this.traversers.length) {
+ let traverser = this.traversers[this._traversersIteratorIndex];
+ if (traverser.bulk > 0) {
+ traverser.bulk--;
+ return { value: traverser.object, done: false };
+ }
+ this._traversersIteratorIndex++;
}
- return result;
- });
-};
+ return itemDone;
+ }
-/**
- * Iterates all Traverser instances in the traversal.
- * @returns {Promise}
- */
-Traversal.prototype.iterate = function () {
- return this._applyStrategies().then(() => {
- let it;
- while ((it = this._getNext()) && !it.done) {
+ _applyStrategies() {
+ if (this._traversalStrategiesPromise) {
+ // Apply strategies only once
+ return this._traversalStrategiesPromise;
}
- });
-};
+ return this._traversalStrategiesPromise = this.traversalStrategies.applyStrategies(this);
+ }
-/**
- * Async iterator method implementation.
- * Returns a promise containing an iterator item.
- * @returns {Promise.<{value, done}>}
- */
-Traversal.prototype.next = function () {
- return this._applyStrategies().then(() => this._getNext());
-};
+ /**
+ * Returns the Bytecode JSON representation of the traversal
+ * @returns {String}
+ */
+ toString() {
+ return this.bytecode.toString();
+ };
+}
-/**
- * Synchronous iterator of traversers including
- * @private
- */
-Traversal.prototype._getNext = function () {
- while (this.traversers && this._traversersIteratorIndex < this.traversers.length) {
- let traverser = this.traversers[this._traversersIteratorIndex];
- if (traverser.bulk > 0) {
- traverser.bulk--;
- return { value: traverser.object, done: false };
+class P {
+ /**
+ * Represents an operation.
+ * @constructor
+ */
+ constructor(operator, value, other) {
+ this.operator = operator;
+ this.value = value;
+ this.other = other;
+ }
+
+ /**
+ * Returns the string representation of the instance.
+ * @returns {string}
+ */
+ toString() {
+ if (this.other === undefined) {
+ return this.operator + '(' + this.value + ')';
}
- this._traversersIteratorIndex++;
+ return this.operator + '(' + this.value + ', ' + this.other + ')';
}
- return itemDone;
-};
-Traversal.prototype._applyStrategies = function () {
- if (this._traversalStrategiesPromise) {
- // Apply strategies only once
- return this._traversalStrategiesPromise;
+ and(arg) {
+ return new P('and', this, arg);
}
- return this._traversalStrategiesPromise = this.traversalStrategies.applyStrategies(this);
-};
-/**
- * Returns the Bytecode JSON representation of the traversal
- * @returns {String}
- */
-Traversal.prototype.toString = function () {
- return this.bytecode.toString();
-};
+ or(arg) {
+ return new P('or', this, arg);
+ }
-/**
- * Represents an operation.
- * @constructor
- */
-function P(operator, value, other) {
- this.operator = operator;
- this.value = value;
- this.other = other;
-}
+ /** @param {...Object} args */
+ static between(args) {
+ return createP('between', parseArgs.apply(null, arguments));
+ }
-/**
- * Returns the string representation of the instance.
- * @returns {string}
- */
-P.prototype.toString = function () {
- if (this.other === undefined) {
- return this.operator + '(' + this.value + ')';
+ /** @param {...Object} args */
+ static eq(args) {
+ return createP('eq', parseArgs.apply(null, arguments));
+ }
+
+ /** @param {...Object} args */
+ static gt(args) {
+ return createP('gt', parseArgs.apply(null, arguments));
+ }
+
+ /** @param {...Object} args */
+ static gte(args) {
+ return createP('gte', parseArgs.apply(null, arguments));
+ }
+
+ /** @param {...Object} args */
+ static inside(args) {
+ return createP('inside', parseArgs.apply(null, arguments));
+ }
+
+ /** @param {...Object} args */
+ static lt(args) {
+ return createP('lt', parseArgs.apply(null, arguments));
+ }
+
+ /** @param {...Object} args */
+ static lte(args) {
+ return createP('lte', parseArgs.apply(null, arguments));
+ }
+
+ /** @param {...Object} args */
+ static neq(args) {
+ return createP('neq', parseArgs.apply(null, arguments));
}
- return this.operator + '(' + this.value + ', ' + this.other + ')';
-};
+
+ /** @param {...Object} args */
+ static not(args) {
+ return createP('not', parseArgs.apply(null, arguments));
+ }
+
+ /** @param {...Object} args */
+ static outside(args) {
+ return createP('outside', parseArgs.apply(null, arguments));
+ }
+
+ /** @param {...Object} args */
+ static test(args) {
+ return createP('test', parseArgs.apply(null, arguments));
+ }
+
+ /** @param {...Object} args */
+ static within(args) {
+ return createP('within', parseArgs.apply(null, arguments));
+ }
+
+ /** @param {...Object} args */
+ static without(args) {
+ return createP('without', parseArgs.apply(null, arguments));
+ }
+
+}
function createP(operator, args) {
args.unshift(null, operator);
return new (Function.prototype.bind.apply(P, args));
}
-/** @param {...Object} args */
-P.between = function (args) {
- return createP('between', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.eq = function (args) {
- return createP('eq', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.gt = function (args) {
- return createP('gt', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.gte = function (args) {
- return createP('gte', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.inside = function (args) {
- return createP('inside', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.lt = function (args) {
- return createP('lt', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.lte = function (args) {
- return createP('lte', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.neq = function (args) {
- return createP('neq', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.not = function (args) {
- return createP('not', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.outside = function (args) {
- return createP('outside', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.test = function (args) {
- return createP('test', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.within = function (args) {
- return createP('within', parseArgs.apply(null, arguments));
-};
-
-/** @param {...Object} args */
-P.without = function (args) {
- return createP('without', parseArgs.apply(null, arguments));
-};
-
-P.prototype.and = function (arg) {
- return new P('and', this, arg);
-};
-
-P.prototype.or = function (arg) {
- return new P('or', this, arg);
-};
-
-function Traverser(object, bulk) {
- this.object = object;
- this.bulk = bulk || 1;
+class Traverser {
+ constructor(object, bulk) {
+ this.object = object;
+ this.bulk = bulk || 1;
+ }
}
-function TraversalSideEffects() {
+class TraversalSideEffects {
}
function toEnum(typeName, keys) {
- var result = {};
- keys.split(' ').forEach(function (k) {
- var jsKey = k;
+ const result = {};
+ keys.split(' ').forEach(k => {
+ let jsKey = k;
if (jsKey === jsKey.toUpperCase()) {
jsKey = jsKey.toLowerCase();
}
@@ -230,17 +237,19 @@ function toEnum(typeName, keys) {
return result;
}
-function EnumValue(typeName, elementName) {
- this.typeName = typeName;
- this.elementName = elementName;
+class EnumValue {
+ constructor(typeName, elementName) {
+ this.typeName = typeName;
+ this.elementName = elementName;
+ }
}
module.exports = {
- EnumValue: EnumValue,
- P: P,
- Traversal: Traversal,
- TraversalSideEffects: TraversalSideEffects,
- Traverser: Traverser,
+ EnumValue,
+ P,
+ Traversal,
+ TraversalSideEffects,
+ Traverser,
barrier: toEnum('Barrier', 'normSack'),
cardinality: toEnum('Cardinality', 'list set single'),
column: toEnum('Column', 'keys values'),
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
index cbb7e2c..2861a50 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
@@ -22,120 +22,120 @@
*/
'use strict';
-var gt = require('../process/graph-traversal');
-var TraversalStrategies = require('../process/traversal-strategy').TraversalStrategies;
-var utils = require('../utils');
-var inherits = utils.inherits;
-
-function Graph() {
+const gt = require('../process/graph-traversal');
+const TraversalStrategies = require('../process/traversal-strategy').TraversalStrategies;
+
+class Graph {
+ /**
+ * Returns the graph traversal source.
+ * @returns {GraphTraversalSource}
+ */
+ traversal() {
+ return new gt.GraphTraversalSource(this, new TraversalStrategies());
+ }
+ toString() {
+ return 'graph[empty]';
+ }
}
-/**
- * Returns the graph traversal source.
- * @returns {GraphTraversalSource}
- */
-Graph.prototype.traversal = function () {
- return new gt.GraphTraversalSource(this, new TraversalStrategies());
-};
-
-Graph.prototype.toString = function () {
- return 'graph[empty]';
-};
+class Element {
+ constructor(id, label) {
+ this.id = id;
+ this.label = label;
+ }
-function Element(id, label) {
- this.id = id;
- this.label = label;
+ /**
+ * Compares this instance to another and determines if they can be considered as equal.
+ * @param {Element} other
+ * @returns {boolean}
+ */
+ equals(other) {
+ return (other instanceof Element) && this.id === other.id;
+ }
}
-/**
- * Compares this instance to another and determines if they can be considered as equal.
- * @param {Element} other
- * @returns {boolean}
- */
-Element.prototype.equals = function (other) {
- return (other instanceof Element) && this.id === other.id;
-};
+class Vertex extends Element {
+ constructor(id, label, properties) {
+ super(id, label);
+ this.properties = properties;
+ }
-function Vertex(id, label, properties) {
- Element.call(this, id, label);
- this.properties = properties;
+ toString() {
+ return 'v[' + this.id + ']';
+ }
}
-Vertex.prototype.toString = function () {
- return 'v[' + this.id + ']';
-};
-
-inherits(Vertex, Element);
-
-function Edge(id, outV, label, inV, properties) {
- Element.call(this, id, label);
- this.outV = outV;
- this.inV = inV;
- this.properties = {};
- (function adaptProperties(self) {
+class Edge extends Element {
+ constructor(id, outV, label, inV, properties) {
+ super(id, label);
+ this.outV = outV;
+ this.inV = inV;
+ this.properties = {};
if (properties) {
- var keys = Object.keys(properties);
- for (var i = 0; i < keys.length; i++) {
- var k = keys[i];
- self.properties[k] = properties[k].value;
+ const keys = Object.keys(properties);
+ for (let i = 0; i < keys.length; i++) {
+ const k = keys[i];
+ this.properties[k] = properties[k].value;
}
}
- })(this);
-}
-
-inherits(Edge, Element);
-
-Edge.prototype.toString = function () {
- return 'e[' + this.id + '][' + this.outV.id + '-' + this.label + '->' + this.inV.id + ']';
-};
+ }
-function VertexProperty(id, label, value, properties) {
- Element.call(this, id, label);
- this.value = value;
- this.key = this.label;
- this.properties = properties;
+ toString() {
+ return 'e[' + this.id + '][' + this.outV.id + '-' + this.label + '->' + this.inV.id + ']';
+ }
}
-inherits(VertexProperty, Element);
-
-VertexProperty.prototype.toString = function () {
- return 'vp[' + this.label + '->' + this.value.substr(0, 20) + ']';
-};
+class VertexProperty extends Element {
+ constructor(id, label, value, properties) {
+ super(id, label);
+ this.value = value;
+ this.key = this.label;
+ this.properties = properties;
+ }
-function Property(key, value) {
- this.key = key;
- this.value = value;
+ toString() {
+ return 'vp[' + this.label + '->' + this.value.substr(0, 20) + ']';
+ }
}
-Property.prototype.toString = function () {
- return 'p[' + this.key + '->' + this.value.substr(0, 20) + ']';
-};
+class Property {
+ constructor(key, value) {
+ this.key = key;
+ this.value = value;
+ }
-Property.prototype.equals = function (other) {
- return (other instanceof Property) && this.key === other.key && this.value === other.value;
-};
+ toString() {
+ return 'p[' + this.key + '->' + this.value.substr(0, 20) + ']';
+ }
-/**
- * Represents a walk through a graph as defined by a traversal.
- * @param {Array} labels
- * @param {Array} objects
- * @constructor
- */
-function Path(labels, objects) {
- this.labels = labels;
- this.objects = objects;
+ equals(other) {
+ return (other instanceof Property) && this.key === other.key && this.value === other.value;
+ }
}
-Path.prototype.equals = function (other) {
- if (!(other instanceof Path)) {
- return false;
+class Path {
+ /**
+ * Represents a walk through a graph as defined by a traversal.
+ * @param {Array} labels
+ * @param {Array} objects
+ * @constructor
+ */
+ constructor(labels, objects) {
+ this.labels = labels;
+ this.objects = objects;
}
- if (other === this) {
- return true;
+
+ equals(other) {
+ if (!(other instanceof Path)) {
+ return false;
+ }
+ if (other === this) {
+ return true;
+ }
+ return areEqual(this.objects, other.objects) && areEqual(this.labels, other.labels);
}
- return areEqual(this.objects, other.objects) && areEqual(this.labels, other.labels);
-};
+}
function areEqual(obj1, obj2) {
if (obj1 === obj2) {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
index 8e4ad5e..3dbd340 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
@@ -22,430 +22,159 @@
*/
'use strict';
-var t = require('../../process/traversal');
-var Bytecode = require('../../process/bytecode');
-var g = require('../graph');
-var utils = require('../../utils');
-
-/**
- * A type serializer
- * @typedef {Object} Serializer
- * @property {Function} serialize
- * @property {Function} deserialize
- * @property {Function} [canBeUsedFor]
- */
-
-/**
- * @const
- * @private
- */
-var valueKey = '@value';
-
-/**
- * @const
- * @private
- */
-var typeKey = '@type';
-
-var deserializers = {
- 'g:Traverser': TraverserSerializer,
- 'g:Int32': NumberSerializer,
- 'g:Int64': NumberSerializer,
- 'g:Float': NumberSerializer,
- 'g:Double': NumberSerializer,
- 'g:Vertex': VertexSerializer,
- 'g:Edge': EdgeSerializer,
- 'g:VertexProperty': VertexPropertySerializer,
- 'g:Property': PropertySerializer,
- 'g:Path': PathSerializer
-};
-
-var serializers = [
- NumberSerializer,
- BytecodeSerializer,
- TraverserSerializer,
- PSerializer,
- LambdaSerializer,
- EnumSerializer,
- VertexSerializer,
- EdgeSerializer,
- LongSerializer
-];
+const typeSerializers = require('./type-serializers');
/**
* GraphSON Writer
- * @param {Object} [options]
- * @param {Object} options.serializers An object used as an associative array with GraphSON 2 type name as keys and
- * serializer instances as values, ie: { 'g:Int64': longSerializer }.
- * @constructor
- */
-function GraphSONWriter(options) {
- this._options = options || {};
- // Create instance of the default serializers
- this._serializers = serializers.map(function (serializerConstructor) {
- var s = new serializerConstructor();
- s.writer = this;
- return s;
- }, this);
- var customSerializers = this._options.serializers || {};
- Object.keys(customSerializers).forEach(function (key) {
- var s = customSerializers[key];
- if (!s.serialize) {
- return;
- }
- s.writer = this;
- // Insert custom serializers first
- this._serializers.unshift(s);
- }, this);
-}
-
-GraphSONWriter.prototype.adaptObject = function (value) {
- var s;
- if (Array.isArray(value)) {
- return value.map(function (item) {
- return this.adaptObject(item);
- }, this);
- }
- for (var i = 0; i < this._serializers.length; i++) {
- var currentSerializer = this._serializers[i];
- if (currentSerializer.canBeUsedFor && currentSerializer.canBeUsedFor(value)) {
- s = currentSerializer;
- break;
- }
- }
- if (s) {
- return s.serialize(value);
- }
- // Default (strings / objects / ...)
- return value;
-};
-
-/**
- * Returns the GraphSON representation of the provided object instance.
- * @param {Object} obj
- * @returns {String}
*/
-GraphSONWriter.prototype.write = function (obj) {
- return JSON.stringify(this.adaptObject(obj));
-};
-
-/**
- * GraphSON Reader
- * @param {Object} [options]
- * @param {Object} [options.serializers] An object used as an associative array with GraphSON 2 type name as keys and
- * deserializer instances as values, ie: { 'g:Int64': longSerializer }.
- * @constructor
- */
-function GraphSONReader(options) {
- this._options = options || {};
- this._deserializers = {};
- Object.keys(deserializers).forEach(function (typeName) {
- var serializerConstructor = deserializers[typeName];
- var s = new serializerConstructor();
- s.reader = this;
- this._deserializers[typeName] = s;
- }, this);
- if (this._options.serializers) {
- var customSerializers = this._options.serializers || {};
- Object.keys(customSerializers).forEach(function (key) {
- var s = customSerializers[key];
- if (!s.deserialize) {
+class GraphSONWriter {
+ /**
+ * @param {Object} [options]
+ * @param {Object} options.serializers An object used as an associative array with GraphSON 2 type name as keys and
+ * serializer instances as values, ie: { 'g:Int64': longSerializer }.
+ * @constructor
+ */
+ constructor(options) {
+ this._options = options || {};
+ // Create instance of the default serializers
+ this._serializers = serializers.map(serializerConstructor => {
+ const s = new serializerConstructor();
+ s.writer = this;
+ return s;
+ });
+ const customSerializers = this._options.serializers || {};
+ Object.keys(customSerializers).forEach(key => {
+ const s = customSerializers[key];
+ if (!s.serialize) {
return;
}
- s.reader = this;
- this._deserializers[key] = s;
- }, this);
+ s.writer = this;
+ // Insert custom serializers first
+ this._serializers.unshift(s);
+ });
}
-}
-GraphSONReader.prototype.read = function (obj) {
- if (obj === undefined) {
- return undefined;
- }
- if (obj === null) {
- return null;
- }
- if (Array.isArray(obj)) {
- return obj.map(function mapEach(item) {
- return this.read(item);
- }, this);
- }
- var type = obj[typeKey];
- if (type) {
- var d = this._deserializers[type];
- if (d) {
- // Use type serializer
- return d.deserialize(obj);
+ adaptObject(value) {
+ let s;
+ if (Array.isArray(value)) {
+ return value.map(item => this.adaptObject(item));
}
- return obj[valueKey];
- }
- if (obj && typeof obj === 'object' && obj.constructor === Object) {
- return this._deserializeObject(obj);
+ for (let i = 0; i < this._serializers.length; i++) {
+ const currentSerializer = this._serializers[i];
+ if (currentSerializer.canBeUsedFor && currentSerializer.canBeUsedFor(value)) {
+ s = currentSerializer;
+ break;
+ }
+ }
+ if (s) {
+ return s.serialize(value);
+ }
+ // Default (strings / objects / ...)
+ return value;
}
- // Default (for boolean, number and other scalars)
- return obj;
-};
-GraphSONReader.prototype._deserializeObject = function (obj) {
- var keys = Object.keys(obj);
- var result = {};
- for (var i = 0; i < keys.length; i++) {
- result[keys[i]] = this.read(obj[keys[i]]);
+ /**
+ * Returns the GraphSON representation of the provided object instance.
+ * @param {Object} obj
+ * @returns {String}
+ */
+ write(obj) {
+ return JSON.stringify(this.adaptObject(obj));
}
- return result;
-};
-
-function NumberSerializer() {
-
-}
-
-NumberSerializer.prototype.serialize = function (item) {
- return item;
-};
-
-NumberSerializer.prototype.deserialize = function (obj) {
- var value = obj[valueKey];
- return parseFloat(value);
-};
-
-NumberSerializer.prototype.canBeUsedFor = function (value) {
- return (typeof value === 'number');
-};
-
-function LongSerializer() {
-
-}
-
-NumberSerializer.prototype.serialize = function (item) {
- return {
- [typeKey]: 'g:Int64',
- [valueKey]: item.value
- };
-};
-
-NumberSerializer.prototype.canBeUsedFor = function (value) {
- return (value instanceof utils.Long);
-};
-
-function BytecodeSerializer() {
-
}
-BytecodeSerializer.prototype.serialize = function (item) {
- var bytecode = item;
- if (item instanceof t.Traversal) {
- bytecode = item.getBytecode();
- }
- var result = {};
- result[typeKey] = 'g:Bytecode';
- var resultValue = result[valueKey] = {};
- var sources = this._serializeInstructions(bytecode.sourceInstructions);
- if (sources) {
- resultValue['source'] = sources;
- }
- var steps = this._serializeInstructions(bytecode.stepInstructions);
- if (steps) {
- resultValue['step'] = steps;
+class GraphSONReader {
+ /**
+ * GraphSON Reader
+ * @param {Object} [options]
+ * @param {Object} [options.serializers] An object used as an associative array with GraphSON 2 type name as keys and
+ * deserializer instances as values, ie: { 'g:Int64': longSerializer }.
+ * @constructor
+ */
+ constructor(options) {
+ this._options = options || {};
+ this._deserializers = {};
+ Object.keys(deserializers).forEach(typeName => {
+ const serializerConstructor = deserializers[typeName];
+ const s = new serializerConstructor();
+ s.reader = this;
+ this._deserializers[typeName] = s;
+ });
+ if (this._options.serializers) {
+ const customSerializers = this._options.serializers || {};
+ Object.keys(customSerializers).forEach(key => {
+ const s = customSerializers[key];
+ if (!s.deserialize) {
+ return;
+ }
+ s.reader = this;
+ this._deserializers[key] = s;
+ });
+ }
}
- return result;
-};
-BytecodeSerializer.prototype._serializeInstructions = function (instructions) {
- if (instructions.length === 0) {
- return null;
- }
- var result = new Array(instructions.length);
- result[0] = instructions[0];
- for (var i = 0; i < instructions.length; i++) {
- result[i] = this.writer.adaptObject(instructions[i]);
+ read(obj) {
+ if (obj === undefined) {
+ return undefined;
+ }
+ if (obj === null) {
+ return null;
+ }
+ if (Array.isArray(obj)) {
+ return obj.map(item => this.read(item));
+ }
+ const type = obj[typeSerializers.typeKey];
+ if (type) {
+ const d = this._deserializers[type];
+ if (d) {
+ // Use type serializer
+ return d.deserialize(obj);
+ }
+ return obj[typeSerializers.valueKey];
+ }
+ if (obj && typeof obj === 'object' && obj.constructor === Object) {
+ return this._deserializeObject(obj);
+ }
+ // Default (for boolean, number and other scalars)
+ return obj;
}
- return result;
-};
-
-BytecodeSerializer.prototype.canBeUsedFor = function (value) {
- return (value instanceof Bytecode) || (value instanceof t.Traversal);
-};
-
-function PSerializer() {
-}
-
-/** @param {P} item */
-PSerializer.prototype.serialize = function (item) {
- var result = {};
- result[typeKey] = 'g:P';
- var resultValue = result[valueKey] = {
- 'predicate': item.operator
- };
- if (item.other === undefined || item.other === null) {
- resultValue['value'] = this.writer.adaptObject(item.value);
- }
- else {
- resultValue['value'] = [ this.writer.adaptObject(item.value), this.writer.adaptObject(item.other) ];
+ _deserializeObject(obj) {
+ const keys = Object.keys(obj);
+ const result = {};
+ for (let i = 0; i < keys.length; i++) {
+ result[keys[i]] = this.read(obj[keys[i]]);
+ }
+ return result;
}
- return result;
-};
-
-PSerializer.prototype.canBeUsedFor = function (value) {
- return (value instanceof t.P);
-};
-
-function LambdaSerializer() {
-
-}
-
-/** @param {Function} item */
-LambdaSerializer.prototype.serialize = function (item) {
- var result = {};
- result[typeKey] = 'g:Lambda';
- result[valueKey] = {
- 'arguments': item.length,
- 'language': 'gremlin-javascript',
- 'script': item.toString()
- };
- return result;
-};
-
-LambdaSerializer.prototype.canBeUsedFor = function (value) {
- return (typeof value === 'function');
-};
-
-function EnumSerializer() {
-
}
-/** @param {EnumValue} item */
-EnumSerializer.prototype.serialize = function (item) {
- var result = {};
- result[typeKey] = 'g:' + item.typeName;
- result[valueKey] = item.elementName;
- return result;
-};
-
-EnumSerializer.prototype.canBeUsedFor = function (value) {
- return value && value.typeName && value instanceof t.EnumValue;
-};
-
-function TraverserSerializer() {
-
-}
-
-/** @param {Traverser} item */
-TraverserSerializer.prototype.serialize = function (item) {
- var result = {};
- result[typeKey] = 'g:Traverser';
- result[valueKey] = {
- 'value': this.writer.adaptObject(item.object),
- 'bulk': this.writer.adaptObject(item.bulk)
- };
- return result;
-};
-
-TraverserSerializer.prototype.deserialize = function (obj) {
- var value = obj[valueKey];
- return new t.Traverser(this.reader.read(value['value']), this.reader.read(value['bulk']));
-};
-
-TraverserSerializer.prototype.canBeUsedFor = function (value) {
- return (value instanceof t.Traverser);
-};
-
-function VertexSerializer() {
-
-}
-
-VertexSerializer.prototype.deserialize = function (obj) {
- var value = obj[valueKey];
- return new g.Vertex(this.reader.read(value['id']), value['label'], this.reader.read(value['properties']));
-};
-
-/** @param {Vertex} item */
-VertexSerializer.prototype.serialize = function (item) {
- var result = {};
- result[typeKey] = 'g:Vertex';
- result[valueKey] = {
- 'id': this.writer.adaptObject(item.id),
- 'label': item.label
- };
- return result;
-};
-
-VertexSerializer.prototype.canBeUsedFor = function (value) {
- return (value instanceof g.Vertex);
-};
-
-function VertexPropertySerializer() {
-
-}
-
-VertexPropertySerializer.prototype.deserialize = function (obj) {
- var value = obj[valueKey];
- return new g.VertexProperty(
- this.reader.read(value['id']),
- value['label'],
- this.reader.read(value['value']),
- this.reader.read(value['properties'])
- );
-};
-
-function PropertySerializer() {
-
-}
-
-PropertySerializer.prototype.deserialize = function (obj) {
- var value = obj[valueKey];
- return new g.Property(
- value['key'],
- this.reader.read(value['value']));
-};
-
-function EdgeSerializer() {
-
-}
-
-EdgeSerializer.prototype.deserialize = function (obj) {
- var value = obj[valueKey];
- return new g.Edge(
- this.reader.read(value['id']),
- this.reader.read(value['outV']),
- value['label'],
- this.reader.read(value['inV']),
- this.reader.read(value['properties'])
- );
-};
-
-/** @param {Edge} item */
-EdgeSerializer.prototype.serialize = function (item) {
- var result = {};
- result[typeKey] = 'g:Edge';
- result[valueKey] = {
- 'id': this.writer.adaptObject(item.id),
- 'label': item.label,
- 'outV': this.writer.adaptObject(item.outV.id),
- 'outVLabel': item.outV.label,
- 'inV': this.writer.adaptObject(item.inV.id),
- 'inVLabel': item.inV.label
- };
- return result;
-};
-
-EdgeSerializer.prototype.canBeUsedFor = function (value) {
- return (value instanceof g.Edge);
-};
-
-function PathSerializer() {
-
-}
-
-PathSerializer.prototype.deserialize = function (obj) {
- var value = obj[valueKey];
- var objects = value['objects'].map(function objectMapItem(o) {
- return this.reader.read(o);
- }, this);
- return new g.Path(this.reader.read(value['labels']), objects);
-};
+const deserializers = {
+ 'g:Traverser': typeSerializers.TraverserSerializer,
+ 'g:Int32': typeSerializers.NumberSerializer,
+ 'g:Int64': typeSerializers.NumberSerializer,
+ 'g:Float': typeSerializers.NumberSerializer,
+ 'g:Double': typeSerializers.NumberSerializer,
+ 'g:Vertex': typeSerializers.VertexSerializer,
+ 'g:Edge': typeSerializers.EdgeSerializer,
+ 'g:VertexProperty': typeSerializers.VertexPropertySerializer,
+ 'g:Property': typeSerializers.PropertySerializer,
+ 'g:Path': typeSerializers.PathSerializer
+};
+
+const serializers = [
+ typeSerializers.NumberSerializer,
+ typeSerializers.BytecodeSerializer,
+ typeSerializers.TraverserSerializer,
+ typeSerializers.PSerializer,
+ typeSerializers.LambdaSerializer,
+ typeSerializers.EnumSerializer,
+ typeSerializers.VertexSerializer,
+ typeSerializers.EdgeSerializer,
+ typeSerializers.LongSerializer
+];
module.exports = {
- GraphSONWriter: GraphSONWriter,
- GraphSONReader: GraphSONReader
+ GraphSONWriter,
+ GraphSONReader
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
new file mode 100644
index 0000000..d6f131c
--- /dev/null
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
@@ -0,0 +1,288 @@
+/*
+ * 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.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+const t = require('../../process/traversal');
+const Bytecode = require('../../process/bytecode');
+const g = require('../graph');
+const utils = require('../../utils');
+
+const valueKey = '@value';
+const typeKey = '@type';
+
+/**
+ * @abstract
+ */
+class TypeSerializer {
+ serialize() {
+ throw new Error('serialize() method not implemented for ' + this.constructor.name);
+ }
+
+ deserialize() {
+ throw new Error('deserialize() method not implemented for ' + this.constructor.name);
+ }
+
+ canBeUsedFor() {
+ throw new Error('canBeUsedFor() method not implemented for ' + this.constructor.name);
+ }
+}
+
+class NumberSerializer extends TypeSerializer {
+ serialize(item) {
+ return item;
+ }
+
+ deserialize(obj) {
+ return parseFloat(obj[valueKey]);
+ }
+
+ canBeUsedFor(value) {
+ return (typeof value === 'number');
+ }
+}
+
+class LongSerializer extends TypeSerializer {
+ serialize(item) {
+ return {
+ [typeKey]: 'g:Int64',
+ [valueKey]: item.value
+ };
+ }
+
+ canBeUsedFor(value) {
+ return (value instanceof utils.Long);
+ }
+}
+
+class BytecodeSerializer extends TypeSerializer {
+ serialize(item) {
+ let bytecode = item;
+ if (item instanceof t.Traversal) {
+ bytecode = item.getBytecode();
+ }
+ const result = {};
+ result[typeKey] = 'g:Bytecode';
+ const resultValue = result[valueKey] = {};
+ const sources = this._serializeInstructions(bytecode.sourceInstructions);
+ if (sources) {
+ resultValue['source'] = sources;
+ }
+ const steps = this._serializeInstructions(bytecode.stepInstructions);
+ if (steps) {
+ resultValue['step'] = steps;
+ }
+ return result;
+ }
+
+ _serializeInstructions(instructions) {
+ if (instructions.length === 0) {
+ return null;
+ }
+ const result = new Array(instructions.length);
+ result[0] = instructions[0];
+ for (let i = 0; i < instructions.length; i++) {
+ result[i] = this.writer.adaptObject(instructions[i]);
+ }
+ return result;
+ }
+
+ canBeUsedFor(value) {
+ return (value instanceof Bytecode) || (value instanceof t.Traversal);
+ }
+}
+
+class PSerializer extends TypeSerializer {
+ /** @param {P} item */
+ serialize(item) {
+ const result = {};
+ result[typeKey] = 'g:P';
+ const resultValue = result[valueKey] = {
+ 'predicate': item.operator
+ };
+ if (item.other === undefined || item.other === null) {
+ resultValue['value'] = this.writer.adaptObject(item.value);
+ }
+ else {
+ resultValue['value'] = [ this.writer.adaptObject(item.value), this.writer.adaptObject(item.other) ];
+ }
+ return result;
+ }
+
+ canBeUsedFor(value) {
+ return (value instanceof t.P);
+ }
+}
+
+class LambdaSerializer extends TypeSerializer {
+ /** @param {Function} item */
+ serialize(item) {
+ return {
+ [typeKey]: 'g:Lambda',
+ [valueKey]: {
+ 'arguments': item.length,
+ 'language': 'gremlin-javascript',
+ 'script': item.toString()
+ }
+ };
+ }
+
+ canBeUsedFor(value) {
+ return (typeof value === 'function');
+ }
+}
+
+class EnumSerializer extends TypeSerializer {
+ /** @param {EnumValue} item */
+ serialize(item) {
+ return {
+ [typeKey]: 'g:' + item.typeName,
+ [valueKey]: item.elementName
+ };
+ }
+
+ canBeUsedFor(value) {
+ return value && value.typeName && value instanceof t.EnumValue;
+ }
+}
+
+class TraverserSerializer extends TypeSerializer {
+ /** @param {Traverser} item */
+ serialize(item) {
+ return {
+ [typeKey]: 'g:Traverser',
+ [valueKey]: {
+ 'value': this.writer.adaptObject(item.object),
+ 'bulk': this.writer.adaptObject(item.bulk)
+ }
+ };
+ }
+
+ deserialize(obj) {
+ const value = obj[valueKey];
+ return new t.Traverser(this.reader.read(value['value']), this.reader.read(value['bulk']));
+ }
+
+ canBeUsedFor(value) {
+ return (value instanceof t.Traverser);
+ }
+}
+
+class VertexSerializer extends TypeSerializer {
+ deserialize(obj) {
+ const value = obj[valueKey];
+ return new g.Vertex(this.reader.read(value['id']), value['label'], this.reader.read(value['properties']));
+ }
+
+ /** @param {Vertex} item */
+ serialize(item) {
+ return {
+ [typeKey]: 'g:Vertex',
+ [valueKey]: {
+ 'id': this.writer.adaptObject(item.id),
+ 'label': item.label
+ }
+ };
+ }
+
+ canBeUsedFor(value) {
+ return (value instanceof g.Vertex);
+ }
+}
+
+class VertexPropertySerializer extends TypeSerializer {
+ deserialize(obj) {
+ const value = obj[valueKey];
+ return new g.VertexProperty(
+ this.reader.read(value['id']),
+ value['label'],
+ this.reader.read(value['value']),
+ this.reader.read(value['properties'])
+ );
+ }
+}
+
+class PropertySerializer extends TypeSerializer {
+ deserialize(obj) {
+ const value = obj[valueKey];
+ return new g.Property(
+ value['key'],
+ this.reader.read(value['value']));
+ }
+}
+
+class EdgeSerializer extends TypeSerializer {
+ deserialize(obj) {
+ const value = obj[valueKey];
+ return new g.Edge(
+ this.reader.read(value['id']),
+ this.reader.read(value['outV']),
+ value['label'],
+ this.reader.read(value['inV']),
+ this.reader.read(value['properties'])
+ );
+ }
+
+ /** @param {Edge} item */
+ serialize(item) {
+ return {
+ [typeKey]: 'g:Edge',
+ [valueKey]: {
+ 'id': this.writer.adaptObject(item.id),
+ 'label': item.label,
+ 'outV': this.writer.adaptObject(item.outV.id),
+ 'outVLabel': item.outV.label,
+ 'inV': this.writer.adaptObject(item.inV.id),
+ 'inVLabel': item.inV.label
+ }
+ };
+ }
+
+ canBeUsedFor(value) {
+ return (value instanceof g.Edge);
+ }
+}
+
+class PathSerializer extends TypeSerializer {
+ deserialize(obj) {
+ const value = obj[valueKey];
+ const objects = value['objects'].map(o => this.reader.read(o));
+ return new g.Path(this.reader.read(value['labels']), objects);
+ }
+}
+
+module.exports = {
+ BytecodeSerializer,
+ EdgeSerializer,
+ EnumSerializer,
+ LambdaSerializer,
+ LongSerializer,
+ NumberSerializer,
+ PathSerializer,
+ PropertySerializer,
+ PSerializer,
+ TraverserSerializer,
+ typeKey,
+ valueKey,
+ VertexPropertySerializer,
+ VertexSerializer
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
index cbaa53e..bf87368 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
@@ -22,9 +22,6 @@
* @author Jorge Bay Gondra
*/
'use strict';
-var util = require('util');
-
-exports.inherits = util.inherits;
exports.parseArgs = function parseArgs() {
return (arguments.length === 1 ? [ arguments[0] ] : Array.apply(null, arguments));
@@ -56,7 +53,7 @@ exports.resolvedPromise = function (promiseFactory) {
});
};
-var toPromise = exports.toPromise = function toPromise(promiseFactory, handler) {
+const toPromise = exports.toPromise = function toPromise(promiseFactory, handler) {
promiseFactory = promiseFactory || defaultPromiseFactory;
return promiseFactory(handler);
};
@@ -65,7 +62,7 @@ exports.toLong = function toLong(value) {
return new Long(value);
};
-var Long = exports.Long = function Long(value) {
+const Long = exports.Long = function Long(value) {
if (typeof value !== 'string' && typeof value !== 'number') {
throw new TypeError('Ty')
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
index e4895fe..9e115be 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
@@ -27,7 +27,7 @@ const Bytecode = require('../../lib/process/bytecode');
const graphModule = require('../../lib/structure/graph');
const helper = require('../helper');
-var connection;
+let connection;
describe('DriverRemoteConnection', function () {
before(function () {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
index 7109427..01dde62 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
@@ -29,7 +29,7 @@ const Vertex = graphModule.Vertex;
const utils = require('../../lib/utils');
const helper = require('../helper');
-var connection;
+let connection;
describe('Traversal', function () {
before(function () {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js
index 3864a4a..53b6577 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/exports-test.js
@@ -22,8 +22,8 @@
*/
'use strict';
-var assert = require('assert');
-var glvModule = require('../../');
+const assert = require('assert');
+const glvModule = require('../../');
describe('API', function () {
it('should export fields under process', function () {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
index ed5beb3..8bc7571 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
@@ -22,23 +22,23 @@
*/
'use strict';
-var assert = require('assert');
-var graph = require('../../lib/structure/graph');
-var t = require('../../lib/process/traversal.js');
-var gs = require('../../lib/structure/io/graph-serializer.js');
-var GraphSONReader = gs.GraphSONReader;
-var GraphSONWriter = gs.GraphSONWriter;
-var P = t.P;
+const assert = require('assert');
+const graph = require('../../lib/structure/graph');
+const t = require('../../lib/process/traversal.js');
+const gs = require('../../lib/structure/io/graph-serializer.js');
+const GraphSONReader = gs.GraphSONReader;
+const GraphSONWriter = gs.GraphSONWriter;
+const P = t.P;
describe('GraphSONReader', function () {
it('should parse GraphSON int32, float and double to Number from GraphSON', function () {
- var reader = new GraphSONReader();
+ const reader = new GraphSONReader();
[
[ 'g:Int32', 31 ],
[ 'g:Float', 31.3],
[ 'g:Double', 31.2]
].forEach(function (item) {
- var result = reader.read({
+ const result = reader.read({
"@type": item[0],
"@value": item[1]
});
@@ -47,12 +47,12 @@ describe('GraphSONReader', function () {
});
});
it('should parse vertices from GraphSON', function () {
- var obj = {
+ const obj = {
"@type":"g:Vertex", "@value":{"id":{"@type":"g:Int32","@value":1},"label":"person",
"properties":{"name":[{"id":{"@type":"g:Int64","@value":0},"value":"marko"}],
"age":[{"id":{"@type":"g:Int64","@value":1},"value":{"@type":"g:Int32","@value":29}}]}}};
- var reader = new GraphSONReader(obj);
- var result = reader.read(obj);
+ const reader = new GraphSONReader(obj);
+ const result = reader.read(obj);
assert.ok(result instanceof graph.Vertex);
assert.strictEqual(result.label, 'person');
assert.strictEqual(typeof result.id, 'number');
@@ -65,7 +65,7 @@ describe('GraphSONReader', function () {
assert.strictEqual(result.properties['age'][0].value, 29);
});
it('should parse paths from GraphSON', function () {
- var obj = {"@type":"g:Path","@value":{"labels":[["a"],["b","c"],[]],"objects":[
+ const obj = {"@type":"g:Path","@value":{"labels":[["a"],["b","c"],[]],"objects":[
{
"@type":"g:Vertex","@value":{"id":{"@type":"g:Int32","@value":1},"label":"person",
"properties":{"name":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":0},
@@ -79,8 +79,8 @@ describe('GraphSONReader', function () {
"lang":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":5},
"value":"java","label":"lang"}}]}}},
"lop"]}};
- var reader = new GraphSONReader(obj);
- var result = reader.read(obj);
+ const reader = new GraphSONReader(obj);
+ const result = reader.read(obj);
assert.ok(result);
assert.ok(result.objects);
assert.ok(result.labels);
@@ -93,17 +93,17 @@ describe('GraphSONReader', function () {
});
describe('GraphSONWriter', function () {
it('should write numbers', function () {
- var writer = new GraphSONWriter();
+ const writer = new GraphSONWriter();
assert.strictEqual(writer.write(2), '2');
});
it('should write boolean values', function () {
- var writer = new GraphSONWriter();
+ const writer = new GraphSONWriter();
assert.strictEqual(writer.write(true), 'true');
assert.strictEqual(writer.write(false), 'false');
});
it('should write P', function () {
- var writer = new GraphSONWriter();
- var expected = JSON.stringify({"@type":"g:P","@value":{"predicate":"and","value":[
+ const writer = new GraphSONWriter();
+ const expected = JSON.stringify({"@type":"g:P","@value":{"predicate":"and","value":[
{"@type":"g:P","@value":{"predicate":"or","value":[{"@type":"g:P","@value":{"predicate":"lt","value":"b"}},
{"@type":"g:P","@value":{"predicate":"gt","value":"c"}}]}},
{"@type":"g:P","@value":{"predicate":"neq","value":"d"}}]}});
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
index 2be504b..9310143 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
@@ -33,8 +33,8 @@ describe('Traversal', function () {
describe('#getByteCode()', function () {
it('should add steps for with a string parameter', function () {
- var g = new graph.Graph().traversal();
- var bytecode = g.V().out('created').getBytecode();
+ const g = new graph.Graph().traversal();
+ const bytecode = g.V().out('created').getBytecode();
assert.ok(bytecode);
assert.strictEqual(bytecode.sourceInstructions.length, 0);
assert.strictEqual(bytecode.stepInstructions.length, 2);
@@ -44,8 +44,8 @@ describe('Traversal', function () {
});
it('should add steps with an enum value', function () {
- var g = new graph.Graph().traversal();
- var bytecode = g.V().order().by('age', t.order.decr).getBytecode();
+ const g = new graph.Graph().traversal();
+ const bytecode = g.V().order().by('age', t.order.decr).getBytecode();
assert.ok(bytecode);
assert.strictEqual(bytecode.sourceInstructions.length, 0);
assert.strictEqual(bytecode.stepInstructions.length, 3);
@@ -61,15 +61,15 @@ describe('Traversal', function () {
describe('#next()', function () {
it('should apply the strategies and return a Promise with the iterator item', function () {
- var strategyMock = {
+ const strategyMock = {
apply: function (traversal) {
traversal.traversers = [ new t.Traverser(1, 1), new t.Traverser(2, 1) ];
return utils.resolvedPromise();
}
};
- var strategies = new TraversalStrategies();
+ const strategies = new TraversalStrategies();
strategies.addStrategy(strategyMock);
- var traversal = new t.Traversal(null, strategies, null);
+ const traversal = new t.Traversal(null, strategies, null);
return traversal.next()
.then(function (item) {
assert.strictEqual(item.value, 1);
@@ -125,15 +125,15 @@ describe('Traversal', function () {
describe('#toList()', function () {
it('should apply the strategies and return a Promise with an array', function () {
- var strategyMock = {
+ const strategyMock = {
apply: function (traversal) {
traversal.traversers = [ new t.Traverser('a', 1), new t.Traverser('b', 1) ];
return utils.resolvedPromise();
}
};
- var strategies = new TraversalStrategies();
+ const strategies = new TraversalStrategies();
strategies.addStrategy(strategyMock);
- var traversal = new t.Traversal(null, strategies, null);
+ const traversal = new t.Traversal(null, strategies, null);
return traversal.toList().then(function (list) {
assert.ok(list);
assert.deepEqual(list, [ 'a', 'b' ]);
@@ -141,15 +141,15 @@ describe('Traversal', function () {
});
it('should return an empty array when traversers is empty', function () {
- var strategyMock = {
+ const strategyMock = {
apply: function (traversal) {
traversal.traversers = [];
return utils.resolvedPromise();
}
};
- var strategies = new TraversalStrategies();
+ const strategies = new TraversalStrategies();
strategies.addStrategy(strategyMock);
- var traversal = new t.Traversal(null, strategies, null);
+ const traversal = new t.Traversal(null, strategies, null);
return traversal.toList().then(function (list) {
assert.ok(Array.isArray(list));
assert.strictEqual(list.length, 0);
[40/50] [abbrv] tinkerpop git commit: Travis: Use mvn install before
running GLV tests
Posted by fl...@apache.org.
Travis: Use mvn install before running GLV tests
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/328c936d
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/328c936d
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/328c936d
Branch: refs/heads/TINKERPOP-1854
Commit: 328c936d30186f015c799589806d4bf47638daee
Parents: d37a3d8
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Jan 22 16:15:39 2018 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Mon Jan 22 16:41:34 2018 +0100
----------------------------------------------------------------------
.travis.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/328c936d/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 442de5e..9069cec 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,5 +26,5 @@ before_install:
jobs:
include:
- script: "mvn clean install -Dci"
- - script: "touch gremlin-dotnet/src/.glv && touch gremlin-dotnet/test/.glv && mvn clean install -pl :gremlin-dotnet,:gremlin-dotnet-tests -P gremlin-dotnet -DskipIntegrationTests=false"
- - script: "mvn clean install -pl :gremlin-javascript -DskipIntegrationTests=false"
+ - script: "touch gremlin-dotnet/src/.glv && touch gremlin-dotnet/test/.glv && mvn clean install -q -DskipTests && mvn verify -pl :gremlin-dotnet,:gremlin-dotnet-tests -P gremlin-dotnet -DskipIntegrationTests=false"
+ - script: "mvn clean install -q -DskipTests && mvn verify -pl :gremlin-javascript -DskipIntegrationTests=false"
[15/50] [abbrv] tinkerpop git commit: Vertex and Edge serialization
Posted by fl...@apache.org.
Vertex and Edge serialization
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e95b8eab
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e95b8eab
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e95b8eab
Branch: refs/heads/TINKERPOP-1854
Commit: e95b8eabc2f7fdb7dd943d18905141e2e7746aa0
Parents: b9ca2ca
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Nov 28 12:50:37 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:16 2018 +0100
----------------------------------------------------------------------
.../lib/structure/io/graph-serializer.js | 42 ++++++++++++++++++--
1 file changed, 39 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e95b8eab/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
index 46d251e..ff3d72d 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
@@ -65,7 +65,9 @@ var serializers = [
TraverserSerializer,
PSerializer,
LambdaSerializer,
- EnumSerializer
+ EnumSerializer,
+ VertexSerializer,
+ EdgeSerializer
];
/**
@@ -237,7 +239,7 @@ BytecodeSerializer.prototype._serializeInstructions = function (instructions) {
}
var result = new Array(instructions.length);
result[0] = instructions[0];
- for (var i = 1; i < instructions.length; i++) {
+ for (var i = 0; i < instructions.length; i++) {
result[i] = this.writer.adaptObject(instructions[i]);
}
return result;
@@ -258,7 +260,7 @@ PSerializer.prototype.serialize = function (item) {
var resultValue = result[valueKey] = {
'predicate': item.operator
};
- if (item.other == undefined) {
+ if (item.other === undefined || item.other === null) {
resultValue['value'] = this.writer.adaptObject(item.value);
}
else {
@@ -340,6 +342,21 @@ VertexSerializer.prototype.deserialize = function (obj) {
return new g.Vertex(this.reader.read(value['id']), value['label'], this.reader.read(value['properties']));
};
+/** @param {Vertex} item */
+VertexSerializer.prototype.serialize = function (item) {
+ var result = {};
+ result[typeKey] = 'g:Vertex';
+ result[valueKey] = {
+ 'id': this.writer.adaptObject(item.id),
+ 'label': item.label
+ };
+ return result;
+};
+
+VertexSerializer.prototype.canBeUsedFor = function (value) {
+ return (value instanceof g.Vertex);
+};
+
function VertexPropertySerializer() {
}
@@ -380,6 +397,25 @@ EdgeSerializer.prototype.deserialize = function (obj) {
);
};
+/** @param {Edge} item */
+EdgeSerializer.prototype.serialize = function (item) {
+ var result = {};
+ result[typeKey] = 'g:Edge';
+ result[valueKey] = {
+ 'id': this.writer.adaptObject(item.id),
+ 'label': item.label,
+ 'outV': this.writer.adaptObject(item.outV.id),
+ 'outVLabel': item.outV.label,
+ 'inV': this.writer.adaptObject(item.inV.id),
+ 'inVLabel': item.inV.label
+ };
+ return result;
+};
+
+EdgeSerializer.prototype.canBeUsedFor = function (value) {
+ return (value instanceof g.Edge);
+};
+
function PathSerializer() {
}
[32/50] [abbrv] tinkerpop git commit: Include T deserializer
Posted by fl...@apache.org.
Include T deserializer
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f2f9729c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f2f9729c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f2f9729c
Branch: refs/heads/TINKERPOP-1854
Commit: f2f9729cd5ca295bcaa3d445878f0cbdd7b5ee6c
Parents: 3553ea9
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Wed Jan 17 16:52:05 2018 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:18 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/glv/TraversalSource.template | 4 ++++
.../javascript/gremlin-javascript/lib/process/traversal.js | 4 ++++
.../gremlin-javascript/lib/structure/io/graph-serializer.js | 3 ++-
.../gremlin-javascript/lib/structure/io/type-serializers.js | 7 +++++++
4 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f2f9729c/gremlin-javascript/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template
index d707a42..3f289e4 100644
--- a/gremlin-javascript/glv/TraversalSource.template
+++ b/gremlin-javascript/glv/TraversalSource.template
@@ -182,6 +182,10 @@ class EnumValue {
this.typeName = typeName;
this.elementName = elementName;
}
+
+ toString() {
+ return this.elementName;
+ }
}
module.exports = {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f2f9729c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
index 2877f02..a8d066a 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
@@ -242,6 +242,10 @@ class EnumValue {
this.typeName = typeName;
this.elementName = elementName;
}
+
+ toString() {
+ return this.elementName;
+ }
}
module.exports = {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f2f9729c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
index 3dbd340..df05659 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
@@ -159,7 +159,8 @@ const deserializers = {
'g:Edge': typeSerializers.EdgeSerializer,
'g:VertexProperty': typeSerializers.VertexPropertySerializer,
'g:Property': typeSerializers.PropertySerializer,
- 'g:Path': typeSerializers.PathSerializer
+ 'g:Path': typeSerializers.PathSerializer,
+ 'g:T': typeSerializers.TSerializer
};
const serializers = [
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f2f9729c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
index d6f131c..304888f 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
@@ -270,6 +270,12 @@ class PathSerializer extends TypeSerializer {
}
}
+class TSerializer extends TypeSerializer {
+ deserialize(obj) {
+ return t.t[obj[valueKey]];
+ }
+}
+
module.exports = {
BytecodeSerializer,
EdgeSerializer,
@@ -280,6 +286,7 @@ module.exports = {
PathSerializer,
PropertySerializer,
PSerializer,
+ TSerializer,
TraverserSerializer,
typeKey,
valueKey,
[48/50] [abbrv] tinkerpop git commit: Merge branch 'TINKERPOP-1870'
into tp32
Posted by fl...@apache.org.
Merge branch 'TINKERPOP-1870' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/389394c6
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/389394c6
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/389394c6
Branch: refs/heads/TINKERPOP-1854
Commit: 389394c6de193cdd9391bb6fe15477052c264e7c
Parents: 5a37ee4 068bef8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jan 24 17:06:28 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jan 24 17:06:28 2018 -0500
----------------------------------------------------------------------
CHANGELOG.asciidoc | 3 +-
.../traversal/TraversalVertexProgram.java | 10 +-
.../computer/traversal/WorkerExecutor.java | 26 +--
.../traverser/util/IndexedTraverserSet.java | 112 ++++++++++
.../traversal/traverser/util/TraverserSet.java | 3 +-
.../traverser/util/VertexTraverserSet.java | 71 -------
.../gremlin/structure/io/gryo/GryoVersion.java | 4 +-
.../tinkerpop/gremlin/structure/util/Host.java | 23 +++
.../traverser/util/IndexedTraverserSetTest.java | 189 +++++++++++++++++
.../util/TraverserSetImplementationTest.java | 207 +++++++++++++++++++
.../process/traversal/step/map/ProgramTest.java | 8 +-
11 files changed, 551 insertions(+), 105 deletions(-)
----------------------------------------------------------------------
[38/50] [abbrv] tinkerpop git commit: Remove utils.toPromise()
Posted by fl...@apache.org.
Remove utils.toPromise()
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/af718f7c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/af718f7c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/af718f7c
Branch: refs/heads/TINKERPOP-1854
Commit: af718f7ca53111b371903471ae76841aa7e06861
Parents: f2f9729
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Jan 22 11:19:07 2018 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Mon Jan 22 11:19:07 2018 +0100
----------------------------------------------------------------------
.../lib/driver/driver-remote-connection.js | 68 +++++++++-----------
.../lib/driver/remote-connection.js | 9 ++-
.../lib/process/traversal-strategy.js | 20 ++----
.../javascript/gremlin-javascript/lib/utils.js | 31 ---------
.../test/unit/traversal-test.js | 13 ++--
5 files changed, 44 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af718f7c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index ac3fb0f..5587fd6 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -59,16 +59,13 @@ class DriverRemoteConnection extends RemoteConnection {
pfx: options.pfx,
rejectUnauthorized: options.rejectUnauthorized
});
- var self = this;
- this._ws.on('open', function opened () {
- self.isOpen = true;
- if (self._openCallback) {
- self._openCallback();
+ this._ws.on('open', () => {
+ this.isOpen = true;
+ if (this._openCallback) {
+ this._openCallback();
}
});
- this._ws.on('message', function incoming (data) {
- self._handleMessage(data);
- });
+ this._ws.on('message', data => this._handleMessage(data));
// A map containing the request id and the handler
this._responseHandlers = {};
this._reader = options.reader || new serializer.GraphSONReader();
@@ -86,39 +83,33 @@ class DriverRemoteConnection extends RemoteConnection {
* Opens the connection, if its not already opened.
* @returns {Promise}
*/
- open(promiseFactory) {
+ open() {
if (this._closePromise) {
- return this._openPromise = utils.toPromise(promiseFactory, function promiseHandler(callback) {
- callback(new Error('Connection has been closed'));
- });
+ return this._openPromise = Promise.reject(new Error('Connection has been closed'));
+ }
+ if (this.isOpen) {
+ return Promise.resolve();
}
if (this._openPromise) {
return this._openPromise;
}
- const self = this;
- return this._openPromise = utils.toPromise(promiseFactory, function promiseHandler(callback) {
- if (self.isOpen) {
- return callback();
- }
- // It will be invoked when opened
- self._openCallback = callback;
+ return this._openPromise = new Promise((resolve, reject) => {
+ // Set the callback that will be invoked once the WS is opened
+ this._openCallback = err => err ? reject(err) : resolve();
});
}
/** @override */
- submit(bytecode, promiseFactory) {
- const self = this;
- return this.open().then(function () {
- return utils.toPromise(promiseFactory, function promiseHandler(callback) {
- const requestId = getUuid();
- self._responseHandlers[requestId] = {
- callback: callback,
- result: null
- };
- const message = bufferFromString(self._header + JSON.stringify(self._getRequest(requestId, bytecode)));
- self._ws.send(message);
- });
- });
+ submit(bytecode) {
+ return this.open().then(() => new Promise((resolve, reject) => {
+ const requestId = getUuid();
+ this._responseHandlers[requestId] = {
+ callback: (err, result) => err ? reject(err) : resolve(result),
+ result: null
+ };
+ const message = bufferFromString(this._header + JSON.stringify(this._getRequest(requestId, bytecode)));
+ this._ws.send(message);
+ }));
}
_getRequest(id, bytecode) {
@@ -163,17 +154,16 @@ class DriverRemoteConnection extends RemoteConnection {
* Closes the Connection.
* @return {Promise}
*/
- close(promiseFactory) {
+ close() {
if (this._closePromise) {
return this._closePromise;
}
- const self = this;
- return this._closePromise = utils.toPromise(promiseFactory, function promiseHandler(callback) {
- self._ws.on('close', function () {
- self.isOpen = false;
- callback();
+ this._closePromise = new Promise(resolve => {
+ this._ws.on('close', function () {
+ this.isOpen = false;
+ resolve();
});
- self._ws.close();
+ this._ws.close();
});
}
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af718f7c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
index 37f3d0e..2672ff4 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
@@ -33,10 +33,9 @@ class RemoteConnection {
/**
* @abstract
* @param {Bytecode} bytecode
- * @param {Function|undefined} promiseFactory
* @returns {Promise}
*/
- submit(bytecode, promiseFactory) {
+ submit(bytecode) {
throw new Error('submit() was not implemented');
};
}
@@ -60,11 +59,11 @@ class RemoteStrategy extends TraversalStrategy {
}
/** @override */
- apply(traversal, promiseFactory) {
+ apply(traversal) {
if (traversal.traversers) {
- return utils.resolvedPromise(promiseFactory);
+ return Promise.resolve();
}
- return this.connection.submit(traversal.getBytecode(), promiseFactory).then(function (remoteTraversal) {
+ return this.connection.submit(traversal.getBytecode()).then(function (remoteTraversal) {
traversal.sideEffects = remoteTraversal.sideEffects;
traversal.traversers = remoteTraversal.traversers;
});
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af718f7c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
index fbc3fba..d3d97b8 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
@@ -28,22 +28,16 @@ class TraversalStrategies {
/**
* Creates a new instance of TraversalStrategies.
* @param {TraversalStrategies} [parent] The parent strategies from where to clone the values from.
- * @param {Function} [promiseFactory] The factory used to create the A+ Promise instances. Use it when you want to
- * create Promise instances without using ECMAScript Promise constructor, ie: bluebird or Q promises.
* @constructor
*/
- constructor(parent, promiseFactory) {
+ constructor(parent) {
if (parent) {
// Clone the strategies
this.strategies = parent.strategies.slice(0);
- this.promiseFactory = parent.promiseFactory;
}
else {
this.strategies = [];
}
- if (promiseFactory) {
- this.promiseFactory = promiseFactory;
- }
}
/** @param {TraversalStrategy} strategy */
@@ -57,12 +51,9 @@ class TraversalStrategies {
*/
applyStrategies(traversal) {
// Apply all strategies serially
- const self = this;
- return this.strategies.reduce(function reduceItem(promise, strategy) {
- return promise.then(function () {
- return strategy.apply(traversal, self.promiseFactory);
- });
- }, utils.resolvedPromise(this.promiseFactory));
+ return this.strategies.reduce((promise, strategy) => {
+ return promise.then(() => strategy.apply(traversal));
+ }, Promise.resolve());
}
}
@@ -71,10 +62,9 @@ class TraversalStrategy {
/**
* @abstract
* @param {Traversal} traversal
- * @param {Function|undefined} promiseFactory
* @returns {Promise}
*/
- apply(traversal, promiseFactory) {
+ apply(traversal) {
}
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af718f7c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
index bf87368..c864efd 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
@@ -27,37 +27,6 @@ exports.parseArgs = function parseArgs() {
return (arguments.length === 1 ? [ arguments[0] ] : Array.apply(null, arguments));
};
-/**
- * @param {Function} handler
- * @returns {Promise}
- */
-function defaultPromiseFactory(handler) {
- return new Promise(function executor(resolve, reject) {
- handler(function handlerCallback(err, result) {
- if (err) {
- return reject(err);
- }
- resolve(result);
- });
- });
-}
-
-/**
- * Gets a resolved Promise instance.
- * @param {Function} promiseFactory
- * @returns {Promise}
- */
-exports.resolvedPromise = function (promiseFactory) {
- return toPromise(promiseFactory, function handler(cb) {
- cb();
- });
-};
-
-const toPromise = exports.toPromise = function toPromise(promiseFactory, handler) {
- promiseFactory = promiseFactory || defaultPromiseFactory;
- return promiseFactory(handler);
-};
-
exports.toLong = function toLong(value) {
return new Long(value);
};
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af718f7c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
index 9310143..130a218 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
@@ -25,7 +25,6 @@
const assert = require('assert');
const expect = require('chai').expect;
const graph = require('../../lib/structure/graph');
-const utils = require('../../lib/utils');
const t = require('../../lib/process/traversal');
const TraversalStrategies = require('../../lib/process/traversal-strategy').TraversalStrategies;
@@ -64,7 +63,7 @@ describe('Traversal', function () {
const strategyMock = {
apply: function (traversal) {
traversal.traversers = [ new t.Traverser(1, 1), new t.Traverser(2, 1) ];
- return utils.resolvedPromise();
+ return Promise.resolve();
}
};
const strategies = new TraversalStrategies();
@@ -92,7 +91,7 @@ describe('Traversal', function () {
const strategyMock = {
apply: function (traversal) {
traversal.traversers = [ new t.Traverser(1, 2), new t.Traverser(2, 1) ];
- return utils.resolvedPromise();
+ return Promise.resolve();
}
};
const strategies = new TraversalStrategies();
@@ -128,7 +127,7 @@ describe('Traversal', function () {
const strategyMock = {
apply: function (traversal) {
traversal.traversers = [ new t.Traverser('a', 1), new t.Traverser('b', 1) ];
- return utils.resolvedPromise();
+ return Promise.resolve();
}
};
const strategies = new TraversalStrategies();
@@ -144,7 +143,7 @@ describe('Traversal', function () {
const strategyMock = {
apply: function (traversal) {
traversal.traversers = [];
- return utils.resolvedPromise();
+ return Promise.resolve();
}
};
const strategies = new TraversalStrategies();
@@ -161,7 +160,7 @@ describe('Traversal', function () {
apply: function (traversal) {
traversal.traversers = [ new t.Traverser(1, 1), new t.Traverser(2, 3), new t.Traverser(3, 2),
new t.Traverser(4, 1) ];
- return utils.resolvedPromise();
+ return Promise.resolve();
}
};
const strategies = new TraversalStrategies();
@@ -181,7 +180,7 @@ describe('Traversal', function () {
apply: function (traversal) {
applied = true;
traversal.traversers = [ new t.Traverser('a', 1), new t.Traverser('b', 1) ];
- return utils.resolvedPromise();
+ return Promise.resolve();
}
};
const strategies = new TraversalStrategies();
[44/50] [abbrv] tinkerpop git commit: TINKERPOP-1870 Made
VertexTraverserSet more generic to IndexedTraverserSet
Posted by fl...@apache.org.
TINKERPOP-1870 Made VertexTraverserSet more generic to IndexedTraverserSet
IndexedTraverserSet does what VertexTraverserSet was doing, but in a more complete way. It respects all the semantics of a TraverserSet and fixes a problem that VertexTraverserSet had where it didn't properly account for Traverser merges. Added a full grip of unit tests for both TraverserSet and IndexedTraverserSet.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/068bef85
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/068bef85
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/068bef85
Branch: refs/heads/TINKERPOP-1854
Commit: 068bef855c0f6c44a2ed71c1c8f4b18ad1e1dbdb
Parents: 3e6e08a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jan 23 16:16:40 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jan 23 18:45:20 2018 -0500
----------------------------------------------------------------------
CHANGELOG.asciidoc | 3 +-
.../traversal/TraversalVertexProgram.java | 10 +-
.../computer/traversal/WorkerExecutor.java | 26 +--
.../traverser/util/IndexedTraverserSet.java | 112 ++++++++++
.../traversal/traverser/util/TraverserSet.java | 3 +-
.../traverser/util/VertexTraverserSet.java | 71 -------
.../gremlin/structure/io/gryo/GryoVersion.java | 4 +-
.../tinkerpop/gremlin/structure/util/Host.java | 23 +++
.../traverser/util/IndexedTraverserSetTest.java | 189 +++++++++++++++++
.../util/TraverserSetImplementationTest.java | 207 +++++++++++++++++++
.../process/traversal/step/map/ProgramTest.java | 8 +-
11 files changed, 551 insertions(+), 105 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 1fd0311..7377d24 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,7 +25,8 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
* Delayed setting of the request identifier until `RequestMessage` construction by the builder.
* Removed hardcoded expectation in metrics serialization test suite as different providers may have different outputs.
-* Added `VertexTraverserSet` which indexes on a `Vertex` thus improving performance in `VertexProgram` implementations.
+* Added `IndexedTraverserSet` which indexes on the value of a `Traverser` thus improving performance when used.
+* Utilized `IndexedTraverserSet` in `TraversalVertexProgram` to avoid extra iteration when doing `Vertex` lookups.
* Fixed a bug in `ComputerAwareStep` that didn't handle `reset()` properly and thus occasionally produced some extra traversers.
[[release-3-2-7]]
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
index d4c605b..3cb4d00 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
@@ -53,7 +53,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.ProfileStep;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.VertexTraverserSet;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.IndexedTraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics;
@@ -230,13 +230,13 @@ public final class TraversalVertexProgram implements VertexProgram<TraverserSet<
toProcessTraversers.add(traverser);
});
assert this.haltedTraversers.isEmpty();
- final VertexTraverserSet<Object> remoteActiveTraversers = new VertexTraverserSet<>();
+ final IndexedTraverserSet<Object,Vertex> remoteActiveTraversers = new IndexedTraverserSet.VertexIndexedTraverserSet();
MasterExecutor.processTraversers(this.traversal, this.traversalMatrix, toProcessTraversers, remoteActiveTraversers, this.haltedTraversers, this.haltedTraverserStrategy);
memory.set(HALTED_TRAVERSERS, this.haltedTraversers);
memory.set(ACTIVE_TRAVERSERS, remoteActiveTraversers);
} else {
memory.set(HALTED_TRAVERSERS, new TraverserSet<>());
- memory.set(ACTIVE_TRAVERSERS, new VertexTraverserSet<>());
+ memory.set(ACTIVE_TRAVERSERS, new IndexedTraverserSet.VertexIndexedTraverserSet());
}
// local variable will no longer be used so null it for GC
this.haltedTraversers = null;
@@ -316,12 +316,12 @@ public final class TraversalVertexProgram implements VertexProgram<TraverserSet<
MemoryTraversalSideEffects.setMemorySideEffects(this.traversal.get(), memory, ProgramPhase.TERMINATE);
final boolean voteToHalt = memory.<Boolean>get(VOTE_TO_HALT);
memory.set(VOTE_TO_HALT, true);
- memory.set(ACTIVE_TRAVERSERS, new VertexTraverserSet<>());
+ memory.set(ACTIVE_TRAVERSERS, new IndexedTraverserSet.VertexIndexedTraverserSet());
if (voteToHalt) {
// local traverser sets to process
final TraverserSet<Object> toProcessTraversers = new TraverserSet<>();
// traversers that need to be sent back to the workers (no longer can be processed locally by the master traversal)
- final VertexTraverserSet<Object> remoteActiveTraversers = new VertexTraverserSet<>();
+ final IndexedTraverserSet<Object,Vertex> remoteActiveTraversers = new IndexedTraverserSet.VertexIndexedTraverserSet();
// halted traversers that have completed their journey
final TraverserSet<Object> haltedTraversers = memory.get(HALTED_TRAVERSERS);
// get all barrier traversers
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/WorkerExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/WorkerExecutor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/WorkerExecutor.java
index a875afe..b437a9d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/WorkerExecutor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/WorkerExecutor.java
@@ -31,13 +31,13 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.LocalBarrier;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.VertexTraverserSet;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.IndexedTraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMatrix;
-import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.util.Attachable;
+import org.apache.tinkerpop.gremlin.structure.util.Host;
import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
@@ -75,7 +75,7 @@ final class WorkerExecutor {
// MASTER ACTIVE
// these are traversers that are going from OLTP (master) to OLAP (workers)
// these traversers were broadcasted from the master traversal to the workers for attachment
- final VertexTraverserSet<Object> maybeActiveTraversers = memory.get(TraversalVertexProgram.ACTIVE_TRAVERSERS);
+ final IndexedTraverserSet<Object,Vertex> maybeActiveTraversers = memory.get(TraversalVertexProgram.ACTIVE_TRAVERSERS);
// some memory systems are interacted with by multiple threads and thus, concurrent modification can happen at iterator.remove().
// its better to reduce the memory footprint and shorten the active traverser list so synchronization is worth it.
// most distributed OLAP systems have the memory partitioned and thus, this synchronization does nothing.
@@ -160,7 +160,7 @@ final class WorkerExecutor {
// decide whether to message the traverser or to process it locally
if (traverser.get() instanceof Element || traverser.get() instanceof Property) { // GRAPH OBJECT
// if the element is remote, then message, else store it locally for re-processing
- final Vertex hostingVertex = WorkerExecutor.getHostingVertex(traverser.get());
+ final Vertex hostingVertex = Host.getHostingVertex(traverser.get());
if (!vertex.equals(hostingVertex)) { // if its host is not the current vertex, then send the traverser to the hosting vertex
voteToHalt.set(false); // if message is passed, then don't vote to halt
messenger.sendMessage(MessageScope.Global.of(hostingVertex), new TraverserSet<>(traverser.detach()));
@@ -200,7 +200,7 @@ final class WorkerExecutor {
if (traverser.isHalted() &&
(returnHaltedTraversers ||
(!(traverser.get() instanceof Element) && !(traverser.get() instanceof Property)) ||
- getHostingVertex(traverser.get()).equals(vertex))) {
+ Host.getHostingVertex(traverser.get()).equals(vertex))) {
if (returnHaltedTraversers)
memory.add(TraversalVertexProgram.HALTED_TRAVERSERS, new TraverserSet<>(haltedTraverserStrategy.halt(traverser)));
else
@@ -223,7 +223,7 @@ final class WorkerExecutor {
// if its a ReferenceFactory (one less iteration required)
((returnHaltedTraversers || ReferenceFactory.class == haltedTraverserStrategy.getHaltedTraverserFactory()) &&
(!(traverser.get() instanceof Element) && !(traverser.get() instanceof Property)) ||
- getHostingVertex(traverser.get()).equals(vertex))) {
+ Host.getHostingVertex(traverser.get()).equals(vertex))) {
if (returnHaltedTraversers)
memory.add(TraversalVertexProgram.HALTED_TRAVERSERS, new TraverserSet<>(haltedTraverserStrategy.halt(traverser)));
else
@@ -234,18 +234,4 @@ final class WorkerExecutor {
});
}
}
-
- private static Vertex getHostingVertex(final Object object) {
- Object obj = object;
- while (true) {
- if (obj instanceof Vertex)
- return (Vertex) obj;
- else if (obj instanceof Edge)
- return ((Edge) obj).outVertex();
- else if (obj instanceof Property)
- obj = ((Property) obj).element();
- else
- throw new IllegalStateException("The host of the object is unknown: " + obj.toString() + ':' + obj.getClass().getCanonicalName());
- }
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/IndexedTraverserSet.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/IndexedTraverserSet.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/IndexedTraverserSet.java
new file mode 100644
index 0000000..3df335b
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/IndexedTraverserSet.java
@@ -0,0 +1,112 @@
+/*
+ * 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.traverser.util;
+
+import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.Host;
+
+import java.util.Collection;
+import java.util.function.Function;
+
+/**
+ * A {@link TraverserSet} that has an index back to the object in the {@link Traverser}. Using this extension of
+ * {@link TraverserSet} can make it easier to find traversers within the set if the internal value is known. Without
+ * the index the entire {@link TraverserSet} needs to be iterated to find a particular value.
+ */
+public class IndexedTraverserSet<S,I> extends TraverserSet<S> {
+
+ private final MultiValueMap index = new MultiValueMap();
+ private final Function<S,I> indexingFunction;
+
+ public IndexedTraverserSet(final Function<S, I> indexingFunction) {
+ this(indexingFunction, null);
+ }
+
+ public IndexedTraverserSet(final Function<S, I> indexingFunction, final Traverser.Admin<S> traverser) {
+ super(traverser);
+ this.indexingFunction = indexingFunction;
+ }
+
+ @Override
+ public void clear() {
+ index.clear();
+ super.clear();
+ }
+
+ @Override
+ public boolean add(final Traverser.Admin<S> traverser) {
+ final boolean newOne = super.add(traverser);
+
+ // if newly added then the traverser will be the same as the one passed in here to add().
+ // if it is not, then it was merged to an existing traverser and the bulk would have
+ // updated on that reference, thus only new stuff really needs to be added to the index
+ if (newOne) index.put(indexingFunction.apply(traverser.get()), traverser);
+
+ return newOne;
+ }
+
+ /**
+ * Gets a collection of {@link Traverser} objects that contain the specified value.
+ *
+ * @param k the key produced by the indexing function
+ * @return
+ */
+ public Collection<Traverser.Admin<S>> get(final I k) {
+ final Collection<Traverser.Admin<S>> c = index.getCollection(k);
+
+ // if remove() is called on this class, then the MultiValueMap *may* (javadoc wasn't clear
+ // what the expectation was - used the word "typically") return an empty list if the last
+ // item removed leaves the list empty. i think we want to enforce null for TraverserSet
+ // semantics
+ return c != null && c.isEmpty() ? null : c;
+ }
+
+ @Override
+ public boolean offer(final Traverser.Admin<S> traverser) {
+ return this.add(traverser);
+ }
+
+ @Override
+ public Traverser.Admin<S> remove() {
+ final Traverser.Admin<S> removed = super.remove();
+ index.remove(indexingFunction.apply(removed.get()), removed);
+ return removed;
+ }
+
+ @Override
+ public boolean remove(final Object traverser) {
+ if (!(traverser instanceof Traverser.Admin))
+ throw new IllegalArgumentException("The object to remove must be traverser");
+
+ final boolean removed = super.remove(traverser);
+ if (removed) index.remove(indexingFunction.apply(((Traverser.Admin<S>) traverser).get()), traverser);
+ return removed;
+ }
+
+ /**
+ * An {@link IndexedTraverserSet} that indexes based on a {@link Vertex} traverser.
+ */
+ public static class VertexIndexedTraverserSet extends IndexedTraverserSet<Object, Vertex> {
+ public VertexIndexedTraverserSet() {
+ super(Host::getHostingVertex);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/TraverserSet.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/TraverserSet.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/TraverserSet.java
index 3e3d5ea..29f5f70 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/TraverserSet.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/TraverserSet.java
@@ -47,7 +47,8 @@ public class TraverserSet<S> extends AbstractSet<Traverser.Admin<S>> implements
}
public TraverserSet(final Traverser.Admin<S> traverser) {
- this.map.put(traverser, traverser);
+ if (traverser != null)
+ this.map.put(traverser, traverser);
}
@Override
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/VertexTraverserSet.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/VertexTraverserSet.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/VertexTraverserSet.java
deleted file mode 100644
index 05ba3a0..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/VertexTraverserSet.java
+++ /dev/null
@@ -1,71 +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.traverser.util;
-
-import org.apache.commons.collections.map.MultiValueMap;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-import java.util.Collection;
-
-public class VertexTraverserSet<S> extends TraverserSet<S> {
- // that should be MultiValueMap<Vertex, Traverser.Admin<S>> but 3.2.2 apache collection do not use generics
- private final MultiValueMap vertexIndex = new MultiValueMap();
-
- @Override
- public void clear() {
- vertexIndex.clear();
- super.clear();
- }
-
- @Override
- public boolean add(final Traverser.Admin<S> traverser) {
- if (super.add(traverser)) {
- vertexIndex.put(getHostingVertex(traverser.get()), traverser);
- return true;
- } else {
- return false;
- }
- }
-
- public Collection<Traverser.Admin<S>> get(Vertex v) {
- return vertexIndex.getCollection(v);
- }
-
- @Override
- public boolean offer(final Traverser.Admin<S> traverser) {
- return this.add(traverser);
- }
-
- private static Vertex getHostingVertex(final Object object) {
- Object obj = object;
- while (true) {
- if (obj instanceof Vertex)
- return (Vertex) obj;
- else if (obj instanceof Edge)
- return ((Edge) obj).outVertex();
- else if (obj instanceof Property)
- obj = ((Property) obj).element();
- else
- throw new IllegalStateException("The host of the object is unknown: " + obj.toString() + ':' + obj.getClass().getCanonicalName());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/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 6d76ce8..6d5e99a 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
@@ -52,7 +52,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.traverser.LP_O_OB_S_SE_SL_
import org.apache.tinkerpop.gremlin.process.traversal.traverser.O_OB_S_SE_SL_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.O_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.ProjectedTraverser;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.VertexTraverserSet;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.IndexedTraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics;
import org.apache.tinkerpop.gremlin.process.traversal.util.ImmutableMetrics;
@@ -308,7 +308,7 @@ public enum GryoVersion {
add(GryoTypeReg.of(OrderGlobalStep.OrderBiOperator.class, 118, new JavaSerializer()));
add(GryoTypeReg.of(ProfileStep.ProfileBiOperator.class, 119));
// skip 171, 172 to sync with tp33
- add(GryoTypeReg.of(VertexTraverserSet.class, 173)); // ***LAST ID***
+ add(GryoTypeReg.of(IndexedTraverserSet.VertexIndexedTraverserSet.class, 173)); // ***LAST ID***
}};
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Host.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Host.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Host.java
index 92962b0..6945434 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Host.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Host.java
@@ -18,10 +18,33 @@
*/
package org.apache.tinkerpop.gremlin.structure.util;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
/**
* A marker interface that identifies an object as something that an {@link Attachable} can connect to.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public interface Host {
+
+ /**
+ * Extracts the {@link Vertex} that is holding the specified object.
+ *
+ * @throws IllegalStateException if the object is not a graph element type
+ */
+ public static Vertex getHostingVertex(final Object object) {
+ Object obj = object;
+ while (true) {
+ if (obj instanceof Vertex)
+ return (Vertex) obj;
+ else if (obj instanceof Edge)
+ return ((Edge) obj).outVertex();
+ else if (obj instanceof Property)
+ obj = ((Property) obj).element();
+ else
+ throw new IllegalStateException("The host of the object is unknown: " + obj.toString() + ':' + obj.getClass().getCanonicalName());
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/IndexedTraverserSetTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/IndexedTraverserSetTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/IndexedTraverserSetTest.java
new file mode 100644
index 0000000..0d765f4
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/IndexedTraverserSetTest.java
@@ -0,0 +1,189 @@
+/*
+ * 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.traverser.util;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_Traverser;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsNull.nullValue;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class IndexedTraverserSetTest {
+ @Test
+ public void shouldIndexTraversers() {
+ final IndexedTraverserSet<String, String> ts = makeTraverserSet();
+
+ final List<Traverser.Admin<String>> testTraversers = new ArrayList<>(ts.get("test"));
+ assertEquals(1, testTraversers.size());
+ assertEquals(10, testTraversers.get(0).bulk());
+
+ final List<Traverser.Admin<String>> nopeTraversers = new ArrayList<>(ts.get("nope"));
+ assertEquals(1, nopeTraversers.size());
+ assertEquals(1, nopeTraversers.get(0).bulk());
+ }
+
+ @Test
+ public void shouldClear() {
+ final IndexedTraverserSet<String,String> ts = new IndexedTraverserSet<>(x -> x);
+ ts.add(makeTraverser("test", 1));
+
+ final List<Traverser.Admin<String>> testTraversers = new ArrayList<>(ts.get("test"));
+ assertEquals(1, testTraversers.size());
+ assertEquals(1, testTraversers.get(0).bulk());
+
+ ts.clear();
+
+ assertThat(ts.get("test"), nullValue());
+ assertThat(ts.isEmpty(), is(true));
+ }
+
+ @Test
+ public void shouldRemove() {
+ final IndexedTraverserSet<String, String> ts = makeTraverserSet();
+
+ final List<Traverser.Admin<String>> testTraversers = new ArrayList<>(ts.get("test"));
+ assertEquals(1, testTraversers.size());
+ assertEquals(10, testTraversers.get(0).bulk());
+
+ ts.remove();
+
+ assertThat(ts.get("test"), nullValue());
+
+ final List<Traverser.Admin<String>> nopeTraversers = new ArrayList<>(ts.get("nope"));
+ assertEquals(1, nopeTraversers.size());
+ assertEquals(1, nopeTraversers.get(0).bulk());
+ }
+
+ @Test
+ public void shouldRemoveSpecific() {
+ final IndexedTraverserSet<String, String> ts = makeTraverserSet();
+
+ final List<Traverser.Admin<String>> testTraversers = new ArrayList<>(ts.get("test"));
+ assertEquals(1, testTraversers.size());
+ assertEquals(10, testTraversers.get(0).bulk());
+
+ ts.remove(makeTraverser("test", 1));
+
+ assertThat(ts.get("test"), nullValue());
+
+ final List<Traverser.Admin<String>> nopeTraversers = new ArrayList<>(ts.get("nope"));
+ assertEquals(1, nopeTraversers.size());
+ assertEquals(1, nopeTraversers.get(0).bulk());
+ }
+
+ @Test
+ public void shouldMaintainIndexOfTraversersAfterShuffle() {
+ final IndexedTraverserSet<String, String> ts = makeOtherTraverserSet();
+
+ final List<Traverser.Admin<String>> testTraversers = new ArrayList<>(ts.get("test"));
+ assertEquals(1, testTraversers.size());
+ assertEquals(4, testTraversers.get(0).bulk());
+
+ final List<Traverser.Admin<String>> nopeTraversers = new ArrayList<>(ts.get("nope"));
+ assertEquals(1, nopeTraversers.size());
+ assertEquals(1, nopeTraversers.get(0).bulk());
+
+ ts.shuffle();
+
+ final List<Traverser.Admin<String>> testTraversersAfterShuffle = new ArrayList<>(ts.get("test"));
+ assertEquals(1, testTraversersAfterShuffle.size());
+ assertEquals(4, testTraversersAfterShuffle.get(0).bulk());
+
+ final List<Traverser.Admin<String>> nopeTraversersAfterShuffle = new ArrayList<>(ts.get("nope"));
+ assertEquals(1, nopeTraversersAfterShuffle.size());
+ assertEquals(1, nopeTraversersAfterShuffle.get(0).bulk());
+ }
+
+ @Test
+ public void shouldMaintainIndexOfTraversersAfterSort() {
+ final IndexedTraverserSet<String, String> ts = makeOtherTraverserSet();
+
+ final List<Traverser.Admin<String>> testTraversers = new ArrayList<>(ts.get("test"));
+ assertEquals(1, testTraversers.size());
+ assertEquals(4, testTraversers.get(0).bulk());
+
+ final List<Traverser.Admin<String>> nopeTraversers = new ArrayList<>(ts.get("nope"));
+ assertEquals(1, nopeTraversers.size());
+ assertEquals(1, nopeTraversers.get(0).bulk());
+
+ final List<Traverser<String>> traversersBefore = IteratorUtils.asList(ts.iterator());
+
+ ts.sort(Comparator.comparing(Traverser::get));
+
+ final List<Traverser<String>> traversersAfter = IteratorUtils.asList(ts.iterator());
+
+ final List<Traverser.Admin<String>> testTraversersAfterSort = new ArrayList<>(ts.get("test"));
+ assertEquals(1, testTraversersAfterSort.size());
+ assertEquals(4, testTraversersAfterSort.get(0).bulk());
+
+ final List<Traverser.Admin<String>> nopeTraversersAfterSort = new ArrayList<>(ts.get("nope"));
+ assertEquals(1, nopeTraversersAfterSort.size());
+ assertEquals(1, nopeTraversersAfterSort.get(0).bulk());
+
+ assertNotEquals(traversersBefore, traversersAfter);
+ }
+
+ private IndexedTraverserSet<String, String> makeTraverserSet() {
+ final IndexedTraverserSet<String,String> ts = new IndexedTraverserSet<>(x -> x);
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("nope", 1));
+ return ts;
+ }
+
+ private IndexedTraverserSet<String, String> makeOtherTraverserSet() {
+ final IndexedTraverserSet<String,String> ts = new IndexedTraverserSet<>(x -> x);
+ ts.add(makeTraverser("testf", 1));
+ ts.add(makeTraverser("teste", 1));
+ ts.add(makeTraverser("testd", 1));
+ ts.add(makeTraverser("testc", 1));
+ ts.add(makeTraverser("testa", 1));
+ ts.add(makeTraverser("testb", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("test", 1));
+ ts.add(makeTraverser("nope", 1));
+ return ts;
+ }
+
+ private <T> Traverser.Admin<T> makeTraverser(final T val, final long bulk) {
+ return new B_O_Traverser<>(val, bulk).asAdmin();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/TraverserSetImplementationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/TraverserSetImplementationTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/TraverserSetImplementationTest.java
new file mode 100644
index 0000000..f46d380
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/TraverserSetImplementationTest.java
@@ -0,0 +1,207 @@
+/*
+ * 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.traverser.util;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.function.Supplier;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+@RunWith(Parameterized.class)
+public class TraverserSetImplementationTest {
+ @Parameterized.Parameters(name = "expect({0})")
+ public static Iterable<Object[]> data() {
+ return Arrays.asList(new Object[][]{
+ {TraverserSet.class.getSimpleName(), (Supplier) TraverserSet::new},
+ {IndexedTraverserSet.class.getSimpleName(), (Supplier) () -> new IndexedTraverserSet<String,String>(x -> x.substring(0,1))}});
+ }
+
+ @Parameterized.Parameter(value = 0)
+ public String name;
+
+ @Parameterized.Parameter(value = 1)
+ public Supplier<TraverserSet> traverserSetMaker;
+
+ @Test
+ public void shouldBeEmpty() {
+ assertThat(traverserSetMaker.get().isEmpty(), is(true));
+ }
+
+ @Test
+ public void shouldNotBeEmpty() {
+ final TraverserSet<String> ts = traverserSetMaker.get();
+ ts.add(makeTraverser("test", 1));
+ assertThat(ts.isEmpty(), is(false));
+ }
+
+ @Test
+ public void shouldGetSize() {
+ final TraverserSet<String> ts = traverserSetMaker.get();
+ ts.add(makeTraverser("a", 1));
+ ts.add(makeTraverser("a", 1));
+ ts.add(makeTraverser("b1", 1));
+ ts.add(makeTraverser("b2", 2));
+ ts.add(makeTraverser("c", 1));
+
+ assertEquals(4, ts.size());
+ }
+
+ @Test
+ public void shouldGetBulkSize() {
+ final TraverserSet<String> ts = makeStringTraversers();
+
+ assertEquals(5, ts.bulkSize());
+ }
+
+ @Test
+ public void shouldIterateAll() {
+ final TraverserSet<String> ts = makeStringTraversers();
+
+ final Iterator<Traverser.Admin<String>> itty = ts.iterator();
+ final Traverser.Admin<String> a = itty.next();
+ assertEquals("a", a.get());
+ assertEquals(2, a.bulk());
+
+ final Traverser.Admin<String> b1 = itty.next();
+ assertEquals("b1", b1.get());
+ assertEquals(1, b1.bulk());
+
+ final Traverser.Admin<String> b2 = itty.next();
+ assertEquals("b2", b2.get());
+ assertEquals(1, b2.bulk());
+
+ final Traverser.Admin<String> c = itty.next();
+ assertEquals("c", c.get());
+ assertEquals(1, c.bulk());
+
+ assertThat(itty.hasNext(), is(false));
+ }
+
+ @Test
+ public void shouldGetTraverser() {
+ final TraverserSet<String> ts = makeStringTraversers();
+
+ final Traverser.Admin<String> a = ts.get(makeTraverser("a", 1));
+ assertEquals("a", a.get());
+ assertEquals(2, a.bulk());
+
+ final Traverser.Admin<String> b2 = ts.get(makeTraverser("b2", 1));
+ assertEquals("b2", b2.get());
+ assertEquals(1, b2.bulk());
+
+ final Traverser.Admin<String> notHere = ts.get(makeTraverser("notHere", 1));
+ assertNull(notHere);
+ }
+
+ @Test
+ public void shouldDetermineIfTraverserIsPresent() {
+ final TraverserSet<String> ts = makeStringTraversers();
+
+ assertThat(ts.contains(makeTraverser("a", 1)), is(true));
+ assertThat(ts.contains(makeTraverser("b1", 1)), is(true));
+ assertThat(ts.contains(makeTraverser("b2", 1)), is(true));
+ assertThat(ts.contains(makeTraverser("c", 1)), is(true));
+ assertThat(ts.contains(makeTraverser("notHere", 1)), is(false));
+ }
+
+ @Test
+ public void shouldAddAndMerge() {
+ final TraverserSet<String> ts = traverserSetMaker.get();
+ assertThat(ts.add(makeTraverser("a", 1)), is(true));
+ assertThat(ts.add(makeTraverser("a", 1)), is(false));
+ assertThat(ts.add(makeTraverser("a", 1)), is(false));
+ assertThat(ts.add(makeTraverser("a", 1)), is(false));
+ assertThat(ts.add(makeTraverser("a", 1)), is(false));
+ assertThat(ts.add(makeTraverser("a", 1)), is(false));
+ assertThat(ts.add(makeTraverser("a", 1)), is(false));
+ assertThat(ts.add(makeTraverser("b", 1)), is(true));
+
+ final Iterator<Traverser.Admin<String>> itty = ts.iterator();
+ final Traverser.Admin<String> a = itty.next();
+ assertEquals(7, a.bulk());
+ final Traverser.Admin<String> b = itty.next();
+ assertEquals(1, b.bulk());
+
+ assertThat(itty.hasNext(), is(false));
+ }
+
+ @Test
+ public void shouldOfferTraverser() {
+ final TraverserSet<String> ts = traverserSetMaker.get();
+ assertThat(ts.offer(makeTraverser("a", 1)), is(true));
+ assertThat(ts.offer(makeTraverser("a", 1)), is(false));
+ assertThat(ts.offer(makeTraverser("a", 1)), is(false));
+ assertThat(ts.offer(makeTraverser("a", 1)), is(false));
+ assertThat(ts.offer(makeTraverser("a", 1)), is(false));
+ assertThat(ts.offer(makeTraverser("a", 1)), is(false));
+ assertThat(ts.offer(makeTraverser("a", 1)), is(false));
+ assertThat(ts.offer(makeTraverser("b", 1)), is(true));
+
+ final Iterator<Traverser.Admin<String>> itty = ts.iterator();
+ final Traverser.Admin<String> a = itty.next();
+ assertEquals(7, a.bulk());
+ final Traverser.Admin<String> b = itty.next();
+ assertEquals(1, b.bulk());
+
+ assertThat(itty.hasNext(), is(false));
+ }
+
+ @Test(expected = FastNoSuchElementException.class)
+ public void shouldRemoveTraverserAndThrowBecauseEmpty() {
+ traverserSetMaker.get().remove();
+ }
+
+ @Test
+ public void shouldRemoveTraverser() {
+ final TraverserSet<String> ts = makeStringTraversers();
+ assertEquals(4, ts.size());
+ assertEquals(5, ts.bulkSize());
+ ts.remove();
+ assertEquals(3, ts.size());
+ assertEquals(3, ts.bulkSize());
+ }
+
+ private TraverserSet<String> makeStringTraversers() {
+ final TraverserSet<String> ts = traverserSetMaker.get();
+ ts.add(makeTraverser("a", 1));
+ ts.add(makeTraverser("a", 1));
+ ts.add(makeTraverser("b1", 1));
+ ts.add(makeTraverser("b2", 1));
+ ts.add(makeTraverser("c", 1));
+ return ts;
+ }
+
+ private <T> Traverser.Admin<T> makeTraverser(final T val, final long bulk) {
+ return new B_O_Traverser<>(val, bulk).asAdmin();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/068bef85/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java
index c50109e..db76bbc 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java
@@ -43,7 +43,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.VertexTraverserSet;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.IndexedTraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.util.EmptyTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.util.PureTraversal;
@@ -194,13 +194,11 @@ public abstract class ProgramTest extends AbstractGremlinProcessTest {
assertEquals(2, map.size());
assertTrue(map.values().contains(3l));
assertTrue(map.values().contains(1l));
- final VertexTraverserSet<Object> activeTraversers = new VertexTraverserSet<>();
+ final IndexedTraverserSet<Object,Vertex> activeTraversers = new IndexedTraverserSet.VertexIndexedTraverserSet();
map.keySet().forEach(vertex -> activeTraversers.add(this.haltedTraversers.peek().split(vertex, EmptyStep.instance())));
this.haltedTraversers.clear();
this.checkSideEffects();
memory.set(TraversalVertexProgram.ACTIVE_TRAVERSERS, activeTraversers);
-
-
}
@Override
@@ -319,4 +317,4 @@ public abstract class ProgramTest extends AbstractGremlinProcessTest {
assertEquals(4, bulkSet.get("java"));
}
}
-}
\ No newline at end of file
+}
[34/50] [abbrv] tinkerpop git commit: TINKERPOP-1870: Extends
TraverserSet to have Vertex index for remote traversers That replaces linear
search in reversal traversal interator with hashtable lookup.
Posted by fl...@apache.org.
TINKERPOP-1870: Extends TraverserSet to have Vertex index for remote traversers
That replaces linear search in reversal traversal interator with hashtable lookup.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f1ac225f
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f1ac225f
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f1ac225f
Branch: refs/heads/TINKERPOP-1854
Commit: f1ac225f7bb99c88bb81a058449ad7c224210207
Parents: 231bbb6
Author: artemaliev <artem.aliev@gmail,com>
Authored: Mon Jan 15 18:23:49 2018 +0300
Committer: artemaliev <artem.aliev@gmail,com>
Committed: Fri Jan 19 14:09:53 2018 +0300
----------------------------------------------------------------------
gremlin-core/pom.xml | 10 ++-
.../traversal/TraversalVertexProgram.java | 9 +--
.../computer/traversal/WorkerExecutor.java | 14 ++--
.../traverser/util/VertexTraverserSet.java | 71 ++++++++++++++++++++
.../gremlin/structure/io/gryo/GryoVersion.java | 6 +-
.../process/traversal/step/map/ProgramTest.java | 3 +-
6 files changed, 96 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1ac225f/gremlin-core/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-core/pom.xml b/gremlin-core/pom.xml
index ad48cd8..2aaf0e0 100644
--- a/gremlin-core/pom.xml
+++ b/gremlin-core/pom.xml
@@ -35,6 +35,10 @@ limitations under the License.
<artifactId>commons-configuration</artifactId>
</dependency>
<dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
@@ -95,12 +99,6 @@ limitations under the License.
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
- <!-- needed to test GraphFactory and xml based config via optional dependency in apache configurations -->
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>com.google.testing.compile</groupId>
<artifactId>compile-testing</artifactId>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1ac225f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
index 6f36306..d4c605b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
@@ -53,6 +53,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.ProfileStep;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.VertexTraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics;
@@ -229,13 +230,13 @@ public final class TraversalVertexProgram implements VertexProgram<TraverserSet<
toProcessTraversers.add(traverser);
});
assert this.haltedTraversers.isEmpty();
- final TraverserSet<Object> remoteActiveTraversers = new TraverserSet<>();
+ final VertexTraverserSet<Object> remoteActiveTraversers = new VertexTraverserSet<>();
MasterExecutor.processTraversers(this.traversal, this.traversalMatrix, toProcessTraversers, remoteActiveTraversers, this.haltedTraversers, this.haltedTraverserStrategy);
memory.set(HALTED_TRAVERSERS, this.haltedTraversers);
memory.set(ACTIVE_TRAVERSERS, remoteActiveTraversers);
} else {
memory.set(HALTED_TRAVERSERS, new TraverserSet<>());
- memory.set(ACTIVE_TRAVERSERS, new TraverserSet<>());
+ memory.set(ACTIVE_TRAVERSERS, new VertexTraverserSet<>());
}
// local variable will no longer be used so null it for GC
this.haltedTraversers = null;
@@ -315,12 +316,12 @@ public final class TraversalVertexProgram implements VertexProgram<TraverserSet<
MemoryTraversalSideEffects.setMemorySideEffects(this.traversal.get(), memory, ProgramPhase.TERMINATE);
final boolean voteToHalt = memory.<Boolean>get(VOTE_TO_HALT);
memory.set(VOTE_TO_HALT, true);
- memory.set(ACTIVE_TRAVERSERS, new TraverserSet<>());
+ memory.set(ACTIVE_TRAVERSERS, new VertexTraverserSet<>());
if (voteToHalt) {
// local traverser sets to process
final TraverserSet<Object> toProcessTraversers = new TraverserSet<>();
// traversers that need to be sent back to the workers (no longer can be processed locally by the master traversal)
- final TraverserSet<Object> remoteActiveTraversers = new TraverserSet<>();
+ final VertexTraverserSet<Object> remoteActiveTraversers = new VertexTraverserSet<>();
// halted traversers that have completed their journey
final TraverserSet<Object> haltedTraversers = memory.get(HALTED_TRAVERSERS);
// get all barrier traversers
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1ac225f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/WorkerExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/WorkerExecutor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/WorkerExecutor.java
index e6e73d0..a875afe 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/WorkerExecutor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/WorkerExecutor.java
@@ -31,6 +31,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.LocalBarrier;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.VertexTraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMatrix;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
@@ -40,6 +41,7 @@ import org.apache.tinkerpop.gremlin.structure.util.Attachable;
import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
@@ -73,17 +75,19 @@ final class WorkerExecutor {
// MASTER ACTIVE
// these are traversers that are going from OLTP (master) to OLAP (workers)
// these traversers were broadcasted from the master traversal to the workers for attachment
- final TraverserSet<Object> maybeActiveTraversers = memory.get(TraversalVertexProgram.ACTIVE_TRAVERSERS);
+ final VertexTraverserSet<Object> maybeActiveTraversers = memory.get(TraversalVertexProgram.ACTIVE_TRAVERSERS);
// some memory systems are interacted with by multiple threads and thus, concurrent modification can happen at iterator.remove().
// its better to reduce the memory footprint and shorten the active traverser list so synchronization is worth it.
// most distributed OLAP systems have the memory partitioned and thus, this synchronization does nothing.
synchronized (maybeActiveTraversers) {
if (!maybeActiveTraversers.isEmpty()) {
- final Iterator<Traverser.Admin<Object>> iterator = maybeActiveTraversers.iterator();
- while (iterator.hasNext()) {
- final Traverser.Admin<Object> traverser = iterator.next();
- if (vertex.equals(WorkerExecutor.getHostingVertex(traverser.get()))) {
+ final Collection<Traverser.Admin<Object>> traversers = maybeActiveTraversers.get(vertex);
+ if (traversers != null) {
+ final Iterator<Traverser.Admin<Object>> iterator = traversers.iterator();
+ while (iterator.hasNext()) {
+ final Traverser.Admin<Object> traverser = iterator.next();
iterator.remove();
+ maybeActiveTraversers.remove(traverser);
traverser.attach(Attachable.Method.get(vertex));
traverser.setSideEffects(traversalSideEffects);
toProcessTraversers.add(traverser);
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1ac225f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/VertexTraverserSet.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/VertexTraverserSet.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/VertexTraverserSet.java
new file mode 100644
index 0000000..05ba3a0
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/VertexTraverserSet.java
@@ -0,0 +1,71 @@
+/*
+ * 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.traverser.util;
+
+import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
+import java.util.Collection;
+
+public class VertexTraverserSet<S> extends TraverserSet<S> {
+ // that should be MultiValueMap<Vertex, Traverser.Admin<S>> but 3.2.2 apache collection do not use generics
+ private final MultiValueMap vertexIndex = new MultiValueMap();
+
+ @Override
+ public void clear() {
+ vertexIndex.clear();
+ super.clear();
+ }
+
+ @Override
+ public boolean add(final Traverser.Admin<S> traverser) {
+ if (super.add(traverser)) {
+ vertexIndex.put(getHostingVertex(traverser.get()), traverser);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public Collection<Traverser.Admin<S>> get(Vertex v) {
+ return vertexIndex.getCollection(v);
+ }
+
+ @Override
+ public boolean offer(final Traverser.Admin<S> traverser) {
+ return this.add(traverser);
+ }
+
+ private static Vertex getHostingVertex(final Object object) {
+ Object obj = object;
+ while (true) {
+ if (obj instanceof Vertex)
+ return (Vertex) obj;
+ else if (obj instanceof Edge)
+ return ((Edge) obj).outVertex();
+ else if (obj instanceof Property)
+ obj = ((Property) obj).element();
+ else
+ throw new IllegalStateException("The host of the object is unknown: " + obj.toString() + ':' + obj.getClass().getCanonicalName());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1ac225f/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 f7e5a1d..6d76ce8 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
@@ -52,6 +52,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.traverser.LP_O_OB_S_SE_SL_
import org.apache.tinkerpop.gremlin.process.traversal.traverser.O_OB_S_SE_SL_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.O_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.ProjectedTraverser;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.VertexTraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics;
import org.apache.tinkerpop.gremlin.process.traversal.util.ImmutableMetrics;
@@ -204,7 +205,7 @@ public enum GryoVersion {
add(GryoTypeReg.of(HashMap.class, 11));
add(GryoTypeReg.of(HashMap.Entry.class, 16));
add(GryoTypeReg.of(Types.HASH_MAP_NODE, 92));
- add(GryoTypeReg.of(Types.HASH_MAP_TREE_NODE, 170)); // ***LAST ID***
+ add(GryoTypeReg.of(Types.HASH_MAP_TREE_NODE, 170));
add(GryoTypeReg.of(KryoSerializable.class, 36));
add(GryoTypeReg.of(LinkedHashMap.class, 47));
add(GryoTypeReg.of(LinkedHashSet.class, 71));
@@ -268,6 +269,7 @@ public enum GryoVersion {
add(GryoTypeReg.of(MultiComparator.class, 165));
add(GryoTypeReg.of(TraverserSet.class, 58));
+
add(GryoTypeReg.of(Tree.class, 61));
add(GryoTypeReg.of(HashSet.class, 62));
add(GryoTypeReg.of(BulkSet.class, 64));
@@ -305,6 +307,8 @@ public enum GryoVersion {
add(GryoTypeReg.of(RangeGlobalStep.RangeBiOperator.class, 114));
add(GryoTypeReg.of(OrderGlobalStep.OrderBiOperator.class, 118, new JavaSerializer()));
add(GryoTypeReg.of(ProfileStep.ProfileBiOperator.class, 119));
+ // skip 171, 172 to sync with tp33
+ add(GryoTypeReg.of(VertexTraverserSet.class, 173)); // ***LAST ID***
}};
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1ac225f/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java
index 5f548da..c50109e 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java
@@ -43,6 +43,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.VertexTraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.util.EmptyTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.util.PureTraversal;
@@ -193,7 +194,7 @@ public abstract class ProgramTest extends AbstractGremlinProcessTest {
assertEquals(2, map.size());
assertTrue(map.values().contains(3l));
assertTrue(map.values().contains(1l));
- final TraverserSet<Object> activeTraversers = new TraverserSet<>();
+ final VertexTraverserSet<Object> activeTraversers = new VertexTraverserSet<>();
map.keySet().forEach(vertex -> activeTraversers.add(this.haltedTraversers.peek().split(vertex, EmptyStep.instance())));
this.haltedTraversers.clear();
this.checkSideEffects();
[25/50] [abbrv] tinkerpop git commit: Support multiple mime types
Posted by fl...@apache.org.
Support multiple mime types
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b7f85ca5
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b7f85ca5
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b7f85ca5
Branch: refs/heads/TINKERPOP-1854
Commit: b7f85ca5d167eac2443d7f5eb25423a8a7b4f6d4
Parents: 93cf86d
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Wed Nov 29 12:02:50 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:17 2018 +0100
----------------------------------------------------------------------
.../lib/driver/driver-remote-connection.js | 15 +++++++++------
.../lib/driver/remote-connection.js | 2 +-
2 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b7f85ca5/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 31f27cd..51661c3 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -29,8 +29,7 @@ var RemoteConnection = require('./remote-connection').RemoteConnection;
var utils = require('../utils');
var serializer = require('../structure/io/graph-serializer');
var inherits = utils.inherits;
-var mimeType = 'application/vnd.gremlin-v2.0+json';
-var header = String.fromCharCode(mimeType.length) + mimeType;
+var defaultMimeType = 'application/vnd.gremlin-v2.0+json';
var responseStatusCode = {
success: 200,
noContent: 204,
@@ -41,16 +40,18 @@ var responseStatusCode = {
* Creates a new instance of DriverRemoteConnection.
* @param {String} url The resource uri.
* @param {Object} [options] The connection options.
- * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
* @param {Array} [options.ca] Trusted certificates.
* @param {String|Array|Buffer} [options.cert] The certificate key.
+ * @param {String} [options.mimeType] The mime type to use.
* @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs.
- * @param {GraphSONReader} [options.reader] The GraphSON2 reader to use.
+ * @param {GraphSONReader} [options.reader] The reader to use.
* @param {Boolean} [options.rejectUnauthorized] Determines whether to verify or not the server certificate.
- * @param {GraphSONWriter} [options.writer] The GraphSON2 writer to use.
+ * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
+ * @param {GraphSONWriter} [options.writer] The writer to use.
* @constructor
*/
function DriverRemoteConnection(url, options) {
+ RemoteConnection.call(this, url);
options = options || {};
this._ws = new WebSocket(url, {
ca: options.ca,
@@ -75,6 +76,8 @@ function DriverRemoteConnection(url, options) {
this._openPromise = null;
this._openCallback = null;
this._closePromise = null;
+ var mimeType = options.mimeType || defaultMimeType;
+ this._header = String.fromCharCode(mimeType.length) + mimeType;
this.isOpen = false;
this.traversalSource = options.traversalSource || 'g';
}
@@ -114,7 +117,7 @@ DriverRemoteConnection.prototype.submit = function (bytecode, promiseFactory) {
callback: callback,
result: null
};
- var message = bufferFromString(header + JSON.stringify(self._getRequest(requestId, bytecode)));
+ var message = bufferFromString(self._header + JSON.stringify(self._getRequest(requestId, bytecode)));
self._ws.send(message);
});
});
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b7f85ca5/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
index 8176c37..235375a 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
@@ -27,7 +27,7 @@ var TraversalStrategy = require('../process/traversal-strategy').TraversalStrate
var utils = require('../utils');
var inherits = utils.inherits;
-function RemoteConnection(url, traversalSource) {
+function RemoteConnection(url) {
this.url = url;
}
[35/50] [abbrv] tinkerpop git commit: TINKERPOP-1871: improve
performace by elimating exception creation in ComputerAdjacentVertex
Posted by fl...@apache.org.
TINKERPOP-1871: improve performace by elimating exception creation in ComputerAdjacentVertex
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b22d78be
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b22d78be
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b22d78be
Branch: refs/heads/TINKERPOP-1854
Commit: b22d78be2633eaf2ad5de1d22539563d17db4d9a
Parents: 231bbb6
Author: artemaliev <artem.aliev@gmail,com>
Authored: Fri Dec 29 12:49:28 2017 +0300
Committer: artemaliev <artem.aliev@gmail,com>
Committed: Fri Jan 19 14:16:21 2018 +0300
----------------------------------------------------------------------
.../gremlin/structure/util/reference/ReferenceElement.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b22d78be/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
index 2e45903..1da8144 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
@@ -18,6 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.structure.util.reference;
+import org.apache.tinkerpop.gremlin.process.computer.util.ComputerGraph;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -44,7 +45,12 @@ public abstract class ReferenceElement<E extends Element> implements Element, Se
public ReferenceElement(final Element element) {
this.id = element.id();
try {
- this.label = element.label();
+ //Exception creation takes too much time, return default values for known types
+ if (element instanceof ComputerGraph.ComputerAdjacentVertex) {
+ this.label = VertexProperty.DEFAULT_LABEL;
+ } else {
+ this.label = element.label();
+ }
} catch (final UnsupportedOperationException e) {
if (element instanceof Vertex)
this.label = Vertex.DEFAULT_LABEL;
[02/50] [abbrv] tinkerpop git commit: Export enums and fix
TraversalStrategies#applyStrategies()
Posted by fl...@apache.org.
Export enums and fix TraversalStrategies#applyStrategies()
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/10c71551
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/10c71551
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/10c71551
Branch: refs/heads/TINKERPOP-1854
Commit: 10c7155166e815304773eef5dc0076f20370aa81
Parents: 2d85056
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Oct 7 12:01:30 2016 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:14 2018 +0100
----------------------------------------------------------------------
.../GraphTraversalSourceGenerator.groovy | 4 +-
.../javascript/TraversalSourceGenerator.groovy | 52 +++++++++-----------
.../driver/remote-connection.js | 2 +-
.../main/javascript/gremlin-javascript/index.js | 11 ++++-
.../process/graph-traversal.js | 4 +-
.../gremlin-javascript/process/traversal.js | 44 ++++++++---------
.../gremlin-javascript/test-exports.js | 15 ++++--
.../gremlin-javascript/test-graphson.js | 2 +-
.../gremlin-javascript/test-traversal.js | 17 ++++++-
9 files changed, 87 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/10c71551/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
index 81c38dc..b569292 100644
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
+++ b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
@@ -87,12 +87,12 @@ class GraphTraversalSourceGenerator {
/**
* @param remoteConnection
- * @returns {GraphTraversal}
+ * @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withRemote = function (remoteConnection) {
var traversalStrategy = new t.TraversalStrategies(this._traversalStrategies);
traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
- return new GraphTraversal(this._graph, traversalStrategy, new Bytecode(this._bytecode));
+ return new GraphTraversalSource(this._graph, traversalStrategy, new Bytecode(this._bytecode));
};
/**
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/10c71551/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
index efcb826..5b07a32 100644
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
+++ b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
@@ -177,11 +177,14 @@ class TraversalSourceGenerator {
this.strategies.push(strategy);
};
- /** @param {Traversal} traversal */
- TraversalStrategies.prototype.applyStrategies = function (traversal) {
- this.strategies.forEach(function eachStrategy(s) {
- s.apply(traversal);
- });
+ /**
+ * @param {Traversal} traversal
+ * @param {Function} callback
+ */
+ TraversalStrategies.prototype.applyStrategies = function (traversal, callback) {
+ eachSeries(this.strategies, function eachStrategy(s, next) {
+ s.apply(traversal, next);
+ }, callback);
};
/**
@@ -195,8 +198,9 @@ class TraversalSourceGenerator {
/**
* @abstract
* @param {Traversal} traversal
+ * @param {Function} callback
*/
- TraversalStrategy.prototype.apply = function (traversal) {
+ TraversalStrategy.prototype.apply = function (traversal, callback) {
};
@@ -290,24 +294,6 @@ class TraversalSourceGenerator {
this.elementName = elementName;
}
- /**
- * @type {{barrier, cardinality, column, direction, operator, order, pop, scope, t}}
- */
- var enums = {};\n""")
-
- for (final Class<? extends Enum> enumClass : CoreImports.getClassImports()
- .findAll { Enum.class.isAssignableFrom(it) }
- .sort { a, b -> a.getSimpleName() <=> b.getSimpleName() }
- .collect()) {
- moduleOutput.append(" enums.${SymbolHelper.decapitalize(enumClass.getSimpleName())} = " +
- "toEnum('${SymbolHelper.toJs(enumClass.getSimpleName())}', '");
- enumClass.getEnumConstants()
- .sort { a, b -> a.name() <=> b.name() }
- .each { value -> moduleOutput.append("${SymbolHelper.toJs(value.name())} "); }
- moduleOutput.deleteCharAt(moduleOutput.length() - 1).append("');\n")
- }
-
- moduleOutput.append("""
// Utility functions
/** @returns {Array} */
function parseArgs() {
@@ -376,11 +362,21 @@ class TraversalSourceGenerator {
TraversalSideEffects: TraversalSideEffects,
TraversalStrategies: TraversalStrategies,
TraversalStrategy: TraversalStrategy,
- Traverser: Traverser
+ Traverser: Traverser""")
+ for (final Class<? extends Enum> enumClass : CoreImports.getClassImports()
+ .findAll { Enum.class.isAssignableFrom(it) }
+ .sort { a, b -> a.getSimpleName() <=> b.getSimpleName() }
+ .collect()) {
+ moduleOutput.append(",\n ${SymbolHelper.decapitalize(enumClass.getSimpleName())}: " +
+ "toEnum('${SymbolHelper.toJs(enumClass.getSimpleName())}', '");
+ enumClass.getEnumConstants()
+ .sort { a, b -> a.name() <=> b.name() }
+ .each { value -> moduleOutput.append("${SymbolHelper.toJs(value.name())} "); }
+ moduleOutput.deleteCharAt(moduleOutput.length() - 1).append("')")
+ }
+
+ moduleOutput.append("""
};
- Object.keys(enums).forEach(function (k) {
- toExport[k] = enums[k];
- });
if (typeof module !== 'undefined') {
// CommonJS
module.exports = toExport;
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/10c71551/gremlin-javascript/src/main/javascript/gremlin-javascript/driver/remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/driver/remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/driver/remote-connection.js
index 99b177f..e19b537 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/driver/remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/driver/remote-connection.js
@@ -68,7 +68,7 @@
/** @override */
RemoteStrategy.prototype.apply = function (traversal, callback) {
if (traversal.traversers) {
- return;
+ return callback();
}
this.connection.submit(traversal.getBytecode(), function (err, remoteTraversal) {
if (err) {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/10c71551/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index cda8200..ddcdac2 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -49,14 +49,21 @@
process: {
Bytecode: t.Bytecode,
EnumValue: t.EnumValue,
- inherits: t.inherits,
P: t.P,
- parseArgs: t.parseArgs,
Traversal: t.Traversal,
TraversalSideEffects: t.TraversalSideEffects,
TraversalStrategies: t.TraversalStrategies,
TraversalStrategy: t.TraversalStrategy,
Traverser: t.Traverser,
+ barrier: t.barrier,
+ cardinality: t.cardinality,
+ column: t.column,
+ direction: t.direction,
+ operator: t.operator,
+ order: t.order,
+ pop: t.pop,
+ scope: t.scope,
+ t: t.t,
GraphTraversal: gt.GraphTraversal,
GraphTraversalSource: gt.GraphTraversalSource,
statics: gt.statics
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/10c71551/gremlin-javascript/src/main/javascript/gremlin-javascript/process/graph-traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/graph-traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/graph-traversal.js
index d9803ba..1a6356b 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/graph-traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/graph-traversal.js
@@ -44,12 +44,12 @@
/**
* @param remoteConnection
- * @returns {GraphTraversal}
+ * @returns {GraphTraversalSource}
*/
GraphTraversalSource.prototype.withRemote = function (remoteConnection) {
var traversalStrategy = new t.TraversalStrategies(this._traversalStrategies);
traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
- return new GraphTraversal(this._graph, traversalStrategy, new Bytecode(this._bytecode));
+ return new GraphTraversalSource(this._graph, traversalStrategy, new Bytecode(this._bytecode));
};
/**
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/10c71551/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
index 5c9bf6c..ff2927e 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
@@ -185,11 +185,14 @@
this.strategies.push(strategy);
};
- /** @param {Traversal} traversal */
- TraversalStrategies.prototype.applyStrategies = function (traversal) {
- this.strategies.forEach(function eachStrategy(s) {
- s.apply(traversal);
- });
+ /**
+ * @param {Traversal} traversal
+ * @param {Function} callback
+ */
+ TraversalStrategies.prototype.applyStrategies = function (traversal, callback) {
+ eachSeries(this.strategies, function eachStrategy(s, next) {
+ s.apply(traversal, next);
+ }, callback);
};
/**
@@ -203,8 +206,9 @@
/**
* @abstract
* @param {Traversal} traversal
+ * @param {Function} callback
*/
- TraversalStrategy.prototype.apply = function (traversal) {
+ TraversalStrategy.prototype.apply = function (traversal, callback) {
};
@@ -298,20 +302,6 @@
this.elementName = elementName;
}
- /**
- * @type {{barrier, cardinality, column, direction, operator, order, pop, scope, t}}
- */
- var enums = {};
- enums.barrier = toEnum('Barrier', 'normSack');
- enums.cardinality = toEnum('Cardinality', 'list set single');
- enums.column = toEnum('Column', 'keys values');
- enums.direction = toEnum('Direction', 'BOTH IN OUT');
- enums.operator = toEnum('Operator', 'addAll and assign div max min minus mult or sum sumLong');
- enums.order = toEnum('Order', 'decr incr keyDecr keyIncr shuffle valueDecr valueIncr');
- enums.pop = toEnum('Pop', 'all first last');
- enums.scope = toEnum('Scope', 'global local');
- enums.t = toEnum('T', 'id key label value');
-
// Utility functions
/** @returns {Array} */
function parseArgs() {
@@ -380,11 +370,17 @@
TraversalSideEffects: TraversalSideEffects,
TraversalStrategies: TraversalStrategies,
TraversalStrategy: TraversalStrategy,
- Traverser: Traverser
+ Traverser: Traverser,
+ barrier: toEnum('Barrier', 'normSack'),
+ cardinality: toEnum('Cardinality', 'list set single'),
+ column: toEnum('Column', 'keys values'),
+ direction: toEnum('Direction', 'BOTH IN OUT'),
+ operator: toEnum('Operator', 'addAll and assign div max min minus mult or sum sumLong'),
+ order: toEnum('Order', 'decr incr keyDecr keyIncr shuffle valueDecr valueIncr'),
+ pop: toEnum('Pop', 'all first last'),
+ scope: toEnum('Scope', 'global local'),
+ t: toEnum('T', 'id key label value')
};
- Object.keys(enums).forEach(function (k) {
- toExport[k] = enums[k];
- });
if (typeof module !== 'undefined') {
// CommonJS
module.exports = toExport;
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/10c71551/gremlin-javascript/src/test/javascript/gremlin-javascript/test-exports.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/test/javascript/gremlin-javascript/test-exports.js b/gremlin-javascript/src/test/javascript/gremlin-javascript/test-exports.js
index 6edb323..b9265c7 100644
--- a/gremlin-javascript/src/test/javascript/gremlin-javascript/test-exports.js
+++ b/gremlin-javascript/src/test/javascript/gremlin-javascript/test-exports.js
@@ -34,9 +34,7 @@
assert.ok(glvModule.process);
assert.strictEqual(typeof glvModule.process.Bytecode, 'function');
assert.strictEqual(typeof glvModule.process.EnumValue, 'function');
- assert.strictEqual(typeof glvModule.process.inherits, 'function');
assert.strictEqual(typeof glvModule.process.P, 'function');
- assert.strictEqual(typeof glvModule.process.parseArgs, 'function');
assert.strictEqual(typeof glvModule.process.Traversal, 'function');
assert.strictEqual(typeof glvModule.process.TraversalSideEffects, 'function');
assert.strictEqual(typeof glvModule.process.TraversalStrategies, 'function');
@@ -44,6 +42,17 @@
assert.strictEqual(typeof glvModule.process.Traverser, 'function');
assert.strictEqual(typeof glvModule.process.GraphTraversal, 'function');
assert.strictEqual(typeof glvModule.process.GraphTraversalSource, 'function');
+ assert.strictEqual(typeof glvModule.process.barrier, 'object');
+ assert.strictEqual(typeof glvModule.process.cardinality, 'object');
+ assert.strictEqual(typeof glvModule.process.column, 'object');
+ assert.strictEqual(typeof glvModule.process.direction, 'object');
+ assert.strictEqual(typeof glvModule.process.operator, 'object');
+ assert.strictEqual(typeof glvModule.process.order, 'object');
+ assert.strictEqual(typeof glvModule.process.pop, 'object');
+ assert.strictEqual(typeof glvModule.process.scope, 'object');
+ assert.strictEqual(typeof glvModule.process.t, 'object');
+
+
assert.ok(glvModule.process.statics);
assert.ok(glvModule.structure);
@@ -75,4 +84,4 @@
}
throw new Error('No module loader was found');
}
-}).call(this)
\ No newline at end of file
+}).call(this);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/10c71551/gremlin-javascript/src/test/javascript/gremlin-javascript/test-graphson.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/test/javascript/gremlin-javascript/test-graphson.js b/gremlin-javascript/src/test/javascript/gremlin-javascript/test-graphson.js
index e44ef90..418a9dd 100644
--- a/gremlin-javascript/src/test/javascript/gremlin-javascript/test-graphson.js
+++ b/gremlin-javascript/src/test/javascript/gremlin-javascript/test-graphson.js
@@ -87,7 +87,7 @@
assert.strictEqual(writer.write(true), 'true');
assert.strictEqual(writer.write(false), 'false');
},
- function testWriteNumber() {
+ function testWriteP() {
var writer = new GraphSONWriter();
var expected = JSON.stringify({"@type":"g:P","@value":{"predicate":"and","value":[{"@type":"g:P","@value":{"predicate":"or","value":[{"@type":"g:P","@value":{"predicate":"lt","value":"b"}},{"@type":"g:P","@value":{"predicate":"gt","value":"c"}}]}},{"@type":"g:P","@value":{"predicate":"neq","value":"d"}}]}});
assert.strictEqual(writer.write(P.lt("b").or(P.gt("c")).and(P.neq("d"))), expected);
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/10c71551/gremlin-javascript/src/test/javascript/gremlin-javascript/test-traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/test/javascript/gremlin-javascript/test-traversal.js b/gremlin-javascript/src/test/javascript/gremlin-javascript/test-traversal.js
index 477df91..1ec4253 100644
--- a/gremlin-javascript/src/test/javascript/gremlin-javascript/test-traversal.js
+++ b/gremlin-javascript/src/test/javascript/gremlin-javascript/test-traversal.js
@@ -26,9 +26,10 @@
var helper = loadModule.call(this, './helper.js');
var assert = helper.assert;
var graph = helper.loadLibModule.call(this, 'structure/graph.js');
+ var t = helper.loadLibModule.call(this, 'process/traversal.js');
[
- function testBytecode() {
+ function testBytecode1() {
var g = new graph.Graph().traversal();
var bytecode = g.V().out('created').getBytecode();
assert.ok(bytecode);
@@ -37,6 +38,20 @@
assert.strictEqual(bytecode.stepInstructions[0][0], 'V');
assert.strictEqual(bytecode.stepInstructions[1][0], 'out');
assert.strictEqual(bytecode.stepInstructions[1][1], 'created');
+ },
+ function testBytecode2() {
+ var g = new graph.Graph().traversal();
+ var bytecode = g.V().order().by('age', t.order.decr).getBytecode();
+ assert.ok(bytecode);
+ assert.strictEqual(bytecode.sourceInstructions.length, 0);
+ assert.strictEqual(bytecode.stepInstructions.length, 3);
+ assert.strictEqual(bytecode.stepInstructions[0][0], 'V');
+ assert.strictEqual(bytecode.stepInstructions[1][0], 'order');
+ assert.strictEqual(bytecode.stepInstructions[2][0], 'by');
+ assert.strictEqual(bytecode.stepInstructions[2][1], 'age');
+ assert.strictEqual(typeof bytecode.stepInstructions[2][2], 'object');
+ assert.strictEqual(bytecode.stepInstructions[2][2].typeName, 'Order');
+ assert.strictEqual(bytecode.stepInstructions[2][2].elementName, 'decr');
}
].forEach(function (testCase) {
testCase.call(null);
[18/50] [abbrv] tinkerpop git commit: Path assertions and feature
step fixes
Posted by fl...@apache.org.
Path assertions and feature step fixes
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b8eb6c0b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b8eb6c0b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b8eb6c0b
Branch: refs/heads/TINKERPOP-1854
Commit: b8eb6c0b850af830d5c639de306b75aa4a1893ba
Parents: e95b8ea
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Nov 28 12:51:59 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:16 2018 +0100
----------------------------------------------------------------------
.../test/cucumber/feature-steps.js | 48 ++++++++++++++++----
1 file changed, 40 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b8eb6c0b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
index 8ec2bdc..99e2ec8 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -80,9 +80,8 @@ defineSupportCode(function(methods) {
if (this.graphName === 'empty') {
p = this.loadEmptyGraphData();
}
- const self = this;
return p.then(() => {
- self.parameters[paramName] = parseValue.call(self, stringValue);
+ this.parameters[paramName] = parseValue.call(this, stringValue);
}).catch(err => {
if (err instanceof IgnoreError) {
return 'skipped';
@@ -96,7 +95,13 @@ defineSupportCode(function(methods) {
});
methods.When('iterated next', function () {
- return this.traversal.next().then(it => this.result = it.value);
+ return this.traversal.next().then(it => {
+ this.result = it.value;
+ if (this.result instanceof Path) {
+ // Compare using the objects array
+ this.result = this.result.objects;
+ }
+ });
});
methods.Then(/^the result should be (\w+)$/, function assertResult(characterizedAs, resultTable) {
@@ -110,13 +115,14 @@ defineSupportCode(function(methods) {
const expectedResult = resultTable.rows().map(row => parseRow.call(this, row));
switch (characterizedAs) {
case 'ordered':
- expect(this.result).to.have.deep.ordered.members(expectedResult);
+ expect(toCompare(this.result)).to.have.deep.ordered.members(expectedResult);
break;
case 'unordered':
- expect(this.result).to.have.deep.members(expectedResult);
+ expect(toCompare(this.result)).to.have.deep.members(expectedResult);
break;
case 'of':
- expect(this.result).to.include.deep.members(expectedResult);
+ // result is a subset of the expected
+ expect(expectedResult).to.include.deep.members(toCompare(this.result));
break;
}
});
@@ -156,7 +162,11 @@ function getSandbox(g, parameters) {
__: __,
Cardinality: traversalModule.cardinality,
Column: traversalModule.column,
- Direction: traversalModule.direction,
+ Direction: {
+ BOTH: traversalModule.direction.both,
+ IN: traversalModule.direction.in,
+ OUT: traversalModule.direction.out
+ },
Order: traversalModule.order,
P: traversalModule.P,
Pick: traversalModule.pick,
@@ -172,6 +182,8 @@ function getSandbox(g, parameters) {
function translate(traversalText) {
// Remove escaped chars
traversalText = traversalText.replace(/\\"/g, '"');
+ // Remove long suffix
+ traversalText = traversalText.replace(/\b(\d+)l\b/gi, '$1');
// Change according to naming convention
traversalText = traversalText.replace(/\.in\(/g, '.in_(');
traversalText = traversalText.replace(/\.from\(/g, '.from_(');
@@ -231,7 +243,7 @@ function toEdgeIdString(name) {
function toPath(value) {
const parts = value.split(',');
- return new Path(parts.map(_ => new Array(0)), parts.map(x => parseValue.call(this, x)));
+ return new Path(new Array(0), parts.map(x => parseValue.call(this, x)));
}
function toArray(stringList) {
@@ -273,6 +285,26 @@ function toLambda() {
throw new IgnoreError(IgnoreError.reason.lambdaNotSupported);
}
+/**
+ * Adapts the object to be compared, removing labels property of the Path.
+ */
+function toCompare(obj) {
+ if (!obj) {
+ return obj;
+ }
+ if (typeof obj !== 'object') {
+ return obj;
+ }
+ if (Array.isArray(obj)) {
+ return obj.map(toCompare);
+ }
+ if (obj instanceof Path) {
+ // labels are ignored
+ obj.labels = new Array(0);
+ }
+ return obj;
+}
+
function IgnoreError(reason) {
Error.call(this, reason);
Error.captureStackTrace(this, IgnoreError);
[20/50] [abbrv] tinkerpop git commit: Traversal iterate() method
Posted by fl...@apache.org.
Traversal iterate() method
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/219ead0e
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/219ead0e
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/219ead0e
Branch: refs/heads/TINKERPOP-1854
Commit: 219ead0ebe728a5694a857da2f221f7e3f3e6237
Parents: 53a7f27
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Nov 27 12:22:08 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:16 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/glv/TraversalSource.template | 12 +++++++++++
.../gremlin-javascript/lib/process/traversal.js | 12 +++++++++++
.../javascript/gremlin-javascript/package.json | 2 +-
.../test/unit/traversal-test.js | 21 ++++++++++++++++++--
4 files changed, 44 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/219ead0e/gremlin-javascript/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template
index f75765f..0d45e90 100644
--- a/gremlin-javascript/glv/TraversalSource.template
+++ b/gremlin-javascript/glv/TraversalSource.template
@@ -58,6 +58,18 @@ Traversal.prototype.toList = function () {
};
/**
+ * Iterates all Traverser instances in the traversal.
+ * @returns {Promise}
+ */
+Traversal.prototype.iterate = function () {
+ return this._applyStrategies().then(() => {
+ let it;
+ while ((it = this._getNext()) && !it.done) {
+ }
+ });
+};
+
+/**
* Async iterator method implementation.
* Returns a promise containing an iterator item.
* @returns {Promise.<{value, done}>}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/219ead0e/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
index ebf8755..d887fe0 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
@@ -58,6 +58,18 @@ Traversal.prototype.toList = function () {
};
/**
+ * Iterates all Traverser instances in the traversal.
+ * @returns {Promise}
+ */
+Traversal.prototype.iterate = function () {
+ return this._applyStrategies().then(() => {
+ let it;
+ while ((it = this._getNext()) && !it.done) {
+ }
+ });
+};
+
+/**
* Async iterator method implementation.
* Returns a promise containing an iterator item.
* @returns {Promise.<{value, done}>}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/219ead0e/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index aae9eb9..7c4a3d6 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -30,7 +30,7 @@
},
"scripts": {
"test": "./node_modules/.bin/mocha test/unit test/integration -t 5000",
- "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/",
+ "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/map/AddVertex.feature",
"unit-test": "./node_modules/.bin/mocha test/unit"
},
"engines": {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/219ead0e/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
index 635c7e8..2be504b 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
@@ -32,7 +32,6 @@ const TraversalStrategies = require('../../lib/process/traversal-strategy').Trav
describe('Traversal', function () {
describe('#getByteCode()', function () {
-
it('should add steps for with a string parameter', function () {
var g = new graph.Graph().traversal();
var bytecode = g.V().out('created').getBytecode();
@@ -61,7 +60,6 @@ describe('Traversal', function () {
});
describe('#next()', function () {
-
it('should apply the strategies and return a Promise with the iterator item', function () {
var strategyMock = {
apply: function (traversal) {
@@ -175,4 +173,23 @@ describe('Traversal', function () {
});
});
});
+
+ describe('#iterate()', function () {
+ it('should apply the strategies and return a Promise', function () {
+ let applied = false;
+ const strategyMock = {
+ apply: function (traversal) {
+ applied = true;
+ traversal.traversers = [ new t.Traverser('a', 1), new t.Traverser('b', 1) ];
+ return utils.resolvedPromise();
+ }
+ };
+ const strategies = new TraversalStrategies();
+ strategies.addStrategy(strategyMock);
+ const traversal = new t.Traversal(null, strategies, null);
+ return traversal.iterate().then(() => {
+ assert.strictEqual(applied, true);
+ });
+ });
+ });
});
\ No newline at end of file
[49/50] [abbrv] tinkerpop git commit: Merge branch 'TINKERPOP-1489'
into tp32
Posted by fl...@apache.org.
Merge branch 'TINKERPOP-1489' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/0bcab7ff
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/0bcab7ff
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/0bcab7ff
Branch: refs/heads/TINKERPOP-1854
Commit: 0bcab7ff3a3c35109c6b6d04d55d8110a6b80925
Parents: 389394c 328c936
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Jan 25 11:33:11 2018 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Jan 25 11:33:11 2018 +0100
----------------------------------------------------------------------
.travis.install-maven.sh | 19 +
.travis.yml | 14 +-
docker/build/Dockerfile.template | 4 +
.../developer/development-environment.asciidoc | 15 +
docs/src/reference/gremlin-variants.asciidoc | 75 +-
.../glv/GraphTraversalSource.template | 126 ++
gremlin-javascript/glv/PackageJson.template | 59 +
gremlin-javascript/glv/TraversalSource.template | 201 +++
gremlin-javascript/glv/generate.groovy | 107 ++
gremlin-javascript/pom.xml | 301 +++++
.../javascript/gremlin-javascript/.gitignore | 5 +
.../javascript/gremlin-javascript/.npmignore | 26 +
.../javascript/gremlin-javascript/README.md | 39 +
.../main/javascript/gremlin-javascript/index.js | 75 ++
.../lib/driver/driver-remote-connection.js | 194 +++
.../lib/driver/remote-connection.js | 77 ++
.../gremlin-javascript/lib/process/bytecode.js | 98 ++
.../lib/process/graph-traversal.js | 1264 ++++++++++++++++++
.../lib/process/traversal-strategy.js | 75 ++
.../gremlin-javascript/lib/process/traversal.js | 268 ++++
.../gremlin-javascript/lib/structure/graph.js | 168 +++
.../lib/structure/io/graph-serializer.js | 181 +++
.../lib/structure/io/type-serializers.js | 295 ++++
.../javascript/gremlin-javascript/lib/utils.js | 35 +
.../javascript/gremlin-javascript/package.json | 40 +
.../test/cucumber/feature-steps.js | 327 +++++
.../gremlin-javascript/test/cucumber/world.js | 126 ++
.../gremlin-javascript/test/helper.js | 29 +
.../test/integration/remote-connection-tests.js | 58 +
.../test/integration/traversal-test.js | 69 +
.../test/unit/exports-test.js | 73 +
.../test/unit/graphson-test.js | 112 ++
.../test/unit/traversal-test.js | 194 +++
pom.xml | 6 +
34 files changed, 4751 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0bcab7ff/docs/src/dev/developer/development-environment.asciidoc
----------------------------------------------------------------------
[47/50] [abbrv] tinkerpop git commit: Grammar CTR
Posted by fl...@apache.org.
Grammar CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/5a37ee43
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/5a37ee43
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/5a37ee43
Branch: refs/heads/TINKERPOP-1854
Commit: 5a37ee4354a02486221db48ccfda94e36f44ef22
Parents: d5b6ebb
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Jan 24 08:44:18 2018 -0500
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Jan 24 08:44:18 2018 -0500
----------------------------------------------------------------------
docs/src/dev/developer/development-environment.asciidoc | 2 +-
docs/src/dev/io/graphson.asciidoc | 2 +-
docs/src/dev/provider/index.asciidoc | 2 +-
docs/src/reference/gremlin-applications.asciidoc | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5a37ee43/docs/src/dev/developer/development-environment.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/development-environment.asciidoc b/docs/src/dev/developer/development-environment.asciidoc
index 52542f8..0bb6b0e 100644
--- a/docs/src/dev/developer/development-environment.asciidoc
+++ b/docs/src/dev/developer/development-environment.asciidoc
@@ -258,7 +258,7 @@ Projects" side panel, right click the `gremlin-shaded` module and select "Ignore
. At this point it should be possible to compile and run the tests within Intellij, but in the worst case, use
`File | Invalidate Caches/Restart` to ensure that indices properly rebuild.
-Note that it maybe be necessary to re-execute these steps if the `gremlin-shaded` `pom.xml` is ever updated.
+Note that it may be necessary to re-execute these steps if the `gremlin-shaded` `pom.xml` is ever updated.
Developers working on the `neo4j-gremlin` module should enabled the `include-neo4j` Maven profile in Intellij.
This will ensure that tests will properly execute within the IDE.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5a37ee43/docs/src/dev/io/graphson.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/io/graphson.asciidoc b/docs/src/dev/io/graphson.asciidoc
index 7324cee..c120634 100644
--- a/docs/src/dev/io/graphson.asciidoc
+++ b/docs/src/dev/io/graphson.asciidoc
@@ -4086,7 +4086,7 @@ The following `RequestMessage` is an example of a sessionless request for a scri
==== Authentication Challenge
-When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but not in the default provided by Gremlin Server).
+When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges may be requested in some cases, but not in the default provided by Gremlin Server).
[source,json]
----
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5a37ee43/docs/src/dev/provider/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/provider/index.asciidoc b/docs/src/dev/provider/index.asciidoc
index 926602a..5bc4d9e 100644
--- a/docs/src/dev/provider/index.asciidoc
+++ b/docs/src/dev/provider/index.asciidoc
@@ -1154,7 +1154,7 @@ Note that the plugin provides a unique name for the plugin which follows a names
(e.g. "tinkerpop.hadoop" - "tinkerpop" is the reserved namespace for TinkerPop maintained plugins). To make TinkerGraph
classes available to the Console, the `PluginAcceptor` is given a `Set` of imports to provide to the plugin host. The
`PluginAcceptor` essentially behaves as an abstraction to the "host" that is handling the `GremlinPlugin`. `GremlinPlugin`
-implementations maybe hosted by the Console as well as the `ScriptEngine` in Gremlin Server. Obviously, registering
+implementations may be hosted by the Console as well as the `ScriptEngine` in Gremlin Server. Obviously, registering
new commands and other operations that are specific to the Groovy Shell don't make sense there. Write the code for
the plugin defensively by checking the `GremlinPlugin.env` key in the `PluginAcceptor.environment()` to understand
which environment the plugin is being used in.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5a37ee43/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index df05ead..92bfef7 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -977,7 +977,7 @@ $ bin/gremlin-server.sh conf/gremlin-server-modern.yaml
To configure a "remote" traversal, there first needs to be a `TraversalSource`. A `TraversalSource` can be generated
from any `Graph` instance with the `traversal()` method. Of course, any traversals generated from this source using the
-`withRemote()` configuration option will not execute against the local graph. That could be confusing and it maybe be
+`withRemote()` configuration option will not execute against the local graph. That could be confusing and it may be
easier to think of the local graph as being "empty". To that end, it is recommended that when using `withRemote()`,
the `TraversalSource` be generated with `EmptyGraph` as follows:
[46/50] [abbrv] tinkerpop git commit: Some spelling/grammar fixes and
subtitle for P IO values CTR
Posted by fl...@apache.org.
Some spelling/grammar fixes and subtitle for P IO values CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d5b6ebb0
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d5b6ebb0
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d5b6ebb0
Branch: refs/heads/TINKERPOP-1854
Commit: d5b6ebb08229be07761d11c3a4065f21a8dcddd3
Parents: 08391f8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jan 24 08:30:14 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jan 24 08:30:14 2018 -0500
----------------------------------------------------------------------
docs/src/dev/io/graphson.asciidoc | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d5b6ebb0/docs/src/dev/io/graphson.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/io/graphson.asciidoc b/docs/src/dev/io/graphson.asciidoc
index 4b1d219..7324cee 100644
--- a/docs/src/dev/io/graphson.asciidoc
+++ b/docs/src/dev/io/graphson.asciidoc
@@ -75,7 +75,7 @@ file.withWriter { writer ->
writer.write("=== ResponseMessage\n\n")
msg = ResponseMessage.build(UUID.fromString("41d2e28a-20a4-4ab0-b379-d810dede3786")).
code(org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.AUTHENTICATE).create()
- writer.write(toJson(msg, "Authentication Challenge", "When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but not in the default provided by Gremlin Server)."))
+ writer.write(toJson(msg, "Authentication Challenge", "When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges may be requested in some cases, but not in the default provided by Gremlin Server)."))
msg = ResponseMessage.build(UUID.fromString("41d2e28a-20a4-4ab0-b379-d810dede3786")).
code(org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SUCCESS).
result(Arrays.asList(graph.vertices().next())).create()
@@ -147,9 +147,9 @@ file.withWriter { writer ->
metrics = new org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics(tm.getMetrics(0));
metrics.addNested(new org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics(tm.getMetrics(1)));
writer.write(toJson(metrics, "Metrics"))
- writer.write(toJson(P.gt(0), "P"))
- writer.write(toJson(P.within(1), "P within"))
- writer.write(toJson(P.without(1,2), "P without"))
+ writer.write(toJson(P.gt(0), "P", "`P` expects a single value of a `List` of values. There is special handling for `List` values when it comes to `within`, `without`, `inside`, `outside` and `between`. For `inside`, `outside` and `between`, the expectation is that the collection contain two objects (the rest will be ignored) and those two objects become the arguments to those methods. For `within` and `without`, these methods will accept an arbitrary number of objects in the collection."))
+ writer.write(toJson(P.within(1), "P within", "Please see <<p,P>> for additional information on `within`."))
+ writer.write(toJson(P.without(1,2), "P without", "Please see <<p,P>> for additional information on `within`."))
writer.write(toJson(P.gt(0).and(P.lt(10)), "P and"))
writer.write(toJson(P.gt(0).or(P.within(-1, -10, -100)), "P or"))
writer.write(toJson(Scope.local, "Scope"))
@@ -183,7 +183,7 @@ file.withWriter { writer ->
writer.write("=== ResponseMessage\n\n")
msg = ResponseMessage.build(UUID.fromString("41d2e28a-20a4-4ab0-b379-d810dede3786")).
code(org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.AUTHENTICATE).create()
- writer.write(toJson(msg, "Authentication Challenge", "When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but no in the default provided by Gremlin Server)."))
+ writer.write(toJson(msg, "Authentication Challenge", "When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges may be requested in some cases, but not in the default provided by Gremlin Server)."))
msg = ResponseMessage.build(UUID.fromString("41d2e28a-20a4-4ab0-b379-d810dede3786")).
code(org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SUCCESS).
result(Arrays.asList(graph.vertices().next())).create()
@@ -1270,7 +1270,7 @@ The following `RequestMessage` is an example of a sessionless request for a scri
==== Authentication Challenge
-When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but no in the default provided by Gremlin Server).
+When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges may be requested in some cases, but not in the default provided by Gremlin Server).
[source,json]
----
@@ -3558,6 +3558,8 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
==== P
+`P` expects a single value of a `List` of values. There is special handling for `List` values when it comes to `within`, `without`, `inside`, `outside` and `between`. For `inside`, `outside` and `between`, the expectation is that the collection contain two objects (the rest will be ignored) and those two objects become the arguments to those methods. For `within` and `without`, these methods will accept an arbitrary number of objects in the collection.
+
[source,json]
----
{
@@ -3574,6 +3576,8 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
==== P within
+Please see <<_p,P>> for additional information on `within`.
+
[source,json]
----
{
@@ -3590,6 +3594,8 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
==== P without
+Please see <<_p,P>> for additional information on `within`.
+
[source,json]
----
{
@@ -4080,7 +4086,7 @@ The following `RequestMessage` is an example of a sessionless request for a scri
==== Authentication Challenge
-When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but no in the default provided by Gremlin Server).
+When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but not in the default provided by Gremlin Server).
[source,json]
----
[06/50] [abbrv] tinkerpop git commit: Use null as empty result
Posted by fl...@apache.org.
Use null as empty result
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/84a11a1b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/84a11a1b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/84a11a1b
Branch: refs/heads/TINKERPOP-1854
Commit: 84a11a1b10ddbb06558663a062dc1ae3a1062c68
Parents: 44e6535
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 3 14:34:28 2016 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:14 2018 +0100
----------------------------------------------------------------------
.../tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy | 2 +-
.../src/main/javascript/gremlin-javascript/process/traversal.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/84a11a1b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
index 46f65a4..d5899f0 100644
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
+++ b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
@@ -87,7 +87,7 @@ class TraversalSourceGenerator {
/** @param {Function} callback */
Traversal.prototype.one = function (callback) {
this.list(function (err, result) {
- callback(err, result ? result[0] : null);
+ callback(err, result && result.length > 0 ? result[0] : null);
});
};
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/84a11a1b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
index a7a9bb7..f585161 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
@@ -50,7 +50,7 @@
/** @param {Function} callback */
Traversal.prototype.one = function (callback) {
this.list(function (err, result) {
- callback(err, result ? result[0] : null);
+ callback(err, result && result.length > 0 ? result[0] : null);
});
};
[26/50] [abbrv] tinkerpop git commit: Add toLong() method
Posted by fl...@apache.org.
Add toLong() method
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/93cf86d0
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/93cf86d0
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/93cf86d0
Branch: refs/heads/TINKERPOP-1854
Commit: 93cf86d005fb3c11b0687089d7e372f6d4149c5c
Parents: f9f7033
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Wed Nov 29 11:37:24 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:17 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/glv/PackageJson.template | 2 +-
.../main/javascript/gremlin-javascript/index.js | 4 +++-
.../gremlin-javascript/lib/structure/graph.js | 1 -
.../lib/structure/io/graph-serializer.js | 21 ++++++++++++++++++--
.../javascript/gremlin-javascript/lib/utils.js | 11 ++++++++++
.../javascript/gremlin-javascript/package.json | 2 +-
.../test/cucumber/feature-steps.js | 6 ++++--
7 files changed, 39 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/93cf86d0/gremlin-javascript/glv/PackageJson.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/PackageJson.template b/gremlin-javascript/glv/PackageJson.template
index 4f1ac05..1b54a87 100644
--- a/gremlin-javascript/glv/PackageJson.template
+++ b/gremlin-javascript/glv/PackageJson.template
@@ -49,7 +49,7 @@
},
"scripts": {
"test": "./node_modules/.bin/mocha test/unit test/integration -t 5000",
- "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/map/AddVertex.feature",
+ "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/",
"unit-test": "./node_modules/.bin/mocha test/unit"
},
"engines": {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/93cf86d0/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index 600ac53..61ab274 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -29,6 +29,7 @@ var graph = require('./lib/structure/graph');
var gs = require('./lib/structure/io/graph-serializer');
var rc = require('./lib/driver/remote-connection');
var Bytecode = require('./lib/process/bytecode');
+var utils = require('./lib/utils');
module.exports = {
driver: {
@@ -68,6 +69,7 @@ module.exports = {
Path: graph.Path,
Property: graph.Property,
Vertex: graph.Vertex,
- VertexProperty: graph.VertexProperty
+ VertexProperty: graph.VertexProperty,
+ toLong: utils.toLong
}
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/93cf86d0/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
index 95fd30f..cbb7e2c 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
@@ -23,7 +23,6 @@
'use strict';
var gt = require('../process/graph-traversal');
-var t = require('../process/traversal');
var TraversalStrategies = require('../process/traversal-strategy').TraversalStrategies;
var utils = require('../utils');
var inherits = utils.inherits;
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/93cf86d0/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
index ff3d72d..8e4ad5e 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
@@ -24,7 +24,8 @@
var t = require('../../process/traversal');
var Bytecode = require('../../process/bytecode');
-var g = require('../graph.js');
+var g = require('../graph');
+var utils = require('../../utils');
/**
* A type serializer
@@ -67,7 +68,8 @@ var serializers = [
LambdaSerializer,
EnumSerializer,
VertexSerializer,
- EdgeSerializer
+ EdgeSerializer,
+ LongSerializer
];
/**
@@ -210,6 +212,21 @@ NumberSerializer.prototype.canBeUsedFor = function (value) {
return (typeof value === 'number');
};
+function LongSerializer() {
+
+}
+
+NumberSerializer.prototype.serialize = function (item) {
+ return {
+ [typeKey]: 'g:Int64',
+ [valueKey]: item.value
+ };
+};
+
+NumberSerializer.prototype.canBeUsedFor = function (value) {
+ return (value instanceof utils.Long);
+};
+
function BytecodeSerializer() {
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/93cf86d0/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
index 7691dda..cbaa53e 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
@@ -59,4 +59,15 @@ exports.resolvedPromise = function (promiseFactory) {
var toPromise = exports.toPromise = function toPromise(promiseFactory, handler) {
promiseFactory = promiseFactory || defaultPromiseFactory;
return promiseFactory(handler);
+};
+
+exports.toLong = function toLong(value) {
+ return new Long(value);
+};
+
+var Long = exports.Long = function Long(value) {
+ if (typeof value !== 'string' && typeof value !== 'number') {
+ throw new TypeError('Ty')
+ }
+ this.value = value.toString();
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/93cf86d0/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index 7c4a3d6..aae9eb9 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -30,7 +30,7 @@
},
"scripts": {
"test": "./node_modules/.bin/mocha test/unit test/integration -t 5000",
- "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/map/AddVertex.feature",
+ "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/",
"unit-test": "./node_modules/.bin/mocha test/unit"
},
"engines": {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/93cf86d0/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
index 06a3283..12bc835 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -29,6 +29,7 @@ const util = require('util');
const graphModule = require('../../lib/structure/graph');
const graphTraversalModule = require('../../lib/process/graph-traversal');
const traversalModule = require('../../lib/process/traversal');
+const utils = require('../../lib/utils');
const Graph = graphModule.Graph;
const Path = graphModule.Path;
const __ = graphTraversalModule.statics;
@@ -185,6 +186,7 @@ function getSandbox(g, parameters) {
Scope: traversalModule.scope,
Operator: traversalModule.operator,
T: traversalModule.t,
+ toLong: utils.toLong
};
// Pass the parameter to the sandbox
Object.keys(parameters).forEach(paramName => sandbox[paramName] = parameters[paramName]);
@@ -194,8 +196,8 @@ function getSandbox(g, parameters) {
function translate(traversalText) {
// Remove escaped chars
traversalText = traversalText.replace(/\\"/g, '"');
- // Remove long suffix
- traversalText = traversalText.replace(/\b(\d+)l\b/gi, '$1');
+ // Replace long suffix with Long instance
+ traversalText = traversalText.replace(/\b(\d+)l\b/gi, 'toLong($1)');
// Change according to naming convention
traversalText = traversalText.replace(/\.in\(/g, '.in_(');
traversalText = traversalText.replace(/\.from\(/g, '.from_(');
[39/50] [abbrv] tinkerpop git commit: Use rest parameters and compact
syntax for statics
Posted by fl...@apache.org.
Use rest parameters and compact syntax for statics
- Use rest parameters
- Use a more compact declaration for methods on statics
- Bump engine to Node.js >= 6
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d37a3d8c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d37a3d8c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d37a3d8c
Branch: refs/heads/TINKERPOP-1854
Commit: d37a3d8c9635d33cbd94c5e85959b89be12405d4
Parents: af718f7
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Jan 22 12:47:04 2018 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Mon Jan 22 15:31:27 2018 +0100
----------------------------------------------------------------------
.../glv/GraphTraversalSource.template | 32 +-
gremlin-javascript/glv/PackageJson.template | 9 +-
gremlin-javascript/glv/TraversalSource.template | 5 +-
gremlin-javascript/pom.xml | 4 +-
.../gremlin-javascript/lib/process/bytecode.js | 4 +-
.../lib/process/graph-traversal.js | 1440 ++++--------------
.../lib/process/traversal-strategy.js | 2 +-
.../gremlin-javascript/lib/process/traversal.js | 53 +-
.../javascript/gremlin-javascript/lib/utils.js | 4 -
.../javascript/gremlin-javascript/package.json | 9 +-
10 files changed, 370 insertions(+), 1192 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d37a3d8c/gremlin-javascript/glv/GraphTraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/GraphTraversalSource.template b/gremlin-javascript/glv/GraphTraversalSource.template
index 812cfcf..58be16c 100644
--- a/gremlin-javascript/glv/GraphTraversalSource.template
+++ b/gremlin-javascript/glv/GraphTraversalSource.template
@@ -27,7 +27,6 @@ const remote = require('../driver/remote-connection');
const utils = require('../utils');
const Bytecode = require('./bytecode');
const TraversalStrategies = require('./traversal-strategy').TraversalStrategies;
-const parseArgs = utils.parseArgs;
/**
@@ -68,8 +67,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversalSource}
*/
- <%= toJs.call(method) %>(args) {
- const b = new Bytecode(this.bytecode).addSource('<%= method %>', parseArgs.apply(null, arguments));
+ <%= toJs.call(method) %>(...args) {
+ const b = new Bytecode(this.bytecode).addSource('<%= method %>', args);
return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
<%
@@ -80,8 +79,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- <%= toJs.call(method) %>(args) {
- const b = new Bytecode(this.bytecode).addStep('<%= method %>', parseArgs.apply(null, arguments));
+ <%= toJs.call(method) %>(...args) {
+ const b = new Bytecode(this.bytecode).addStep('<%= method %>', args);
return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
<% } %>
@@ -100,29 +99,26 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- <%= toJs.call(method) %>(args) {
- this.bytecode.addStep('<%= method %>', parseArgs.apply(null, arguments));
+ <%= toJs.call(method) %>(...args) {
+ this.bytecode.addStep('<%= method %>', args);
return this;
}
<% } %>
}
+function callOnEmptyTraversal(fnName, args) {
+ const g = new GraphTraversal(null, null, new Bytecode());
+ return g[fnName].apply(g, args);
+}
+
/**
* Contains the static method definitions
* @type {Object}
*/
-const statics = {};
-<% anonStepMethods.each{ method -> %>
-/**
- * <%= method %>() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.<%= toJs.call(method) %> = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.<%= toJs.call(method) %>.apply(g, arguments);
+const statics = {<% anonStepMethods.eachWithIndex { method, i -> %>
+ <%= toJs.call(method) %>: (...args) => callOnEmptyTraversal('<%= toJs.call(method) %>', args)<%= i < anonStepMethods.size() - 1 ? "," : ""%><% } %>
};
-<% } %>
+
module.exports = {
GraphTraversal,
GraphTraversalSource,
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d37a3d8c/gremlin-javascript/glv/PackageJson.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/PackageJson.template b/gremlin-javascript/glv/PackageJson.template
index 1b54a87..c929e75 100644
--- a/gremlin-javascript/glv/PackageJson.template
+++ b/gremlin-javascript/glv/PackageJson.template
@@ -44,15 +44,16 @@
"type": "git",
"url": "https://github.com/apache/tinkerpop.git"
},
+ "homepage": "https://tinkerpop.apache.org/",
"bugs": {
"url": "https://issues.apache.org/jira/browse/TINKERPOP"
},
"scripts": {
- "test": "./node_modules/.bin/mocha test/unit test/integration -t 5000",
- "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/",
- "unit-test": "./node_modules/.bin/mocha test/unit"
+ "test": "mocha test/unit test/integration -t 5000",
+ "features": "cucumber.js --require test/cucumber ../../../../../gremlin-test/features/",
+ "unit-test": "mocha test/unit"
},
"engines": {
- "node": ">=4"
+ "node": ">=6"
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d37a3d8c/gremlin-javascript/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template
index 3f289e4..6965110 100644
--- a/gremlin-javascript/glv/TraversalSource.template
+++ b/gremlin-javascript/glv/TraversalSource.template
@@ -23,7 +23,6 @@
'use strict';
const utils = require('../utils');
-const parseArgs = utils.parseArgs;
const itemDone = Object.freeze({ value: null, done: true });
class Traversal {
@@ -143,8 +142,8 @@ class P {
}
<% pmethods.each{ method -> %>
/** @param {...Object} args */
- static <%= toJs.call(method) %>(args) {
- return createP('<%= method %>', parseArgs.apply(null, arguments));
+ static <%= toJs.call(method) %>(...args) {
+ return createP('<%= method %>', args);
}
<% } %>
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d37a3d8c/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index e55bc1e..f9f0c8e 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -243,7 +243,7 @@ limitations under the License.
<configuration>
<skip>${skipIntegrationTests}</skip>
<workingDirectory>src/main/javascript/gremlin-javascript</workingDirectory>
- <nodeVersion>v4.8.3</nodeVersion>
+ <nodeVersion>v6.12.3</nodeVersion>
</configuration>
</plugin>
<!--
@@ -291,7 +291,7 @@ limitations under the License.
<configuration>
<skip>${skipIntegrationTests}</skip>
<workingDirectory>src/main/javascript/gremlin-javascript</workingDirectory>
- <nodeVersion>v4.8.3</nodeVersion>
+ <nodeVersion>v6.12.3</nodeVersion>
</configuration>
</plugin>
</plugins>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d37a3d8c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
index 85a4fc2..0f5ba15 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
@@ -33,8 +33,8 @@ class Bytecode {
this.stepInstructions = [];
}
else {
- this.sourceInstructions = toClone.sourceInstructions.slice(0);
- this.stepInstructions = toClone.stepInstructions.slice(0);
+ this.sourceInstructions = [...toClone.sourceInstructions];
+ this.stepInstructions = [...toClone.stepInstructions];
}
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d37a3d8c/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 6dcd8f6..fe1e467 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
@@ -27,7 +27,6 @@ const remote = require('../driver/remote-connection');
const utils = require('../utils');
const Bytecode = require('./bytecode');
const TraversalStrategies = require('./traversal-strategy').TraversalStrategies;
-const parseArgs = utils.parseArgs;
/**
@@ -68,8 +67,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversalSource}
*/
- withBulk(args) {
- const b = new Bytecode(this.bytecode).addSource('withBulk', parseArgs.apply(null, arguments));
+ withBulk(...args) {
+ const b = new Bytecode(this.bytecode).addSource('withBulk', args);
return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -78,8 +77,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversalSource}
*/
- withPath(args) {
- const b = new Bytecode(this.bytecode).addSource('withPath', parseArgs.apply(null, arguments));
+ withPath(...args) {
+ const b = new Bytecode(this.bytecode).addSource('withPath', args);
return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -88,8 +87,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversalSource}
*/
- withSack(args) {
- const b = new Bytecode(this.bytecode).addSource('withSack', parseArgs.apply(null, arguments));
+ withSack(...args) {
+ const b = new Bytecode(this.bytecode).addSource('withSack', args);
return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -98,8 +97,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversalSource}
*/
- withSideEffect(args) {
- const b = new Bytecode(this.bytecode).addSource('withSideEffect', parseArgs.apply(null, arguments));
+ withSideEffect(...args) {
+ const b = new Bytecode(this.bytecode).addSource('withSideEffect', args);
return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -108,8 +107,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversalSource}
*/
- withStrategies(args) {
- const b = new Bytecode(this.bytecode).addSource('withStrategies', parseArgs.apply(null, arguments));
+ withStrategies(...args) {
+ const b = new Bytecode(this.bytecode).addSource('withStrategies', args);
return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -118,8 +117,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversalSource}
*/
- withoutStrategies(args) {
- const b = new Bytecode(this.bytecode).addSource('withoutStrategies', parseArgs.apply(null, arguments));
+ withoutStrategies(...args) {
+ const b = new Bytecode(this.bytecode).addSource('withoutStrategies', args);
return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -128,8 +127,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- E(args) {
- const b = new Bytecode(this.bytecode).addStep('E', parseArgs.apply(null, arguments));
+ E(...args) {
+ const b = new Bytecode(this.bytecode).addStep('E', args);
return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -138,8 +137,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- V(args) {
- const b = new Bytecode(this.bytecode).addStep('V', parseArgs.apply(null, arguments));
+ V(...args) {
+ const b = new Bytecode(this.bytecode).addStep('V', args);
return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -148,8 +147,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- addV(args) {
- const b = new Bytecode(this.bytecode).addStep('addV', parseArgs.apply(null, arguments));
+ addV(...args) {
+ const b = new Bytecode(this.bytecode).addStep('addV', args);
return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -158,8 +157,8 @@ class GraphTraversalSource {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- inject(args) {
- const b = new Bytecode(this.bytecode).addStep('inject', parseArgs.apply(null, arguments));
+ inject(...args) {
+ const b = new Bytecode(this.bytecode).addStep('inject', args);
return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
}
@@ -178,8 +177,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- V(args) {
- this.bytecode.addStep('V', parseArgs.apply(null, arguments));
+ V(...args) {
+ this.bytecode.addStep('V', args);
return this;
}
@@ -188,8 +187,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- addE(args) {
- this.bytecode.addStep('addE', parseArgs.apply(null, arguments));
+ addE(...args) {
+ this.bytecode.addStep('addE', args);
return this;
}
@@ -198,8 +197,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- addInE(args) {
- this.bytecode.addStep('addInE', parseArgs.apply(null, arguments));
+ addInE(...args) {
+ this.bytecode.addStep('addInE', args);
return this;
}
@@ -208,8 +207,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- addOutE(args) {
- this.bytecode.addStep('addOutE', parseArgs.apply(null, arguments));
+ addOutE(...args) {
+ this.bytecode.addStep('addOutE', args);
return this;
}
@@ -218,8 +217,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- addV(args) {
- this.bytecode.addStep('addV', parseArgs.apply(null, arguments));
+ addV(...args) {
+ this.bytecode.addStep('addV', args);
return this;
}
@@ -228,8 +227,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- aggregate(args) {
- this.bytecode.addStep('aggregate', parseArgs.apply(null, arguments));
+ aggregate(...args) {
+ this.bytecode.addStep('aggregate', args);
return this;
}
@@ -238,8 +237,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- and(args) {
- this.bytecode.addStep('and', parseArgs.apply(null, arguments));
+ and(...args) {
+ this.bytecode.addStep('and', args);
return this;
}
@@ -248,8 +247,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- as(args) {
- this.bytecode.addStep('as', parseArgs.apply(null, arguments));
+ as(...args) {
+ this.bytecode.addStep('as', args);
return this;
}
@@ -258,8 +257,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- barrier(args) {
- this.bytecode.addStep('barrier', parseArgs.apply(null, arguments));
+ barrier(...args) {
+ this.bytecode.addStep('barrier', args);
return this;
}
@@ -268,8 +267,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- both(args) {
- this.bytecode.addStep('both', parseArgs.apply(null, arguments));
+ both(...args) {
+ this.bytecode.addStep('both', args);
return this;
}
@@ -278,8 +277,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- bothE(args) {
- this.bytecode.addStep('bothE', parseArgs.apply(null, arguments));
+ bothE(...args) {
+ this.bytecode.addStep('bothE', args);
return this;
}
@@ -288,8 +287,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- bothV(args) {
- this.bytecode.addStep('bothV', parseArgs.apply(null, arguments));
+ bothV(...args) {
+ this.bytecode.addStep('bothV', args);
return this;
}
@@ -298,8 +297,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- branch(args) {
- this.bytecode.addStep('branch', parseArgs.apply(null, arguments));
+ branch(...args) {
+ this.bytecode.addStep('branch', args);
return this;
}
@@ -308,8 +307,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- by(args) {
- this.bytecode.addStep('by', parseArgs.apply(null, arguments));
+ by(...args) {
+ this.bytecode.addStep('by', args);
return this;
}
@@ -318,8 +317,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- cap(args) {
- this.bytecode.addStep('cap', parseArgs.apply(null, arguments));
+ cap(...args) {
+ this.bytecode.addStep('cap', args);
return this;
}
@@ -328,8 +327,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- choose(args) {
- this.bytecode.addStep('choose', parseArgs.apply(null, arguments));
+ choose(...args) {
+ this.bytecode.addStep('choose', args);
return this;
}
@@ -338,8 +337,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- coalesce(args) {
- this.bytecode.addStep('coalesce', parseArgs.apply(null, arguments));
+ coalesce(...args) {
+ this.bytecode.addStep('coalesce', args);
return this;
}
@@ -348,8 +347,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- coin(args) {
- this.bytecode.addStep('coin', parseArgs.apply(null, arguments));
+ coin(...args) {
+ this.bytecode.addStep('coin', args);
return this;
}
@@ -358,8 +357,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- constant(args) {
- this.bytecode.addStep('constant', parseArgs.apply(null, arguments));
+ constant(...args) {
+ this.bytecode.addStep('constant', args);
return this;
}
@@ -368,8 +367,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- count(args) {
- this.bytecode.addStep('count', parseArgs.apply(null, arguments));
+ count(...args) {
+ this.bytecode.addStep('count', args);
return this;
}
@@ -378,8 +377,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- cyclicPath(args) {
- this.bytecode.addStep('cyclicPath', parseArgs.apply(null, arguments));
+ cyclicPath(...args) {
+ this.bytecode.addStep('cyclicPath', args);
return this;
}
@@ -388,8 +387,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- dedup(args) {
- this.bytecode.addStep('dedup', parseArgs.apply(null, arguments));
+ dedup(...args) {
+ this.bytecode.addStep('dedup', args);
return this;
}
@@ -398,8 +397,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- drop(args) {
- this.bytecode.addStep('drop', parseArgs.apply(null, arguments));
+ drop(...args) {
+ this.bytecode.addStep('drop', args);
return this;
}
@@ -408,8 +407,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- emit(args) {
- this.bytecode.addStep('emit', parseArgs.apply(null, arguments));
+ emit(...args) {
+ this.bytecode.addStep('emit', args);
return this;
}
@@ -418,8 +417,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- filter(args) {
- this.bytecode.addStep('filter', parseArgs.apply(null, arguments));
+ filter(...args) {
+ this.bytecode.addStep('filter', args);
return this;
}
@@ -428,8 +427,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- flatMap(args) {
- this.bytecode.addStep('flatMap', parseArgs.apply(null, arguments));
+ flatMap(...args) {
+ this.bytecode.addStep('flatMap', args);
return this;
}
@@ -438,8 +437,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- fold(args) {
- this.bytecode.addStep('fold', parseArgs.apply(null, arguments));
+ fold(...args) {
+ this.bytecode.addStep('fold', args);
return this;
}
@@ -448,8 +447,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- from_(args) {
- this.bytecode.addStep('from', parseArgs.apply(null, arguments));
+ from_(...args) {
+ this.bytecode.addStep('from', args);
return this;
}
@@ -458,8 +457,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- group(args) {
- this.bytecode.addStep('group', parseArgs.apply(null, arguments));
+ group(...args) {
+ this.bytecode.addStep('group', args);
return this;
}
@@ -468,8 +467,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- groupCount(args) {
- this.bytecode.addStep('groupCount', parseArgs.apply(null, arguments));
+ groupCount(...args) {
+ this.bytecode.addStep('groupCount', args);
return this;
}
@@ -478,8 +477,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- groupV3d0(args) {
- this.bytecode.addStep('groupV3d0', parseArgs.apply(null, arguments));
+ groupV3d0(...args) {
+ this.bytecode.addStep('groupV3d0', args);
return this;
}
@@ -488,8 +487,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- has(args) {
- this.bytecode.addStep('has', parseArgs.apply(null, arguments));
+ has(...args) {
+ this.bytecode.addStep('has', args);
return this;
}
@@ -498,8 +497,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- hasId(args) {
- this.bytecode.addStep('hasId', parseArgs.apply(null, arguments));
+ hasId(...args) {
+ this.bytecode.addStep('hasId', args);
return this;
}
@@ -508,8 +507,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- hasKey(args) {
- this.bytecode.addStep('hasKey', parseArgs.apply(null, arguments));
+ hasKey(...args) {
+ this.bytecode.addStep('hasKey', args);
return this;
}
@@ -518,8 +517,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- hasLabel(args) {
- this.bytecode.addStep('hasLabel', parseArgs.apply(null, arguments));
+ hasLabel(...args) {
+ this.bytecode.addStep('hasLabel', args);
return this;
}
@@ -528,8 +527,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- hasNot(args) {
- this.bytecode.addStep('hasNot', parseArgs.apply(null, arguments));
+ hasNot(...args) {
+ this.bytecode.addStep('hasNot', args);
return this;
}
@@ -538,8 +537,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- hasValue(args) {
- this.bytecode.addStep('hasValue', parseArgs.apply(null, arguments));
+ hasValue(...args) {
+ this.bytecode.addStep('hasValue', args);
return this;
}
@@ -548,8 +547,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- id(args) {
- this.bytecode.addStep('id', parseArgs.apply(null, arguments));
+ id(...args) {
+ this.bytecode.addStep('id', args);
return this;
}
@@ -558,8 +557,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- identity(args) {
- this.bytecode.addStep('identity', parseArgs.apply(null, arguments));
+ identity(...args) {
+ this.bytecode.addStep('identity', args);
return this;
}
@@ -568,8 +567,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- in_(args) {
- this.bytecode.addStep('in', parseArgs.apply(null, arguments));
+ in_(...args) {
+ this.bytecode.addStep('in', args);
return this;
}
@@ -578,8 +577,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- inE(args) {
- this.bytecode.addStep('inE', parseArgs.apply(null, arguments));
+ inE(...args) {
+ this.bytecode.addStep('inE', args);
return this;
}
@@ -588,8 +587,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- inV(args) {
- this.bytecode.addStep('inV', parseArgs.apply(null, arguments));
+ inV(...args) {
+ this.bytecode.addStep('inV', args);
return this;
}
@@ -598,8 +597,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- inject(args) {
- this.bytecode.addStep('inject', parseArgs.apply(null, arguments));
+ inject(...args) {
+ this.bytecode.addStep('inject', args);
return this;
}
@@ -608,8 +607,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- is(args) {
- this.bytecode.addStep('is', parseArgs.apply(null, arguments));
+ is(...args) {
+ this.bytecode.addStep('is', args);
return this;
}
@@ -618,8 +617,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- key(args) {
- this.bytecode.addStep('key', parseArgs.apply(null, arguments));
+ key(...args) {
+ this.bytecode.addStep('key', args);
return this;
}
@@ -628,8 +627,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- label(args) {
- this.bytecode.addStep('label', parseArgs.apply(null, arguments));
+ label(...args) {
+ this.bytecode.addStep('label', args);
return this;
}
@@ -638,8 +637,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- limit(args) {
- this.bytecode.addStep('limit', parseArgs.apply(null, arguments));
+ limit(...args) {
+ this.bytecode.addStep('limit', args);
return this;
}
@@ -648,8 +647,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- local(args) {
- this.bytecode.addStep('local', parseArgs.apply(null, arguments));
+ local(...args) {
+ this.bytecode.addStep('local', args);
return this;
}
@@ -658,8 +657,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- loops(args) {
- this.bytecode.addStep('loops', parseArgs.apply(null, arguments));
+ loops(...args) {
+ this.bytecode.addStep('loops', args);
return this;
}
@@ -668,8 +667,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- map(args) {
- this.bytecode.addStep('map', parseArgs.apply(null, arguments));
+ map(...args) {
+ this.bytecode.addStep('map', args);
return this;
}
@@ -678,8 +677,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- mapKeys(args) {
- this.bytecode.addStep('mapKeys', parseArgs.apply(null, arguments));
+ mapKeys(...args) {
+ this.bytecode.addStep('mapKeys', args);
return this;
}
@@ -688,8 +687,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- mapValues(args) {
- this.bytecode.addStep('mapValues', parseArgs.apply(null, arguments));
+ mapValues(...args) {
+ this.bytecode.addStep('mapValues', args);
return this;
}
@@ -698,8 +697,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- match(args) {
- this.bytecode.addStep('match', parseArgs.apply(null, arguments));
+ match(...args) {
+ this.bytecode.addStep('match', args);
return this;
}
@@ -708,8 +707,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- max(args) {
- this.bytecode.addStep('max', parseArgs.apply(null, arguments));
+ max(...args) {
+ this.bytecode.addStep('max', args);
return this;
}
@@ -718,8 +717,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- mean(args) {
- this.bytecode.addStep('mean', parseArgs.apply(null, arguments));
+ mean(...args) {
+ this.bytecode.addStep('mean', args);
return this;
}
@@ -728,8 +727,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- min(args) {
- this.bytecode.addStep('min', parseArgs.apply(null, arguments));
+ min(...args) {
+ this.bytecode.addStep('min', args);
return this;
}
@@ -738,8 +737,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- not(args) {
- this.bytecode.addStep('not', parseArgs.apply(null, arguments));
+ not(...args) {
+ this.bytecode.addStep('not', args);
return this;
}
@@ -748,8 +747,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- option(args) {
- this.bytecode.addStep('option', parseArgs.apply(null, arguments));
+ option(...args) {
+ this.bytecode.addStep('option', args);
return this;
}
@@ -758,8 +757,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- optional(args) {
- this.bytecode.addStep('optional', parseArgs.apply(null, arguments));
+ optional(...args) {
+ this.bytecode.addStep('optional', args);
return this;
}
@@ -768,8 +767,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- or(args) {
- this.bytecode.addStep('or', parseArgs.apply(null, arguments));
+ or(...args) {
+ this.bytecode.addStep('or', args);
return this;
}
@@ -778,8 +777,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- order(args) {
- this.bytecode.addStep('order', parseArgs.apply(null, arguments));
+ order(...args) {
+ this.bytecode.addStep('order', args);
return this;
}
@@ -788,8 +787,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- otherV(args) {
- this.bytecode.addStep('otherV', parseArgs.apply(null, arguments));
+ otherV(...args) {
+ this.bytecode.addStep('otherV', args);
return this;
}
@@ -798,8 +797,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- out(args) {
- this.bytecode.addStep('out', parseArgs.apply(null, arguments));
+ out(...args) {
+ this.bytecode.addStep('out', args);
return this;
}
@@ -808,8 +807,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- outE(args) {
- this.bytecode.addStep('outE', parseArgs.apply(null, arguments));
+ outE(...args) {
+ this.bytecode.addStep('outE', args);
return this;
}
@@ -818,8 +817,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- outV(args) {
- this.bytecode.addStep('outV', parseArgs.apply(null, arguments));
+ outV(...args) {
+ this.bytecode.addStep('outV', args);
return this;
}
@@ -828,8 +827,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- pageRank(args) {
- this.bytecode.addStep('pageRank', parseArgs.apply(null, arguments));
+ pageRank(...args) {
+ this.bytecode.addStep('pageRank', args);
return this;
}
@@ -838,8 +837,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- path(args) {
- this.bytecode.addStep('path', parseArgs.apply(null, arguments));
+ path(...args) {
+ this.bytecode.addStep('path', args);
return this;
}
@@ -848,8 +847,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- peerPressure(args) {
- this.bytecode.addStep('peerPressure', parseArgs.apply(null, arguments));
+ peerPressure(...args) {
+ this.bytecode.addStep('peerPressure', args);
return this;
}
@@ -858,8 +857,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- profile(args) {
- this.bytecode.addStep('profile', parseArgs.apply(null, arguments));
+ profile(...args) {
+ this.bytecode.addStep('profile', args);
return this;
}
@@ -868,8 +867,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- program(args) {
- this.bytecode.addStep('program', parseArgs.apply(null, arguments));
+ program(...args) {
+ this.bytecode.addStep('program', args);
return this;
}
@@ -878,8 +877,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- project(args) {
- this.bytecode.addStep('project', parseArgs.apply(null, arguments));
+ project(...args) {
+ this.bytecode.addStep('project', args);
return this;
}
@@ -888,8 +887,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- properties(args) {
- this.bytecode.addStep('properties', parseArgs.apply(null, arguments));
+ properties(...args) {
+ this.bytecode.addStep('properties', args);
return this;
}
@@ -898,8 +897,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- property(args) {
- this.bytecode.addStep('property', parseArgs.apply(null, arguments));
+ property(...args) {
+ this.bytecode.addStep('property', args);
return this;
}
@@ -908,8 +907,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- propertyMap(args) {
- this.bytecode.addStep('propertyMap', parseArgs.apply(null, arguments));
+ propertyMap(...args) {
+ this.bytecode.addStep('propertyMap', args);
return this;
}
@@ -918,8 +917,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- range(args) {
- this.bytecode.addStep('range', parseArgs.apply(null, arguments));
+ range(...args) {
+ this.bytecode.addStep('range', args);
return this;
}
@@ -928,8 +927,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- repeat(args) {
- this.bytecode.addStep('repeat', parseArgs.apply(null, arguments));
+ repeat(...args) {
+ this.bytecode.addStep('repeat', args);
return this;
}
@@ -938,8 +937,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- sack(args) {
- this.bytecode.addStep('sack', parseArgs.apply(null, arguments));
+ sack(...args) {
+ this.bytecode.addStep('sack', args);
return this;
}
@@ -948,8 +947,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- sample(args) {
- this.bytecode.addStep('sample', parseArgs.apply(null, arguments));
+ sample(...args) {
+ this.bytecode.addStep('sample', args);
return this;
}
@@ -958,8 +957,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- select(args) {
- this.bytecode.addStep('select', parseArgs.apply(null, arguments));
+ select(...args) {
+ this.bytecode.addStep('select', args);
return this;
}
@@ -968,8 +967,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- sideEffect(args) {
- this.bytecode.addStep('sideEffect', parseArgs.apply(null, arguments));
+ sideEffect(...args) {
+ this.bytecode.addStep('sideEffect', args);
return this;
}
@@ -978,8 +977,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- simplePath(args) {
- this.bytecode.addStep('simplePath', parseArgs.apply(null, arguments));
+ simplePath(...args) {
+ this.bytecode.addStep('simplePath', args);
return this;
}
@@ -988,8 +987,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- store(args) {
- this.bytecode.addStep('store', parseArgs.apply(null, arguments));
+ store(...args) {
+ this.bytecode.addStep('store', args);
return this;
}
@@ -998,8 +997,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- subgraph(args) {
- this.bytecode.addStep('subgraph', parseArgs.apply(null, arguments));
+ subgraph(...args) {
+ this.bytecode.addStep('subgraph', args);
return this;
}
@@ -1008,8 +1007,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- sum(args) {
- this.bytecode.addStep('sum', parseArgs.apply(null, arguments));
+ sum(...args) {
+ this.bytecode.addStep('sum', args);
return this;
}
@@ -1018,8 +1017,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- tail(args) {
- this.bytecode.addStep('tail', parseArgs.apply(null, arguments));
+ tail(...args) {
+ this.bytecode.addStep('tail', args);
return this;
}
@@ -1028,8 +1027,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- timeLimit(args) {
- this.bytecode.addStep('timeLimit', parseArgs.apply(null, arguments));
+ timeLimit(...args) {
+ this.bytecode.addStep('timeLimit', args);
return this;
}
@@ -1038,8 +1037,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- times(args) {
- this.bytecode.addStep('times', parseArgs.apply(null, arguments));
+ times(...args) {
+ this.bytecode.addStep('times', args);
return this;
}
@@ -1048,8 +1047,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- to(args) {
- this.bytecode.addStep('to', parseArgs.apply(null, arguments));
+ to(...args) {
+ this.bytecode.addStep('to', args);
return this;
}
@@ -1058,8 +1057,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- toE(args) {
- this.bytecode.addStep('toE', parseArgs.apply(null, arguments));
+ toE(...args) {
+ this.bytecode.addStep('toE', args);
return this;
}
@@ -1068,8 +1067,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- toV(args) {
- this.bytecode.addStep('toV', parseArgs.apply(null, arguments));
+ toV(...args) {
+ this.bytecode.addStep('toV', args);
return this;
}
@@ -1078,8 +1077,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- tree(args) {
- this.bytecode.addStep('tree', parseArgs.apply(null, arguments));
+ tree(...args) {
+ this.bytecode.addStep('tree', args);
return this;
}
@@ -1088,8 +1087,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- unfold(args) {
- this.bytecode.addStep('unfold', parseArgs.apply(null, arguments));
+ unfold(...args) {
+ this.bytecode.addStep('unfold', args);
return this;
}
@@ -1098,8 +1097,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- union(args) {
- this.bytecode.addStep('union', parseArgs.apply(null, arguments));
+ union(...args) {
+ this.bytecode.addStep('union', args);
return this;
}
@@ -1108,8 +1107,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- until(args) {
- this.bytecode.addStep('until', parseArgs.apply(null, arguments));
+ until(...args) {
+ this.bytecode.addStep('until', args);
return this;
}
@@ -1118,8 +1117,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- value(args) {
- this.bytecode.addStep('value', parseArgs.apply(null, arguments));
+ value(...args) {
+ this.bytecode.addStep('value', args);
return this;
}
@@ -1128,8 +1127,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- valueMap(args) {
- this.bytecode.addStep('valueMap', parseArgs.apply(null, arguments));
+ valueMap(...args) {
+ this.bytecode.addStep('valueMap', args);
return this;
}
@@ -1138,8 +1137,8 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- values(args) {
- this.bytecode.addStep('values', parseArgs.apply(null, arguments));
+ values(...args) {
+ this.bytecode.addStep('values', args);
return this;
}
@@ -1148,927 +1147,114 @@ class GraphTraversal extends Traversal {
* @param {...Object} args
* @returns {GraphTraversal}
*/
- where(args) {
- this.bytecode.addStep('where', parseArgs.apply(null, arguments));
+ where(...args) {
+ this.bytecode.addStep('where', args);
return this;
}
}
-/**
- * Contains the static method definitions
- * @type {Object}
- */
-const statics = {};
-
-/**
- * V() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.V = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.V.apply(g, arguments);
-};
-
-/**
- * addE() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.addE = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.addE.apply(g, arguments);
-};
-
-/**
- * addInE() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.addInE = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.addInE.apply(g, arguments);
-};
-
-/**
- * addOutE() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.addOutE = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.addOutE.apply(g, arguments);
-};
-
-/**
- * addV() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.addV = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.addV.apply(g, arguments);
-};
-
-/**
- * aggregate() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.aggregate = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.aggregate.apply(g, arguments);
-};
-
-/**
- * and() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.and = function (args) {
+function callOnEmptyTraversal(fnName, args) {
const g = new GraphTraversal(null, null, new Bytecode());
- return g.and.apply(g, arguments);
-};
-
-/**
- * as() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.as = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.as.apply(g, arguments);
-};
-
-/**
- * barrier() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.barrier = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.barrier.apply(g, arguments);
-};
-
-/**
- * both() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.both = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.both.apply(g, arguments);
-};
-
-/**
- * bothE() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.bothE = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.bothE.apply(g, arguments);
-};
-
-/**
- * bothV() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.bothV = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.bothV.apply(g, arguments);
-};
-
-/**
- * branch() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.branch = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.branch.apply(g, arguments);
-};
-
-/**
- * cap() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.cap = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.cap.apply(g, arguments);
-};
-
-/**
- * choose() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.choose = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.choose.apply(g, arguments);
-};
-
-/**
- * coalesce() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.coalesce = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.coalesce.apply(g, arguments);
-};
-
-/**
- * coin() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.coin = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.coin.apply(g, arguments);
-};
-
-/**
- * constant() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.constant = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.constant.apply(g, arguments);
-};
-
-/**
- * count() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.count = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.count.apply(g, arguments);
-};
-
-/**
- * cyclicPath() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.cyclicPath = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.cyclicPath.apply(g, arguments);
-};
-
-/**
- * dedup() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.dedup = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.dedup.apply(g, arguments);
-};
-
-/**
- * drop() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.drop = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.drop.apply(g, arguments);
-};
-
-/**
- * emit() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.emit = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.emit.apply(g, arguments);
-};
-
-/**
- * filter() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.filter = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.filter.apply(g, arguments);
-};
-
-/**
- * flatMap() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.flatMap = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.flatMap.apply(g, arguments);
-};
-
-/**
- * fold() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.fold = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.fold.apply(g, arguments);
-};
-
-/**
- * group() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.group = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.group.apply(g, arguments);
-};
-
-/**
- * groupCount() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.groupCount = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.groupCount.apply(g, arguments);
-};
-
-/**
- * groupV3d0() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.groupV3d0 = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.groupV3d0.apply(g, arguments);
-};
-
-/**
- * has() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.has = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.has.apply(g, arguments);
-};
-
-/**
- * hasId() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.hasId = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.hasId.apply(g, arguments);
-};
-
-/**
- * hasKey() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.hasKey = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.hasKey.apply(g, arguments);
-};
-
-/**
- * hasLabel() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.hasLabel = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.hasLabel.apply(g, arguments);
-};
-
-/**
- * hasNot() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.hasNot = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.hasNot.apply(g, arguments);
-};
-
-/**
- * hasValue() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.hasValue = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.hasValue.apply(g, arguments);
-};
-
-/**
- * id() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.id = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.id.apply(g, arguments);
-};
-
-/**
- * identity() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.identity = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.identity.apply(g, arguments);
-};
-
-/**
- * in() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.in_ = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.in_.apply(g, arguments);
-};
-
-/**
- * inE() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.inE = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.inE.apply(g, arguments);
-};
-
-/**
- * inV() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.inV = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.inV.apply(g, arguments);
-};
-
-/**
- * inject() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.inject = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.inject.apply(g, arguments);
-};
-
-/**
- * is() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.is = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.is.apply(g, arguments);
-};
-
-/**
- * key() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.key = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.key.apply(g, arguments);
-};
-
-/**
- * label() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.label = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.label.apply(g, arguments);
-};
-
-/**
- * limit() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.limit = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.limit.apply(g, arguments);
-};
-
-/**
- * local() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.local = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.local.apply(g, arguments);
-};
-
-/**
- * loops() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.loops = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.loops.apply(g, arguments);
-};
-
-/**
- * map() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.map = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.map.apply(g, arguments);
-};
-
-/**
- * mapKeys() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.mapKeys = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.mapKeys.apply(g, arguments);
-};
-
-/**
- * mapValues() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.mapValues = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.mapValues.apply(g, arguments);
-};
-
-/**
- * match() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.match = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.match.apply(g, arguments);
-};
-
-/**
- * max() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.max = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.max.apply(g, arguments);
-};
-
-/**
- * mean() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.mean = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.mean.apply(g, arguments);
-};
-
-/**
- * min() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.min = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.min.apply(g, arguments);
-};
-
-/**
- * not() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.not = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.not.apply(g, arguments);
-};
-
-/**
- * optional() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.optional = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.optional.apply(g, arguments);
-};
-
-/**
- * or() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.or = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.or.apply(g, arguments);
-};
-
-/**
- * order() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.order = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.order.apply(g, arguments);
-};
-
-/**
- * otherV() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.otherV = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.otherV.apply(g, arguments);
-};
-
-/**
- * out() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.out = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.out.apply(g, arguments);
-};
-
-/**
- * outE() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.outE = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.outE.apply(g, arguments);
-};
-
-/**
- * outV() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.outV = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.outV.apply(g, arguments);
-};
-
-/**
- * path() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.path = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.path.apply(g, arguments);
-};
-
-/**
- * project() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.project = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.project.apply(g, arguments);
-};
-
-/**
- * properties() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.properties = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.properties.apply(g, arguments);
-};
-
-/**
- * property() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.property = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.property.apply(g, arguments);
-};
-
-/**
- * propertyMap() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.propertyMap = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.propertyMap.apply(g, arguments);
-};
-
-/**
- * range() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.range = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.range.apply(g, arguments);
-};
-
-/**
- * repeat() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.repeat = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.repeat.apply(g, arguments);
-};
-
-/**
- * sack() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.sack = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.sack.apply(g, arguments);
-};
-
-/**
- * sample() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.sample = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.sample.apply(g, arguments);
-};
-
-/**
- * select() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.select = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.select.apply(g, arguments);
-};
-
-/**
- * sideEffect() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.sideEffect = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.sideEffect.apply(g, arguments);
-};
-
-/**
- * simplePath() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.simplePath = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.simplePath.apply(g, arguments);
-};
-
-/**
- * store() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.store = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.store.apply(g, arguments);
-};
-
-/**
- * subgraph() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.subgraph = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.subgraph.apply(g, arguments);
-};
-
-/**
- * sum() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.sum = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.sum.apply(g, arguments);
-};
-
-/**
- * tail() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.tail = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.tail.apply(g, arguments);
-};
-
-/**
- * timeLimit() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.timeLimit = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.timeLimit.apply(g, arguments);
-};
-
-/**
- * times() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.times = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.times.apply(g, arguments);
-};
-
-/**
- * to() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.to = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.to.apply(g, arguments);
-};
-
-/**
- * toE() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.toE = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.toE.apply(g, arguments);
-};
-
-/**
- * toV() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.toV = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.toV.apply(g, arguments);
-};
-
-/**
- * tree() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.tree = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.tree.apply(g, arguments);
-};
-
-/**
- * unfold() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.unfold = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.unfold.apply(g, arguments);
-};
-
-/**
- * union() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.union = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.union.apply(g, arguments);
-};
-
-/**
- * until() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.until = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.until.apply(g, arguments);
-};
-
-/**
- * value() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.value = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.value.apply(g, arguments);
-};
-
-/**
- * valueMap() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.valueMap = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.valueMap.apply(g, arguments);
-};
-
-/**
- * values() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.values = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.values.apply(g, arguments);
-};
+ return g[fnName].apply(g, args);
+}
/**
- * where() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
+ * Contains the static method definitions
+ * @type {Object}
*/
-statics.where = function (args) {
- const g = new GraphTraversal(null, null, new Bytecode());
- return g.where.apply(g, arguments);
+const statics = {
+ V: (...args) => callOnEmptyTraversal('V', args),
+ addE: (...args) => callOnEmptyTraversal('addE', args),
+ addInE: (...args) => callOnEmptyTraversal('addInE', args),
+ addOutE: (...args) => callOnEmptyTraversal('addOutE', args),
+ addV: (...args) => callOnEmptyTraversal('addV', args),
+ aggregate: (...args) => callOnEmptyTraversal('aggregate', args),
+ and: (...args) => callOnEmptyTraversal('and', args),
+ as: (...args) => callOnEmptyTraversal('as', args),
+ barrier: (...args) => callOnEmptyTraversal('barrier', args),
+ both: (...args) => callOnEmptyTraversal('both', args),
+ bothE: (...args) => callOnEmptyTraversal('bothE', args),
+ bothV: (...args) => callOnEmptyTraversal('bothV', args),
+ branch: (...args) => callOnEmptyTraversal('branch', args),
+ cap: (...args) => callOnEmptyTraversal('cap', args),
+ choose: (...args) => callOnEmptyTraversal('choose', args),
+ coalesce: (...args) => callOnEmptyTraversal('coalesce', args),
+ coin: (...args) => callOnEmptyTraversal('coin', args),
+ constant: (...args) => callOnEmptyTraversal('constant', args),
+ count: (...args) => callOnEmptyTraversal('count', args),
+ cyclicPath: (...args) => callOnEmptyTraversal('cyclicPath', args),
+ dedup: (...args) => callOnEmptyTraversal('dedup', args),
+ drop: (...args) => callOnEmptyTraversal('drop', args),
+ emit: (...args) => callOnEmptyTraversal('emit', args),
+ filter: (...args) => callOnEmptyTraversal('filter', args),
+ flatMap: (...args) => callOnEmptyTraversal('flatMap', args),
+ fold: (...args) => callOnEmptyTraversal('fold', args),
+ group: (...args) => callOnEmptyTraversal('group', args),
+ groupCount: (...args) => callOnEmptyTraversal('groupCount', args),
+ groupV3d0: (...args) => callOnEmptyTraversal('groupV3d0', args),
+ has: (...args) => callOnEmptyTraversal('has', args),
+ hasId: (...args) => callOnEmptyTraversal('hasId', args),
+ hasKey: (...args) => callOnEmptyTraversal('hasKey', args),
+ hasLabel: (...args) => callOnEmptyTraversal('hasLabel', args),
+ hasNot: (...args) => callOnEmptyTraversal('hasNot', args),
+ hasValue: (...args) => callOnEmptyTraversal('hasValue', args),
+ id: (...args) => callOnEmptyTraversal('id', args),
+ identity: (...args) => callOnEmptyTraversal('identity', args),
+ in_: (...args) => callOnEmptyTraversal('in_', args),
+ inE: (...args) => callOnEmptyTraversal('inE', args),
+ inV: (...args) => callOnEmptyTraversal('inV', args),
+ inject: (...args) => callOnEmptyTraversal('inject', args),
+ is: (...args) => callOnEmptyTraversal('is', args),
+ key: (...args) => callOnEmptyTraversal('key', args),
+ label: (...args) => callOnEmptyTraversal('label', args),
+ limit: (...args) => callOnEmptyTraversal('limit', args),
+ local: (...args) => callOnEmptyTraversal('local', args),
+ loops: (...args) => callOnEmptyTraversal('loops', args),
+ map: (...args) => callOnEmptyTraversal('map', args),
+ mapKeys: (...args) => callOnEmptyTraversal('mapKeys', args),
+ mapValues: (...args) => callOnEmptyTraversal('mapValues', args),
+ match: (...args) => callOnEmptyTraversal('match', args),
+ max: (...args) => callOnEmptyTraversal('max', args),
+ mean: (...args) => callOnEmptyTraversal('mean', args),
+ min: (...args) => callOnEmptyTraversal('min', args),
+ not: (...args) => callOnEmptyTraversal('not', args),
+ optional: (...args) => callOnEmptyTraversal('optional', args),
+ or: (...args) => callOnEmptyTraversal('or', args),
+ order: (...args) => callOnEmptyTraversal('order', args),
+ otherV: (...args) => callOnEmptyTraversal('otherV', args),
+ out: (...args) => callOnEmptyTraversal('out', args),
+ outE: (...args) => callOnEmptyTraversal('outE', args),
+ outV: (...args) => callOnEmptyTraversal('outV', args),
+ path: (...args) => callOnEmptyTraversal('path', args),
+ project: (...args) => callOnEmptyTraversal('project', args),
+ properties: (...args) => callOnEmptyTraversal('properties', args),
+ property: (...args) => callOnEmptyTraversal('property', args),
+ propertyMap: (...args) => callOnEmptyTraversal('propertyMap', args),
+ range: (...args) => callOnEmptyTraversal('range', args),
+ repeat: (...args) => callOnEmptyTraversal('repeat', args),
+ sack: (...args) => callOnEmptyTraversal('sack', args),
+ sample: (...args) => callOnEmptyTraversal('sample', args),
+ select: (...args) => callOnEmptyTraversal('select', args),
+ sideEffect: (...args) => callOnEmptyTraversal('sideEffect', args),
+ simplePath: (...args) => callOnEmptyTraversal('simplePath', args),
+ store: (...args) => callOnEmptyTraversal('store', args),
+ subgraph: (...args) => callOnEmptyTraversal('subgraph', args),
+ sum: (...args) => callOnEmptyTraversal('sum', args),
+ tail: (...args) => callOnEmptyTraversal('tail', args),
+ timeLimit: (...args) => callOnEmptyTraversal('timeLimit', args),
+ times: (...args) => callOnEmptyTraversal('times', args),
+ to: (...args) => callOnEmptyTraversal('to', args),
+ toE: (...args) => callOnEmptyTraversal('toE', args),
+ toV: (...args) => callOnEmptyTraversal('toV', args),
+ tree: (...args) => callOnEmptyTraversal('tree', args),
+ unfold: (...args) => callOnEmptyTraversal('unfold', args),
+ union: (...args) => callOnEmptyTraversal('union', args),
+ until: (...args) => callOnEmptyTraversal('until', args),
+ value: (...args) => callOnEmptyTraversal('value', args),
+ valueMap: (...args) => callOnEmptyTraversal('valueMap', args),
+ values: (...args) => callOnEmptyTraversal('values', args),
+ where: (...args) => callOnEmptyTraversal('where', args)
};
module.exports = {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d37a3d8c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
index d3d97b8..1037f57 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
@@ -33,7 +33,7 @@ class TraversalStrategies {
constructor(parent) {
if (parent) {
// Clone the strategies
- this.strategies = parent.strategies.slice(0);
+ this.strategies = [...parent.strategies];
}
else {
this.strategies = [];
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d37a3d8c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
index a8d066a..4464097 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
@@ -23,7 +23,6 @@
'use strict';
const utils = require('../utils');
-const parseArgs = utils.parseArgs;
const itemDone = Object.freeze({ value: null, done: true });
class Traversal {
@@ -143,68 +142,68 @@ class P {
}
/** @param {...Object} args */
- static between(args) {
- return createP('between', parseArgs.apply(null, arguments));
+ static between(...args) {
+ return createP('between', args);
}
/** @param {...Object} args */
- static eq(args) {
- return createP('eq', parseArgs.apply(null, arguments));
+ static eq(...args) {
+ return createP('eq', args);
}
/** @param {...Object} args */
- static gt(args) {
- return createP('gt', parseArgs.apply(null, arguments));
+ static gt(...args) {
+ return createP('gt', args);
}
/** @param {...Object} args */
- static gte(args) {
- return createP('gte', parseArgs.apply(null, arguments));
+ static gte(...args) {
+ return createP('gte', args);
}
/** @param {...Object} args */
- static inside(args) {
- return createP('inside', parseArgs.apply(null, arguments));
+ static inside(...args) {
+ return createP('inside', args);
}
/** @param {...Object} args */
- static lt(args) {
- return createP('lt', parseArgs.apply(null, arguments));
+ static lt(...args) {
+ return createP('lt', args);
}
/** @param {...Object} args */
- static lte(args) {
- return createP('lte', parseArgs.apply(null, arguments));
+ static lte(...args) {
+ return createP('lte', args);
}
/** @param {...Object} args */
- static neq(args) {
- return createP('neq', parseArgs.apply(null, arguments));
+ static neq(...args) {
+ return createP('neq', args);
}
/** @param {...Object} args */
- static not(args) {
- return createP('not', parseArgs.apply(null, arguments));
+ static not(...args) {
+ return createP('not', args);
}
/** @param {...Object} args */
- static outside(args) {
- return createP('outside', parseArgs.apply(null, arguments));
+ static outside(...args) {
+ return createP('outside', args);
}
/** @param {...Object} args */
- static test(args) {
- return createP('test', parseArgs.apply(null, arguments));
+ static test(...args) {
+ return createP('test', args);
}
/** @param {...Object} args */
- static within(args) {
- return createP('within', parseArgs.apply(null, arguments));
+ static within(...args) {
+ return createP('within', args);
}
/** @param {...Object} args */
- static without(args) {
- return createP('without', parseArgs.apply(null, arguments));
+ static without(...args) {
+ return createP('without', args);
}
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d37a3d8c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
index c864efd..e3a001c 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/utils.js
@@ -23,10 +23,6 @@
*/
'use strict';
-exports.parseArgs = function parseArgs() {
- return (arguments.length === 1 ? [ arguments[0] ] : Array.apply(null, arguments));
-};
-
exports.toLong = function toLong(value) {
return new Long(value);
};
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d37a3d8c/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index 604354c..c668be7 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -25,15 +25,16 @@
"type": "git",
"url": "https://github.com/apache/tinkerpop.git"
},
+ "homepage": "https://tinkerpop.apache.org/",
"bugs": {
"url": "https://issues.apache.org/jira/browse/TINKERPOP"
},
"scripts": {
- "test": "./node_modules/.bin/mocha test/unit test/integration -t 5000",
- "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/",
- "unit-test": "./node_modules/.bin/mocha test/unit"
+ "test": "mocha test/unit test/integration -t 5000",
+ "features": "cucumber.js --require test/cucumber ../../../../../gremlin-test/features/",
+ "unit-test": "mocha test/unit"
},
"engines": {
- "node": ">=4"
+ "node": ">=6"
}
}
\ No newline at end of file
[14/50] [abbrv] tinkerpop git commit: TINKERPOP-1489 Added Nashorn
ScriptEngine to gremlin-javascript
Posted by fl...@apache.org.
TINKERPOP-1489 Added Nashorn ScriptEngine to gremlin-javascript
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/eccbd15a
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/eccbd15a
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/eccbd15a
Branch: refs/heads/TINKERPOP-1854
Commit: eccbd15a94a2fa6aeb1ac19e9d95ba7d6509c187
Parents: 80e1c7e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Sep 5 12:36:12 2017 -0400
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:15 2018 +0100
----------------------------------------------------------------------
docs/src/reference/gremlin-variants.asciidoc | 2 +-
.../src/main/javascript/gremlin-javascript/package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/eccbd15a/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index 76952eb..4a2fe7a 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -447,7 +447,7 @@ very similar to that of Java, it should be very easy to switch between Gremlin-J
[source,bash]
npm install gremlin-javascript
-In Gremlin-JavaScript there exists `GraphTraversalSource`, `GraphTraversal`, and `__` which mirror the respective classes
+The Gremlin-JavaScript provides `GraphTraversalSource`, `GraphTraversal`, and `__` which mirror the respective classes
in Gremlin-Java. The `GraphTraversalSource` requires a RemoteConnection implementation in order to communicate with
<<gremlin-server,GremlinServer>>.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/eccbd15a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index 514663b..1228dd4 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -1,6 +1,6 @@
{
"name": "gremlin-javascript",
- "version": "3.2.6-alpha1",
+ "version": "3.2.7-alpha1",
"description": "JavaScript Gremlin Language Variant",
"author": "Apache TinkerPop team",
"keywords": [
[10/50] [abbrv] tinkerpop git commit: Js GLV: Use Groovy templates
for generation
Posted by fl...@apache.org.
Js GLV: Use Groovy templates for generation
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/98dc52c3
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/98dc52c3
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/98dc52c3
Branch: refs/heads/TINKERPOP-1854
Commit: 98dc52c3f2cdcb0e57493e3710adf675d03a925d
Parents: f5c9049
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Aug 17 17:28:32 2017 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:15 2018 +0100
----------------------------------------------------------------------
.../glv/GraphTraversalSource.template | 127 ++++++++++
gremlin-javascript/glv/PackageJson.template | 55 +++++
gremlin-javascript/glv/TraversalSource.template | 171 +++++++++++++
gremlin-javascript/pom.xml | 131 ++++++++--
.../javascript/GenerateGremlinJavascript.groovy | 36 ---
.../GraphTraversalSourceGenerator.groovy | 231 ------------------
.../javascript/PackageJsonGenerator.groovy | 72 ------
.../gremlin/javascript/SymbolHelper.groovy | 50 ----
.../javascript/TraversalSourceGenerator.groovy | 237 -------------------
.../lib/process/graph-traversal.js | 42 +---
.../gremlin-javascript/lib/process/traversal.js | 6 +-
.../javascript/gremlin-javascript/package.json | 2 +-
12 files changed, 475 insertions(+), 685 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/glv/GraphTraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/GraphTraversalSource.template b/gremlin-javascript/glv/GraphTraversalSource.template
new file mode 100644
index 0000000..e0fb453
--- /dev/null
+++ b/gremlin-javascript/glv/GraphTraversalSource.template
@@ -0,0 +1,127 @@
+/*
+ * 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.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+var t = require('./traversal.js');
+var remote = require('../driver/remote-connection');
+var utils = require('../utils');
+var Bytecode = require('./bytecode');
+var TraversalStrategies = require('./traversal-strategy').TraversalStrategies;
+var inherits = utils.inherits;
+var parseArgs = utils.parseArgs;
+
+/**
+ *
+ * @param {Graph} graph
+ * @param {TraversalStrategies} traversalStrategies
+ * @param {Bytecode} [bytecode]
+ * @constructor
+ */
+function GraphTraversalSource(graph, traversalStrategies, bytecode) {
+ this.graph = graph;
+ this.traversalStrategies = traversalStrategies;
+ this.bytecode = bytecode || new Bytecode();
+}
+
+/**
+ * @param remoteConnection
+ * @returns {GraphTraversalSource}
+ */
+GraphTraversalSource.prototype.withRemote = function (remoteConnection) {
+ var traversalStrategy = new TraversalStrategies(this.traversalStrategies);
+ traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
+ return new GraphTraversalSource(this.graph, traversalStrategy, new Bytecode(this.bytecode));
+};
+
+/**
+ * Returns the string representation of the GraphTraversalSource.
+ * @returns {string}
+ */
+GraphTraversalSource.prototype.toString = function () {
+ return 'graphtraversalsource[' + this.graph.toString() + ']';
+};
+<% sourceStepMethods.each{ method -> %>
+/**
+ * Graph Traversal Source <%= method %> method.
+ * @param {...Object} args
+ * @returns {GraphTraversalSource}
+ */
+GraphTraversalSource.prototype.<%= toJs.call(method) %> = function (args) {
+ var b = new Bytecode(this.bytecode).addSource('<%= method %>', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+};
+<%
+}
+sourceSpawnMethods.each{ method -> %>
+/**
+ * <%= method %> GraphTraversalSource step method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+GraphTraversalSource.prototype.<%= toJs.call(method) %> = function (args) {
+ var b = new Bytecode(this.bytecode).addStep('<%= method %>', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+};
+<% } %>
+/**
+ * Represents a graph traversal.
+ * @extends Traversal
+ * @constructor
+ */
+function GraphTraversal(graph, traversalStrategies, bytecode) {
+ t.Traversal.call(this, graph, traversalStrategies, bytecode);
+}
+
+inherits(GraphTraversal, t.Traversal);
+<% graphStepMethods.each{ method -> %>
+/**
+ * Graph traversal <%= method %> method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+GraphTraversal.prototype.<%= toJs.call(method) %> = function (args) {
+ this.bytecode.addStep('<%= method %>', parseArgs.apply(null, arguments));
+ return this;
+};
+<% } %>
+/**
+ * Contains the static method definitions
+ * @type {Object}
+ */
+var statics = {};
+<% anonStepMethods.each{ method -> %>
+/**
+ * <%= method %>() static method
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+statics.<%= toJs.call(method) %> = function (args) {
+ var g = new GraphTraversal(null, null, new Bytecode());
+ return g.<%= toJs.call(method) %>.apply(g, arguments);
+};
+<% } %>
+module.exports = {
+ GraphTraversal: GraphTraversal,
+ GraphTraversalSource: GraphTraversalSource,
+ statics: statics
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/glv/PackageJson.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/PackageJson.template b/gremlin-javascript/glv/PackageJson.template
new file mode 100644
index 0000000..f61913f
--- /dev/null
+++ b/gremlin-javascript/glv/PackageJson.template
@@ -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.
+*/
+%>{
+ "name": "gremlin-javascript",
+ "version": "<%= version %>",
+ "description": "JavaScript Gremlin Language Variant",
+ "author": "Apache TinkerPop team",
+ "keywords": [
+ "graph",
+ "gremlin",
+ "tinkerpop",
+ "connection",
+ "glv",
+ "driver",
+ "graphdb"
+ ],
+ "license": "Apache-2.0",
+ "dependencies": {
+ "ws": "^3.0.0"
+ },
+ "devDependencies": {
+ "mocha": ">= 1.14.0"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/apache/tinkerpop.git"
+ },
+ "bugs": {
+ "url": "https://issues.apache.org/jira/browse/TINKERPOP"
+ },
+ "scripts": {
+ "test": "./node_modules/.bin/mocha test --recursive -t 5000",
+ "unit-test": "./node_modules/.bin/mocha test/unit"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template
new file mode 100644
index 0000000..dbb7bc4
--- /dev/null
+++ b/gremlin-javascript/glv/TraversalSource.template
@@ -0,0 +1,171 @@
+/*
+ * 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.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+var utils = require('../utils');
+var parseArgs = utils.parseArgs;
+var itemDone = Object.freeze({ value: null, done: true });
+var emptyArray = Object.freeze([]);
+
+function Traversal(graph, traversalStrategies, bytecode) {
+ this.graph = graph;
+ this.traversalStrategies = traversalStrategies;
+ this.bytecode = bytecode;
+ this.traversers = null;
+ this.sideEffects = null;
+ this._traversalStrategiesPromise = null;
+ this._traversersIteratorIndex = 0;
+}
+
+/** @returns {Bytecode} */
+Traversal.prototype.getBytecode = function () {
+ return this.bytecode;
+};
+
+/**
+ * Returns an Array containing the traverser objects.
+ * @returns {Promise.<Array>}
+ */
+Traversal.prototype.toList = function () {
+ var self = this;
+ return this._applyStrategies().then(function () {
+ if (!self.traversers || self._traversersIteratorIndex === self.traversers.length) {
+ return emptyArray;
+ }
+ var arr = new Array(self.traversers.length - self._traversersIteratorIndex);
+ for (var i = self._traversersIteratorIndex; i < self.traversers.length; i++) {
+ arr[i] = self.traversers[i].object;
+ }
+ self._traversersIteratorIndex = self.traversers.length;
+ return arr;
+ });
+};
+
+/**
+ * Async iterator method implementation.
+ * Returns a promise containing an iterator item.
+ * @returns {Promise.<{value, done}>}
+ */
+Traversal.prototype.next = function () {
+ var self = this;
+ return this._applyStrategies().then(function () {
+ if (!self.traversers || self._traversersIteratorIndex === self.traversers.length) {
+ return itemDone;
+ }
+ return { value: self.traversers[self._traversersIteratorIndex++].object, done: false };
+ });
+};
+
+Traversal.prototype._applyStrategies = function () {
+ if (this._traversalStrategiesPromise) {
+ // Apply strategies only once
+ return this._traversalStrategiesPromise;
+ }
+ return this._traversalStrategiesPromise = this.traversalStrategies.applyStrategies(this);
+};
+
+/**
+ * Returns the Bytecode JSON representation of the traversal
+ * @returns {String}
+ */
+Traversal.prototype.toString = function () {
+ return this.bytecode.toString();
+};
+
+/**
+ * Represents an operation.
+ * @constructor
+ */
+function P(operator, value, other) {
+ this.operator = operator;
+ this.value = value;
+ this.other = other;
+}
+
+/**
+ * Returns the string representation of the instance.
+ * @returns {string}
+ */
+P.prototype.toString = function () {
+ if (this.other === undefined) {
+ return this.operator + '(' + this.value + ')';
+ }
+ return this.operator + '(' + this.value + ', ' + this.other + ')';
+};
+
+function createP(operator, args) {
+ args.unshift(null, operator);
+ return new (Function.prototype.bind.apply(P, args));
+}
+<% pmethods.each{ method -> %>
+/** @param {...Object} args */
+P.<%= toJs.call(method) %> = function (args) {
+ return createP('<%= method %>', parseArgs.apply(null, arguments));
+};
+<% } %>
+P.prototype.and = function (arg) {
+ return new P('and', this, arg);
+};
+
+P.prototype.or = function (arg) {
+ return new P('or', this, arg);
+};
+
+function Traverser(object, bulk) {
+ this.object = object;
+ this.bulk = bulk == undefined ? 1 : bulk;
+}
+
+function TraversalSideEffects() {
+
+}
+
+function toEnum(typeName, keys) {
+ var result = {};
+ keys.split(' ').forEach(function (k) {
+ var jsKey = k;
+ if (jsKey === jsKey.toUpperCase()) {
+ jsKey = jsKey.toLowerCase();
+ }
+ result[jsKey] = new EnumValue(typeName, k);
+ });
+ return result;
+}
+
+function EnumValue(typeName, elementName) {
+ this.typeName = typeName;
+ this.elementName = elementName;
+}
+
+module.exports = {
+ EnumValue: EnumValue,
+ P: P,
+ Traversal: Traversal,
+ TraversalSideEffects: TraversalSideEffects,
+ Traverser: Traverser<%
+enums.each{ enumClass ->
+ out.print ",\n " + decapitalize.call(enumClass.simpleName) + ": toEnum('" + enumClass.simpleName + "', '" +
+ enumClass.getEnumConstants().sort { a, b -> a.name() <=> b.name() }.collect { toJs.call(it.name()) }.join(' ') + "')"
+}
+%>
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index 452e183..203e59e 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -31,12 +31,6 @@ limitations under the License.
<artifactId>gremlin-core</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>${groovy.version}</version>
- <classifier>indy</classifier>
- </dependency>
<!-- TESTING -->
<dependency>
<groupId>org.apache.tinkerpop</groupId>
@@ -72,27 +66,18 @@ limitations under the License.
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.2.1</version>
- <executions>
- <execution>
- <id>generate-javascript</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>java</goal>
- </goals>
- <configuration>
- <mainClass>org.apache.tinkerpop.gremlin.javascript.GenerateGremlinJavascript</mainClass>
- <arguments>
- <argument>${project.version}</argument>
- <argument>${basedir}</argument>
- </arguments>
- </configuration>
- </execution>
- </executions>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
</plugin>
<plugin>
+ <!--
+ Use gmavenplus-plugin to:
+ - Generate js sources
+ - Start and stop gremlin server for integration tests
+ -->
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<dependencies>
@@ -116,6 +101,102 @@ limitations under the License.
</dependencies>
<executions>
<execution>
+ <id>generate-javascript</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <scripts>
+ <script><![CDATA[
+import org.apache.tinkerpop.gremlin.jsr223.CoreImports
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource
+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.P
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
+import java.lang.reflect.Modifier
+
+def toJsMap = ["in": "in_",
+ "from": "from_"]
+
+def toJs = { symbol -> toJsMap.getOrDefault(symbol, symbol) }
+
+def decapitalize = {
+ String string = it;
+ if (string == null || string.length() == 0) {
+ return string;
+ }
+ def c = string.toCharArray();
+ c[0] = Character.toLowerCase(c[0]);
+ return new String(c);
+}
+
+def determineVersion = {
+ def env = System.getenv()
+ def mavenVersion = env.containsKey("TP_RELEASE_VERSION") ? env.get("JS_RELEASE_VERSION") : '${project.version}'
+ return mavenVersion.replace("-SNAPSHOT", "-alpha1")
+}
+
+def binding = ["enums": CoreImports.getClassImports()
+ .findAll { Enum.class.isAssignableFrom(it) }
+ .sort { a, b -> a.getSimpleName() <=> b.getSimpleName() },
+ "pmethods": P.class.getMethods().
+ findAll { Modifier.isStatic(it.getModifiers()) }.
+ findAll { P.class.isAssignableFrom(it.returnType) }.
+ collect { it.name }.
+ unique().
+ sort { a, b -> a <=> b },
+ "sourceStepMethods": GraphTraversalSource.getMethods(). // SOURCE STEPS
+ findAll { GraphTraversalSource.class.equals(it.returnType) }.
+ findAll {
+ !it.name.equals("clone") &&
+ !it.name.equals(TraversalSource.Symbols.withBindings) &&
+ !it.name.equals(TraversalSource.Symbols.withRemote) &&
+ !it.name.equals(TraversalSource.Symbols.withComputer)
+ }.
+ collect { it.name }.
+ unique().
+ sort { a, b -> a <=> b },
+ "sourceSpawnMethods": GraphTraversalSource.getMethods(). // SPAWN STEPS
+ findAll { GraphTraversal.class.equals(it.returnType) }.
+ collect { it.name }.
+ unique().
+ sort { a, b -> a <=> b },
+ "graphStepMethods": GraphTraversal.getMethods().
+ findAll { GraphTraversal.class.equals(it.returnType) }.
+ findAll { !it.name.equals("clone") && !it.name.equals("iterate") }.
+ collect { it.name }.
+ unique().
+ sort { a, b -> a <=> b },
+ "anonStepMethods": __.class.getMethods().
+ findAll { GraphTraversal.class.equals(it.returnType) }.
+ findAll { Modifier.isStatic(it.getModifiers()) }.
+ findAll { !it.name.equals("__") && !it.name.equals("start") }.
+ collect { it.name }.
+ unique().
+ sort { a, b -> a <=> b },
+ "toJs": toJs,
+ "version": determineVersion(),
+ "decapitalize": decapitalize]
+
+def engine = new groovy.text.GStringTemplateEngine()
+def graphTraversalTemplate = engine.createTemplate(new File('${project.basedir}/glv/GraphTraversalSource.template')).make(binding)
+def graphTraversalFile = new File('${project.basedir}/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js')
+graphTraversalFile.newWriter().withWriter{ it << graphTraversalTemplate }
+
+def traversalTemplate = engine.createTemplate(new File('${project.basedir}/glv/TraversalSource.template')).make(binding)
+def traversalFile = new File('${project.basedir}/src/main/javascript/gremlin-javascript/lib/process/traversal.js')
+traversalFile.newWriter().withWriter{ it << traversalTemplate }
+
+def packageJsonTemplate = engine.createTemplate(new File('${project.basedir}/glv/PackageJson.template')).make(binding)
+def packageJsonFile = new File('${project.basedir}/src/main/javascript/gremlin-javascript/package.json')
+packageJsonFile.newWriter().withWriter{ it << packageJsonTemplate }
+]]> </script>
+ </scripts>
+ </configuration>
+ </execution>
+ <execution>
<id>gremlin-server-start</id>
<phase>pre-integration-test</phase>
<goals>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GenerateGremlinJavascript.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GenerateGremlinJavascript.groovy b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GenerateGremlinJavascript.groovy
deleted file mode 100644
index ab9eaf1..0000000
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GenerateGremlinJavascript.groovy
+++ /dev/null
@@ -1,36 +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.javascript
-
-public class GenerateGremlinJavascript {
- public static void main(String[] args) {
- String projectVersion = args[0];
- final String baseDir = args[1];
- final String jsModuleDir = "${baseDir}/src/main/javascript/gremlin-javascript";
- Integer versionSnapshotIndex = projectVersion.indexOf("-SNAPSHOT");
- if (versionSnapshotIndex > 0) {
- // Use a alpha version x.y.z-alpha1
- projectVersion = projectVersion.substring(0, versionSnapshotIndex) + "-alpha1";
- }
- TraversalSourceGenerator.create("$jsModuleDir/lib/process/traversal.js");
- GraphTraversalSourceGenerator.create("$jsModuleDir/lib/process/graph-traversal.js");
- PackageJsonGenerator.create("$jsModuleDir/package.json", projectVersion);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
deleted file mode 100644
index 3227f2c..0000000
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/GraphTraversalSourceGenerator.groovy
+++ /dev/null
@@ -1,231 +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.javascript
-
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource
-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.javascript.SymbolHelper
-
-import java.lang.reflect.Modifier
-
-/**
- * @author Jorge Bay Gondra
- */
-class GraphTraversalSourceGenerator {
-
- public static void create(final String graphTraversalSourceFile) {
-
- final StringBuilder moduleOutput = new StringBuilder()
-
- moduleOutput.append("""/*
- * 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.
- */
- """)
-
-//////////////////////////
-// GraphTraversalSource //
-//////////////////////////
- moduleOutput.append("""
-/**
- * @author Jorge Bay Gondra
- */
-'use strict';
-
-var t = require('./traversal.js');
-var remote = require('../driver/remote-connection');
-var utils = require('../utils');
-var Bytecode = require('./bytecode');
-var TraversalStrategies = require('./traversal-strategy').TraversalStrategies;
-var inherits = utils.inherits;
-var parseArgs = utils.parseArgs;
-
-/**
- *
- * @param {Graph} graph
- * @param {TraversalStrategies} traversalStrategies
- * @param {Bytecode} [bytecode]
- * @constructor
- */
-function GraphTraversalSource(graph, traversalStrategies, bytecode) {
- this.graph = graph;
- this.traversalStrategies = traversalStrategies;
- this.bytecode = bytecode || new Bytecode();
-}
-
-/**
- * @param remoteConnection
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.withRemote = function (remoteConnection) {
- var traversalStrategy = new TraversalStrategies(this.traversalStrategies);
- traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
- return new GraphTraversalSource(this.graph, traversalStrategy, new Bytecode(this.bytecode));
-};
-
-/**
- * Returns the string representation of the GraphTraversalSource.
- * @returns {string}
- */
-GraphTraversalSource.prototype.toString = function () {
- return 'graphtraversalsource[' + this.graph.toString() + ']';
-};
-""")
- GraphTraversalSource.getMethods(). // SOURCE STEPS
- findAll { GraphTraversalSource.class.equals(it.returnType) }.
- findAll {
- !it.name.equals("clone") &&
- !it.name.equals(TraversalSource.Symbols.withBindings) &&
- !it.name.equals(TraversalSource.Symbols.withRemote)
- }.
- collect { it.name }.
- unique().
- sort { a, b -> a <=> b }.
- forEach { methodName ->
- moduleOutput.append(
- """
-/**
- * Graph Traversal Source ${methodName} method.
- * @param {...Object} args
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.${SymbolHelper.toJs(methodName)} = function (args) {
- var b = new Bytecode(this.bytecode).addSource('$methodName', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-""")
- }
- GraphTraversalSource.getMethods().
- findAll { GraphTraversal.class.equals(it.returnType) }.
- collect { it.name }.
- unique().
- sort { a, b -> a <=> b }.
- forEach { methodName ->
- moduleOutput.append(
- """
-/**
- * $methodName GraphTraversalSource step method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversalSource.prototype.${SymbolHelper.toJs(methodName)} = function (args) {
- var b = new Bytecode(this.bytecode).addStep('$methodName', parseArgs.apply(null, arguments));
- return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-""")
- }
-////////////////////
-// GraphTraversal //
-////////////////////
- moduleOutput.append(
- """
-/**
- * Represents a graph traversal.
- * @extends Traversal
- * @constructor
- */
-function GraphTraversal(graph, traversalStrategies, bytecode) {
- t.Traversal.call(this, graph, traversalStrategies, bytecode);
-}
-
-inherits(GraphTraversal, t.Traversal);
-""")
- GraphTraversal.getMethods().
- findAll { GraphTraversal.class.equals(it.returnType) }.
- findAll { !it.name.equals("clone") && !it.name.equals("iterate") }.
- collect { it.name }.
- unique().
- sort { a, b -> a <=> b }.
- forEach { methodName ->
- moduleOutput.append(
- """
-/**
- * Graph traversal $methodName method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.${SymbolHelper.toJs(methodName)} = function (args) {
- this.bytecode.addStep('$methodName', parseArgs.apply(null, arguments));
- return this;
-};
-""")
- };
-
-////////////////////////
-// AnonymousTraversal //
-////////////////////////
- moduleOutput.append("""
-/**
- * Contains the static method definitions
- * @type {Object}
- */
-var statics = {};
-""");
- __.class.getMethods().
- findAll { GraphTraversal.class.equals(it.returnType) }.
- findAll { Modifier.isStatic(it.getModifiers()) }.
- findAll { !it.name.equals("__") }.
- collect { SymbolHelper.toJs(it.name) }.
- unique().
- sort { a, b -> a <=> b }.
- forEach { method ->
- moduleOutput.append(
- """
-/**
- * ${method}() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.${method} = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
- return g.${method}.apply(g, arguments);
-};
-""")
- };
-
- moduleOutput.append("""
-module.exports = {
- GraphTraversal: GraphTraversal,
- GraphTraversalSource: GraphTraversalSource,
- statics: statics
-};""");
-
- // save to file
- final File file = new File(graphTraversalSourceFile);
- file.delete()
- moduleOutput.eachLine { file.append(it + "\n") }
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/PackageJsonGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/PackageJsonGenerator.groovy b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/PackageJsonGenerator.groovy
deleted file mode 100644
index 4b4d012..0000000
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/PackageJsonGenerator.groovy
+++ /dev/null
@@ -1,72 +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.javascript
-
-/**
- * @author Jorge Bay Gondra
- */
-class PackageJsonGenerator {
-
- public static void create(final String traversalSourceFile, final String version) {
-
- final StringBuilder moduleOutput = new StringBuilder();
- moduleOutput.append("""{
- "name": "gremlin-javascript",
- "version": "${version}",
- "description": "JavaScript Gremlin Language Variant",
- "author": "Apache TinkerPop team",
- "keywords": [
- "graph",
- "gremlin",
- "tinkerpop",
- "connection",
- "glv",
- "driver",
- "graphdb"
- ],
- "license": "Apache-2.0",
- "dependencies": {
- "ws": "^3.0.0"
- },
- "devDependencies": {
- "mocha": ">= 1.14.0"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/apache/tinkerpop.git"
- },
- "bugs": {
- "url": "https://issues.apache.org/jira/browse/TINKERPOP"
- },
- "scripts": {
- "test": "./node_modules/.bin/mocha test --recursive -t 5000",
- "unit-test": "./node_modules/.bin/mocha test/unit"
- },
- "engines": {
- "node": ">=4"
- }
-}""" );
-
- // save to a file
- final File file = new File(traversalSourceFile);
- file.delete()
- moduleOutput.eachLine { file.append(it + "\n") }
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/SymbolHelper.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/SymbolHelper.groovy b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/SymbolHelper.groovy
deleted file mode 100644
index ed45cdb..0000000
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/SymbolHelper.groovy
+++ /dev/null
@@ -1,50 +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.javascript
-
-/**
- * @author Jorge Bay Gondra
- */
-public final class SymbolHelper {
-
- private final static Map<String, String> TO_JS_MAP = new HashMap<>();
-
- static {
- TO_JS_MAP.put("in", "in_");
- TO_JS_MAP.put("from", "from_");
- }
-
- private SymbolHelper() {
- // static methods only, do not instantiate
- }
-
- public static String toJs(final String symbol) {
- return TO_JS_MAP.getOrDefault(symbol, symbol);
- }
-
- public static String decapitalize(String string) {
- if (string == null || string.length() == 0) {
- return string;
- }
- def c = string.toCharArray();
- c[0] = Character.toLowerCase(c[0]);
- return new String(c);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
deleted file mode 100644
index f3405c3..0000000
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
+++ /dev/null
@@ -1,237 +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.javascript
-
-import org.apache.tinkerpop.gremlin.process.traversal.P
-import org.apache.tinkerpop.gremlin.util.CoreImports
-
-import java.lang.reflect.Modifier
-
-/**
- * @author Jorge Bay Gondra
- */
-class TraversalSourceGenerator {
-
- public static void create(final String traversalSourceFile) {
-
- final StringBuilder moduleOutput = new StringBuilder()
-
- moduleOutput.append("""/*
- * 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.
- */
-""")
- moduleOutput.append("""
-/**
- * @author Jorge Bay Gondra
- */
-'use strict';
-
-var utils = require('../utils');
-var parseArgs = utils.parseArgs;
-var itemDone = Object.freeze({ value: null, done: true });
-var emptyArray = Object.freeze([]);
-
-function Traversal(graph, traversalStrategies, bytecode) {
- this.graph = graph;
- this.traversalStrategies = traversalStrategies;
- this.bytecode = bytecode;
- this.traversers = null;
- this.sideEffects = null;
- this._traversalStrategiesPromise = null;
- this._traversersIteratorIndex = 0;
-}
-
-/** @returns {Bytecode} */
-Traversal.prototype.getBytecode = function () {
- return this.bytecode;
-};
-
-/**
- * Returns an Array containing the traverser objects.
- * @returns {Promise.<Array>}
- */
-Traversal.prototype.toList = function () {
- var self = this;
- return this._applyStrategies().then(function () {
- if (!self.traversers || self._traversersIteratorIndex === self.traversers.length) {
- return emptyArray;
- }
- var arr = new Array(self.traversers.length - self._traversersIteratorIndex);
- for (var i = self._traversersIteratorIndex; i < self.traversers.length; i++) {
- arr[i] = self.traversers[i].object;
- }
- self._traversersIteratorIndex = self.traversers.length;
- return arr;
- });
-};
-
-/**
- * Async iterator method implementation.
- * Returns a promise containing an iterator item.
- * @returns {Promise.<{value, done}>}
- */
-Traversal.prototype.next = function () {
- var self = this;
- return this._applyStrategies().then(function () {
- if (!self.traversers || self._traversersIteratorIndex === self.traversers.length) {
- return itemDone;
- }
- return { value: self.traversers[self._traversersIteratorIndex++].object, done: false };
- });
-};
-
-Traversal.prototype._applyStrategies = function () {
- if (this._traversalStrategiesPromise) {
- // Apply strategies only once
- return this._traversalStrategiesPromise;
- }
- return this._traversalStrategiesPromise = this.traversalStrategies.applyStrategies(this);
-};
-
-/**
- * Returns the Bytecode JSON representation of the traversal
- * @returns {String}
- */
-Traversal.prototype.toString = function () {
- return this.bytecode.toString();
-};
- """);
-
- moduleOutput.append("""
-/**
- * Represents an operation.
- * @constructor
- */
-function P(operator, value, other) {
- this.operator = operator;
- this.value = value;
- this.other = other;
-}
-
-/**
- * Returns the string representation of the instance.
- * @returns {string}
- */
-P.prototype.toString = function () {
- if (this.other === undefined) {
- return this.operator + '(' + this.value + ')';
- }
- return this.operator + '(' + this.value + ', ' + this.other + ')';
-};
-
-function createP(operator, args) {
- args.unshift(null, operator);
- return new (Function.prototype.bind.apply(P, args));
-}
-""")
- P.class.getMethods().
- findAll { Modifier.isStatic(it.getModifiers()) }.
- findAll { P.class.isAssignableFrom(it.returnType) }.
- collect { it.name }.
- unique().
- sort { a, b -> a <=> b }.
- each { methodName ->
- moduleOutput.append(
- """
-/** @param {...Object} args */
-P.${SymbolHelper.toJs(methodName)} = function (args) {
- return createP('$methodName', parseArgs.apply(null, arguments));
-};
-""")
- };
- moduleOutput.append("""
-P.prototype.and = function (arg) {
- return new P('and', this, arg);
-};
-
-P.prototype.or = function (arg) {
- return new P('or', this, arg);
-};
-""")
-
- moduleOutput.append("""
-function Traverser(object, bulk) {
- this.object = object;
- this.bulk = bulk == undefined ? 1 : bulk;
-}
-
-function TraversalSideEffects() {
-
-}
-
-function toEnum(typeName, keys) {
- var result = {};
- keys.split(' ').forEach(function (k) {
- var jsKey = k;
- if (jsKey === jsKey.toUpperCase()) {
- jsKey = jsKey.toLowerCase();
- }
- result[jsKey] = new EnumValue(typeName, k);
- });
- return result;
-}
-
-function EnumValue(typeName, elementName) {
- this.typeName = typeName;
- this.elementName = elementName;
-}
-
-module.exports = {
- EnumValue: EnumValue,
- P: P,
- Traversal: Traversal,
- TraversalSideEffects: TraversalSideEffects,
- Traverser: Traverser""")
- for (final Class<? extends Enum> enumClass : CoreImports.getClassImports().
- findAll { Enum.class.isAssignableFrom(it) }.
- sort { a, b -> a.simpleName <=> b.simpleName }) {
- moduleOutput.append(",\n ${SymbolHelper.decapitalize(enumClass.simpleName)}: " +
- "toEnum('${SymbolHelper.toJs(enumClass.simpleName)}', '");
- moduleOutput.append(
- enumClass.getEnumConstants().
- sort { a, b -> a.name() <=> b.name() }.
- collect { SymbolHelper.toJs(it.name()) }.
- join(' '));
- moduleOutput.append("\')");
- }
-
- moduleOutput.append("""\n};""");
-
- // save to a file
- final File file = new File(traversalSourceFile);
- file.delete()
- moduleOutput.eachLine { file.append(it + "\n") }
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/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 5ee734a1..f6a0de1 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
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-
+
/**
* @author Jorge Bay Gondra
*/
@@ -72,16 +72,6 @@ GraphTraversalSource.prototype.withBulk = function (args) {
};
/**
- * Graph Traversal Source withComputer method.
- * @param {...Object} args
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.withComputer = function (args) {
- var b = new Bytecode(this.bytecode).addSource('withComputer', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
* Graph Traversal Source withPath method.
* @param {...Object} args
* @returns {GraphTraversalSource}
@@ -1539,33 +1529,33 @@ statics.identity = function (args) {
};
/**
- * inE() static method
+ * in() static method
* @param {...Object} args
* @returns {GraphTraversal}
*/
-statics.inE = function (args) {
+statics.in_ = function (args) {
var g = new GraphTraversal(null, null, new Bytecode());
- return g.inE.apply(g, arguments);
+ return g.in_.apply(g, arguments);
};
/**
- * inV() static method
+ * inE() static method
* @param {...Object} args
* @returns {GraphTraversal}
*/
-statics.inV = function (args) {
+statics.inE = function (args) {
var g = new GraphTraversal(null, null, new Bytecode());
- return g.inV.apply(g, arguments);
+ return g.inE.apply(g, arguments);
};
/**
- * in_() static method
+ * inV() static method
* @param {...Object} args
* @returns {GraphTraversal}
*/
-statics.in_ = function (args) {
+statics.inV = function (args) {
var g = new GraphTraversal(null, null, new Bytecode());
- return g.in_.apply(g, arguments);
+ return g.inV.apply(g, arguments);
};
/**
@@ -1909,16 +1899,6 @@ statics.simplePath = function (args) {
};
/**
- * start() static method
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-statics.start = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
- return g.start.apply(g, arguments);
-};
-
-/**
* store() static method
* @param {...Object} args
* @returns {GraphTraversal}
@@ -2092,4 +2072,4 @@ module.exports = {
GraphTraversal: GraphTraversal,
GraphTraversalSource: GraphTraversalSource,
statics: statics
-};
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
index 1cd6b53..49c6aef 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
@@ -91,7 +91,7 @@ Traversal.prototype._applyStrategies = function () {
Traversal.prototype.toString = function () {
return this.bytecode.toString();
};
-
+
/**
* Represents an operation.
* @constructor
@@ -227,10 +227,12 @@ module.exports = {
cardinality: toEnum('Cardinality', 'list set single'),
column: toEnum('Column', 'keys values'),
direction: toEnum('Direction', 'BOTH IN OUT'),
+ graphSONVersion: toEnum('GraphSONVersion', 'V1_0 V2_0'),
+ gryoVersion: toEnum('GryoVersion', 'V1_0'),
operator: toEnum('Operator', 'addAll and assign div max min minus mult or sum sumLong'),
order: toEnum('Order', 'decr incr keyDecr keyIncr shuffle valueDecr valueIncr'),
pick: toEnum('Pick', 'any none'),
pop: toEnum('Pop', 'all first last'),
scope: toEnum('Scope', 'global local'),
t: toEnum('T', 'id key label value')
-};
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/98dc52c3/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index db6d3fe..514663b 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -33,4 +33,4 @@
"engines": {
"node": ">=4"
}
-}
+}
\ No newline at end of file
[19/50] [abbrv] tinkerpop git commit: Support ignore scenarios
Posted by fl...@apache.org.
Support ignore scenarios
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f9f7033e
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f9f7033e
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f9f7033e
Branch: refs/heads/TINKERPOP-1854
Commit: f9f7033ed3abd9aaadc7203054fed9554315a78f
Parents: b8eb6c0
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Nov 28 13:14:26 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:16 2018 +0100
----------------------------------------------------------------------
.../test/cucumber/feature-steps.js | 20 ++++++++++++++------
.../gremlin-javascript/test/cucumber/world.js | 4 +++-
2 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9f7033e/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
index 99e2ec8..06a3283 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -52,8 +52,20 @@ const parsers = [
[ 'c\\[(.+)\\]', toLambda ]
].map(x => [ new RegExp('^' + x[0] + '$'), x[1] ]);
+const ignoreReason = {
+ lambdaNotSupported: 'Lambdas are not supported on gremlin-javascript',
+};
+
+const ignoredScenarios = {
+ // An associative array containing the scenario name as key, for example:
+ // 'g_V_branchXlabel_eq_person': new IgnoreError(ignoreReason.lambdaNotSupported),
+};
+
defineSupportCode(function(methods) {
methods.Given(/^the (.+) graph$/, function (graphName) {
+ if (ignoredScenarios[this.scenario]) {
+ return 'skipped';
+ }
this.graphName = graphName;
const data = this.getData();
this.g = new Graph().traversal().withRemote(data.connection);
@@ -282,7 +294,7 @@ function parseMapValue(value) {
}
function toLambda() {
- throw new IgnoreError(IgnoreError.reason.lambdaNotSupported);
+ throw new IgnoreError(ignoreReason.lambdaNotSupported);
}
/**
@@ -310,8 +322,4 @@ function IgnoreError(reason) {
Error.captureStackTrace(this, IgnoreError);
}
-util.inherits(IgnoreError, Error);
-
-IgnoreError.reason = {
- lambdaNotSupported: 'Lambdas are not supported on gremlin-javascript',
-};
\ No newline at end of file
+util.inherits(IgnoreError, Error);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9f7033e/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
index 03febd1..ae3f9a6 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
@@ -33,6 +33,7 @@ defineSupportCode(function (methods) {
const cache = {};
function TinkerPopWorld(){
+ this.scenario = null;
this.g = null;
this.traversal = null;
this.result = null;
@@ -91,7 +92,8 @@ defineSupportCode(function (methods) {
return Promise.all(Object.keys(cache).map(graphName => cache[graphName].connection.close()));
});
- methods.Before(function () {
+ methods.Before(function (info) {
+ this.scenario = info.pickle.name;
this.cache = cache;
});
});
[31/50] [abbrv] tinkerpop git commit: Move generation script to
groovy file
Posted by fl...@apache.org.
Move generation script to groovy file
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2afd9716
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2afd9716
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2afd9716
Branch: refs/heads/TINKERPOP-1854
Commit: 2afd97165500617a4217e46d48c690df45c83686
Parents: 843a727
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Jan 8 11:27:03 2018 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:17 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/glv/generate.groovy | 107 +++++++++++++++++++
gremlin-javascript/pom.xml | 99 +++--------------
.../javascript/gremlin-javascript/package.json | 2 +-
3 files changed, 120 insertions(+), 88 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2afd9716/gremlin-javascript/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/generate.groovy b/gremlin-javascript/glv/generate.groovy
new file mode 100644
index 0000000..8fd22e3
--- /dev/null
+++ b/gremlin-javascript/glv/generate.groovy
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+
+
+import groovy.text.GStringTemplateEngine
+import org.apache.tinkerpop.gremlin.jsr223.CoreImports
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource
+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.P
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
+import java.lang.reflect.Modifier
+
+def toJsMap = ["in": "in_",
+ "from": "from_"]
+
+def toJs = { symbol -> toJsMap.getOrDefault(symbol, symbol) }
+
+def decapitalize = {
+ String string = it;
+ if (string == null || string.length() == 0) {
+ return string;
+ }
+ def c = string.toCharArray();
+ c[0] = Character.toLowerCase(c[0]);
+ return new String(c);
+}
+
+def determineVersion = {
+ def env = System.getenv()
+ def mavenVersion = env.containsKey("TP_RELEASE_VERSION") ? env.get("JS_RELEASE_VERSION") : project.version
+ return mavenVersion.replace("-SNAPSHOT", "-alpha1")
+}
+
+def binding = ["enums": CoreImports.getClassImports()
+ .findAll { Enum.class.isAssignableFrom(it) }
+ .sort { a, b -> a.getSimpleName() <=> b.getSimpleName() },
+ "pmethods": P.class.getMethods().
+ findAll { Modifier.isStatic(it.getModifiers()) }.
+ findAll { P.class.isAssignableFrom(it.returnType) }.
+ collect { it.name }.
+ unique().
+ sort { a, b -> a <=> b },
+ "sourceStepMethods": GraphTraversalSource.getMethods(). // SOURCE STEPS
+ findAll { GraphTraversalSource.class.equals(it.returnType) }.
+ findAll {
+ !it.name.equals("clone") &&
+ // Use hardcoded name to be for forward-compatibility
+ !it.name.equals("withBindings") &&
+ !it.name.equals(TraversalSource.Symbols.withRemote) &&
+ !it.name.equals(TraversalSource.Symbols.withComputer)
+ }.
+ collect { it.name }.
+ unique().
+ sort { a, b -> a <=> b },
+ "sourceSpawnMethods": GraphTraversalSource.getMethods(). // SPAWN STEPS
+ findAll { GraphTraversal.class.equals(it.returnType) }.
+ collect { it.name }.
+ unique().
+ sort { a, b -> a <=> b },
+ "graphStepMethods": GraphTraversal.getMethods().
+ findAll { GraphTraversal.class.equals(it.returnType) }.
+ findAll { !it.name.equals("clone") && !it.name.equals("iterate") }.
+ collect { it.name }.
+ unique().
+ sort { a, b -> a <=> b },
+ "anonStepMethods": __.class.getMethods().
+ findAll { GraphTraversal.class.equals(it.returnType) }.
+ findAll { Modifier.isStatic(it.getModifiers()) }.
+ findAll { !it.name.equals("__") && !it.name.equals("start") }.
+ collect { it.name }.
+ unique().
+ sort { a, b -> a <=> b },
+ "toJs": toJs,
+ "version": determineVersion(),
+ "decapitalize": decapitalize]
+
+def engine = new GStringTemplateEngine()
+def graphTraversalTemplate = engine.createTemplate(new File("${project.basedir}/glv/GraphTraversalSource.template"))
+ .make(binding)
+def graphTraversalFile =
+ new File("${project.basedir}/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js")
+graphTraversalFile.newWriter().withWriter{ it << graphTraversalTemplate }
+
+def traversalTemplate = engine.createTemplate(new File("${project.basedir}/glv/TraversalSource.template")).make(binding)
+def traversalFile = new File("${project.basedir}/src/main/javascript/gremlin-javascript/lib/process/traversal.js")
+traversalFile.newWriter().withWriter{ it << traversalTemplate }
+
+def packageJsonTemplate = engine.createTemplate(new File("${project.basedir}/glv/PackageJson.template")).make(binding)
+def packageJsonFile = new File("${project.basedir}/src/main/javascript/gremlin-javascript/package.json")
+packageJsonFile.newWriter().withWriter{ it << packageJsonTemplate }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2afd9716/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index aa219ab..0825ba6 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkerpop</artifactId>
- <version>3.2.7-SNAPSHOT</version>
+ <version>3.2.8-SNAPSHOT</version>
</parent>
<artifactId>gremlin-javascript</artifactId>
<name>Apache TinkerPop :: Gremlin Javascript</name>
@@ -106,93 +106,18 @@ limitations under the License.
<goal>execute</goal>
</goals>
<configuration>
+ <properties>
+ <property>
+ <name>projectBaseDir</name>
+ <value>${project.basedir}</value>
+ </property>
+ <property>
+ <name>projectVersion</name>
+ <value>${project.version}</value>
+ </property>
+ </properties>
<scripts>
- <script><![CDATA[
-import org.apache.tinkerpop.gremlin.jsr223.CoreImports
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource
-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.P
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
-import java.lang.reflect.Modifier
-
-def toJsMap = ["in": "in_",
- "from": "from_"]
-
-def toJs = { symbol -> toJsMap.getOrDefault(symbol, symbol) }
-
-def decapitalize = {
- String string = it;
- if (string == null || string.length() == 0) {
- return string;
- }
- def c = string.toCharArray();
- c[0] = Character.toLowerCase(c[0]);
- return new String(c);
-}
-
-def determineVersion = {
- def env = System.getenv()
- def mavenVersion = env.containsKey("TP_RELEASE_VERSION") ? env.get("JS_RELEASE_VERSION") : '${project.version}'
- return mavenVersion.replace("-SNAPSHOT", "-alpha1")
-}
-
-def binding = ["enums": CoreImports.getClassImports()
- .findAll { Enum.class.isAssignableFrom(it) }
- .sort { a, b -> a.getSimpleName() <=> b.getSimpleName() },
- "pmethods": P.class.getMethods().
- findAll { Modifier.isStatic(it.getModifiers()) }.
- findAll { P.class.isAssignableFrom(it.returnType) }.
- collect { it.name }.
- unique().
- sort { a, b -> a <=> b },
- "sourceStepMethods": GraphTraversalSource.getMethods(). // SOURCE STEPS
- findAll { GraphTraversalSource.class.equals(it.returnType) }.
- findAll {
- !it.name.equals("clone") &&
- // Use hardcoded name to be for forward-compatibility
- !it.name.equals("withBindings") &&
- !it.name.equals(TraversalSource.Symbols.withRemote) &&
- !it.name.equals(TraversalSource.Symbols.withComputer)
- }.
- collect { it.name }.
- unique().
- sort { a, b -> a <=> b },
- "sourceSpawnMethods": GraphTraversalSource.getMethods(). // SPAWN STEPS
- findAll { GraphTraversal.class.equals(it.returnType) }.
- collect { it.name }.
- unique().
- sort { a, b -> a <=> b },
- "graphStepMethods": GraphTraversal.getMethods().
- findAll { GraphTraversal.class.equals(it.returnType) }.
- findAll { !it.name.equals("clone") && !it.name.equals("iterate") }.
- collect { it.name }.
- unique().
- sort { a, b -> a <=> b },
- "anonStepMethods": __.class.getMethods().
- findAll { GraphTraversal.class.equals(it.returnType) }.
- findAll { Modifier.isStatic(it.getModifiers()) }.
- findAll { !it.name.equals("__") && !it.name.equals("start") }.
- collect { it.name }.
- unique().
- sort { a, b -> a <=> b },
- "toJs": toJs,
- "version": determineVersion(),
- "decapitalize": decapitalize]
-
-def engine = new groovy.text.GStringTemplateEngine()
-def graphTraversalTemplate = engine.createTemplate(new File('${project.basedir}/glv/GraphTraversalSource.template')).make(binding)
-def graphTraversalFile = new File('${project.basedir}/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js')
-graphTraversalFile.newWriter().withWriter{ it << graphTraversalTemplate }
-
-def traversalTemplate = engine.createTemplate(new File('${project.basedir}/glv/TraversalSource.template')).make(binding)
-def traversalFile = new File('${project.basedir}/src/main/javascript/gremlin-javascript/lib/process/traversal.js')
-traversalFile.newWriter().withWriter{ it << traversalTemplate }
-
-def packageJsonTemplate = engine.createTemplate(new File('${project.basedir}/glv/PackageJson.template')).make(binding)
-def packageJsonFile = new File('${project.basedir}/src/main/javascript/gremlin-javascript/package.json')
-packageJsonFile.newWriter().withWriter{ it << packageJsonTemplate }
-]]> </script>
+ <script>${project.basedir}/glv/generate.groovy</script>
</scripts>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2afd9716/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index aae9eb9..604354c 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -1,6 +1,6 @@
{
"name": "gremlin-javascript",
- "version": "3.2.7-alpha1",
+ "version": "3.2.8-alpha1",
"description": "JavaScript Gremlin Language Variant",
"author": "Apache TinkerPop team",
"keywords": [
[05/50] [abbrv] tinkerpop git commit: Parse Edge and VertexProperty
properties
Posted by fl...@apache.org.
Parse Edge and VertexProperty properties
To follow the decision around TINKERPOP-1474 for the GLV to parse properties.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/598b9911
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/598b9911
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/598b9911
Branch: refs/heads/TINKERPOP-1854
Commit: 598b991154d8e05354a526967b7dab2067a24ebe
Parents: 84a11a1
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Wed Nov 16 13:41:46 2016 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:14 2018 +0100
----------------------------------------------------------------------
.../javascript/gremlin-javascript/structure/graph.js | 15 +++++++++++++--
.../structure/io/graph-serializer.js | 13 +++++++++++--
2 files changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/598b9911/gremlin-javascript/src/main/javascript/gremlin-javascript/structure/graph.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/structure/graph.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/structure/graph.js
index 7c48819..cd408ae 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/structure/graph.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/structure/graph.js
@@ -68,10 +68,20 @@
inherits(Vertex, Element);
- function Edge(id, outV, label, inV) {
+ function Edge(id, outV, label, inV, properties) {
Element.call(this, id, label);
this.outV = outV;
this.inV = inV;
+ this.properties = {};
+ (function adaptProperties(self) {
+ if (properties) {
+ var keys = Object.keys(properties);
+ for (var i = 0; i < keys.length; i++) {
+ var k = keys[i];
+ self.properties[k] = properties[k].value;
+ }
+ }
+ })(this);
}
inherits(Edge, Element);
@@ -80,10 +90,11 @@
return 'e[' + this.id + '][' + this.outV.id + '-' + this.label + '->' + this.inV.id + ']';
};
- function VertexProperty(id, label, value) {
+ function VertexProperty(id, label, value, properties) {
Element.call(this, id, label);
this.value = value;
this.key = this.label;
+ this.properties = properties;
}
inherits(VertexProperty, Element);
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/598b9911/gremlin-javascript/src/main/javascript/gremlin-javascript/structure/io/graph-serializer.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/structure/io/graph-serializer.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/structure/io/graph-serializer.js
index 2dde340..31652da 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/structure/io/graph-serializer.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/structure/io/graph-serializer.js
@@ -155,6 +155,9 @@
}
GraphSONReader.prototype.read = function (obj) {
+ if (obj === undefined) {
+ return undefined;
+ }
if (Array.isArray(obj)) {
return obj.map(function mapEach(item) {
return this.read(item);
@@ -340,7 +343,12 @@
VertexPropertySerializer.prototype.deserialize = function (obj) {
var value = obj[valueKey];
- return new g.VertexProperty(this.reader.read(value['id']), value['label'], this.reader.read(value['value']));
+ return new g.VertexProperty(
+ this.reader.read(value['id']),
+ value['label'],
+ this.reader.read(value['value']),
+ this.reader.read(value['properties'])
+ );
};
function PropertySerializer() {
@@ -364,7 +372,8 @@
this.reader.read(value['id']),
this.reader.read(value['outV']),
value['label'],
- this.reader.read(value['inV'])
+ this.reader.read(value['inV']),
+ this.reader.read(value['properties'])
);
};
[45/50] [abbrv] tinkerpop git commit: Merge branch 'TINKERPOP-1874'
into tp32
Posted by fl...@apache.org.
Merge branch 'TINKERPOP-1874' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/08391f8d
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/08391f8d
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/08391f8d
Branch: refs/heads/TINKERPOP-1854
Commit: 08391f8d8a1a19218f6ed6dd37f584b7460b2c56
Parents: 3e6e08a 1c33340
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jan 24 08:09:28 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jan 24 08:09:28 2018 -0500
----------------------------------------------------------------------
docs/src/dev/io/graphson.asciidoc | 192 ++++++++++---------
...aphSONMapperV2d0PartialEmbeddedTypeTest.java | 29 +++
gremlin-dotnet/glv/P.template | 7 +-
.../src/Gremlin.Net/Process/Traversal/P.cs | 6 +-
.../traversal/step/filter/GroovyHasTest.groovy | 20 ++
gremlin-test/features/filter/Has.feature | 44 +++++
.../process/traversal/step/filter/HasTest.java | 60 ++++++
7 files changed, 262 insertions(+), 96 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/08391f8d/docs/src/dev/io/graphson.asciidoc
----------------------------------------------------------------------
diff --cc docs/src/dev/io/graphson.asciidoc
index b769f61,37af4ed..4b1d219
--- a/docs/src/dev/io/graphson.asciidoc
+++ b/docs/src/dev/io/graphson.asciidoc
@@@ -75,11 -72,10 +72,10 @@@ file.withWriter { writer -
writer.write(toJson(msg, "Sessionless Eval", "The following `RequestMessage` is an example of a sessionless request for a script evaluation with an alias that binds the `TraversalSource` of \"g\" to \"social\"."))
writer.write("\n")
- writer.write("ResponseMessage\n")
- writer.write("~~~~~~~~~~~~~~~\n\n")
+ writer.write("=== ResponseMessage\n\n")
msg = ResponseMessage.build(UUID.fromString("41d2e28a-20a4-4ab0-b379-d810dede3786")).
code(org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.AUTHENTICATE).create()
- writer.write(toJson(msg, "Authentication Challenge", "When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but no in the default provided by Gremlin Server)."))
+ writer.write(toJson(msg, "Authentication Challenge", "When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but not in the default provided by Gremlin Server)."))
msg = ResponseMessage.build(UUID.fromString("41d2e28a-20a4-4ab0-b379-d810dede3786")).
code(org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.SUCCESS).
result(Arrays.asList(graph.vertices().next())).create()
[28/50] [abbrv] tinkerpop git commit: Use ES6 syntax
Posted by fl...@apache.org.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/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 f6a0de1..6dcd8f6 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
@@ -22,1141 +22,1144 @@
*/
'use strict';
-var t = require('./traversal.js');
-var remote = require('../driver/remote-connection');
-var utils = require('../utils');
-var Bytecode = require('./bytecode');
-var TraversalStrategies = require('./traversal-strategy').TraversalStrategies;
-var inherits = utils.inherits;
-var parseArgs = utils.parseArgs;
-
-/**
- *
- * @param {Graph} graph
- * @param {TraversalStrategies} traversalStrategies
- * @param {Bytecode} [bytecode]
- * @constructor
- */
-function GraphTraversalSource(graph, traversalStrategies, bytecode) {
- this.graph = graph;
- this.traversalStrategies = traversalStrategies;
- this.bytecode = bytecode || new Bytecode();
+const Traversal = require('./traversal').Traversal;
+const remote = require('../driver/remote-connection');
+const utils = require('../utils');
+const Bytecode = require('./bytecode');
+const TraversalStrategies = require('./traversal-strategy').TraversalStrategies;
+const parseArgs = utils.parseArgs;
+
+
+/**
+ * Represents the primary DSL of the Gremlin traversal machine.
+ */
+class GraphTraversalSource {
+ /**
+ * @param {Graph} graph
+ * @param {TraversalStrategies} traversalStrategies
+ * @param {Bytecode} [bytecode]
+ */
+ constructor(graph, traversalStrategies, bytecode) {
+ this.graph = graph;
+ this.traversalStrategies = traversalStrategies;
+ this.bytecode = bytecode || new Bytecode();
+ }
+
+ /**
+ * @param remoteConnection
+ * @returns {GraphTraversalSource}
+ */
+ withRemote(remoteConnection) {
+ const traversalStrategy = new TraversalStrategies(this.traversalStrategies);
+ traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
+ return new GraphTraversalSource(this.graph, traversalStrategy, new Bytecode(this.bytecode));
+ }
+
+ /**
+ * Returns the string representation of the GraphTraversalSource.
+ * @returns {string}
+ */
+ toString() {
+ return 'graphtraversalsource[' + this.graph.toString() + ']';
+ }
+
+ /**
+ * Graph Traversal Source withBulk method.
+ * @param {...Object} args
+ * @returns {GraphTraversalSource}
+ */
+ withBulk(args) {
+ const b = new Bytecode(this.bytecode).addSource('withBulk', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+
+ /**
+ * Graph Traversal Source withPath method.
+ * @param {...Object} args
+ * @returns {GraphTraversalSource}
+ */
+ withPath(args) {
+ const b = new Bytecode(this.bytecode).addSource('withPath', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+
+ /**
+ * Graph Traversal Source withSack method.
+ * @param {...Object} args
+ * @returns {GraphTraversalSource}
+ */
+ withSack(args) {
+ const b = new Bytecode(this.bytecode).addSource('withSack', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+
+ /**
+ * Graph Traversal Source withSideEffect method.
+ * @param {...Object} args
+ * @returns {GraphTraversalSource}
+ */
+ withSideEffect(args) {
+ const b = new Bytecode(this.bytecode).addSource('withSideEffect', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+
+ /**
+ * Graph Traversal Source withStrategies method.
+ * @param {...Object} args
+ * @returns {GraphTraversalSource}
+ */
+ withStrategies(args) {
+ const b = new Bytecode(this.bytecode).addSource('withStrategies', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+
+ /**
+ * Graph Traversal Source withoutStrategies method.
+ * @param {...Object} args
+ * @returns {GraphTraversalSource}
+ */
+ withoutStrategies(args) {
+ const b = new Bytecode(this.bytecode).addSource('withoutStrategies', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+
+ /**
+ * E GraphTraversalSource step method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ E(args) {
+ const b = new Bytecode(this.bytecode).addStep('E', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+
+ /**
+ * V GraphTraversalSource step method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ V(args) {
+ const b = new Bytecode(this.bytecode).addStep('V', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+
+ /**
+ * addV GraphTraversalSource step method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ addV(args) {
+ const b = new Bytecode(this.bytecode).addStep('addV', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+
+ /**
+ * inject GraphTraversalSource step method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ inject(args) {
+ const b = new Bytecode(this.bytecode).addStep('inject', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+
}
/**
- * @param remoteConnection
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.withRemote = function (remoteConnection) {
- var traversalStrategy = new TraversalStrategies(this.traversalStrategies);
- traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
- return new GraphTraversalSource(this.graph, traversalStrategy, new Bytecode(this.bytecode));
-};
-
-/**
- * Returns the string representation of the GraphTraversalSource.
- * @returns {string}
- */
-GraphTraversalSource.prototype.toString = function () {
- return 'graphtraversalsource[' + this.graph.toString() + ']';
-};
-
-/**
- * Graph Traversal Source withBulk method.
- * @param {...Object} args
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.withBulk = function (args) {
- var b = new Bytecode(this.bytecode).addSource('withBulk', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
- * Graph Traversal Source withPath method.
- * @param {...Object} args
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.withPath = function (args) {
- var b = new Bytecode(this.bytecode).addSource('withPath', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
- * Graph Traversal Source withSack method.
- * @param {...Object} args
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.withSack = function (args) {
- var b = new Bytecode(this.bytecode).addSource('withSack', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
- * Graph Traversal Source withSideEffect method.
- * @param {...Object} args
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.withSideEffect = function (args) {
- var b = new Bytecode(this.bytecode).addSource('withSideEffect', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
- * Graph Traversal Source withStrategies method.
- * @param {...Object} args
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.withStrategies = function (args) {
- var b = new Bytecode(this.bytecode).addSource('withStrategies', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
- * Graph Traversal Source withoutStrategies method.
- * @param {...Object} args
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.withoutStrategies = function (args) {
- var b = new Bytecode(this.bytecode).addSource('withoutStrategies', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
- * E GraphTraversalSource step method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversalSource.prototype.E = function (args) {
- var b = new Bytecode(this.bytecode).addStep('E', parseArgs.apply(null, arguments));
- return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
- * V GraphTraversalSource step method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversalSource.prototype.V = function (args) {
- var b = new Bytecode(this.bytecode).addStep('V', parseArgs.apply(null, arguments));
- return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
- * addV GraphTraversalSource step method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversalSource.prototype.addV = function (args) {
- var b = new Bytecode(this.bytecode).addStep('addV', parseArgs.apply(null, arguments));
- return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
- * inject GraphTraversalSource step method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversalSource.prototype.inject = function (args) {
- var b = new Bytecode(this.bytecode).addStep('inject', parseArgs.apply(null, arguments));
- return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-
-/**
* Represents a graph traversal.
- * @extends Traversal
- * @constructor
*/
-function GraphTraversal(graph, traversalStrategies, bytecode) {
- t.Traversal.call(this, graph, traversalStrategies, bytecode);
+class GraphTraversal extends Traversal {
+ constructor(graph, traversalStrategies, bytecode) {
+ super(graph, traversalStrategies, bytecode);
+ }
+
+ /**
+ * Graph traversal V method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ V(args) {
+ this.bytecode.addStep('V', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal addE method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ addE(args) {
+ this.bytecode.addStep('addE', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal addInE method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ addInE(args) {
+ this.bytecode.addStep('addInE', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal addOutE method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ addOutE(args) {
+ this.bytecode.addStep('addOutE', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal addV method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ addV(args) {
+ this.bytecode.addStep('addV', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal aggregate method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ aggregate(args) {
+ this.bytecode.addStep('aggregate', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal and method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ and(args) {
+ this.bytecode.addStep('and', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal as method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ as(args) {
+ this.bytecode.addStep('as', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal barrier method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ barrier(args) {
+ this.bytecode.addStep('barrier', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal both method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ both(args) {
+ this.bytecode.addStep('both', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal bothE method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ bothE(args) {
+ this.bytecode.addStep('bothE', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal bothV method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ bothV(args) {
+ this.bytecode.addStep('bothV', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal branch method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ branch(args) {
+ this.bytecode.addStep('branch', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal by method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ by(args) {
+ this.bytecode.addStep('by', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal cap method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ cap(args) {
+ this.bytecode.addStep('cap', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal choose method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ choose(args) {
+ this.bytecode.addStep('choose', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal coalesce method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ coalesce(args) {
+ this.bytecode.addStep('coalesce', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal coin method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ coin(args) {
+ this.bytecode.addStep('coin', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal constant method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ constant(args) {
+ this.bytecode.addStep('constant', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal count method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ count(args) {
+ this.bytecode.addStep('count', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal cyclicPath method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ cyclicPath(args) {
+ this.bytecode.addStep('cyclicPath', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal dedup method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ dedup(args) {
+ this.bytecode.addStep('dedup', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal drop method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ drop(args) {
+ this.bytecode.addStep('drop', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal emit method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ emit(args) {
+ this.bytecode.addStep('emit', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal filter method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ filter(args) {
+ this.bytecode.addStep('filter', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal flatMap method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ flatMap(args) {
+ this.bytecode.addStep('flatMap', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal fold method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ fold(args) {
+ this.bytecode.addStep('fold', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal from method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ from_(args) {
+ this.bytecode.addStep('from', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal group method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ group(args) {
+ this.bytecode.addStep('group', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal groupCount method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ groupCount(args) {
+ this.bytecode.addStep('groupCount', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal groupV3d0 method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ groupV3d0(args) {
+ this.bytecode.addStep('groupV3d0', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal has method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ has(args) {
+ this.bytecode.addStep('has', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal hasId method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ hasId(args) {
+ this.bytecode.addStep('hasId', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal hasKey method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ hasKey(args) {
+ this.bytecode.addStep('hasKey', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal hasLabel method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ hasLabel(args) {
+ this.bytecode.addStep('hasLabel', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal hasNot method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ hasNot(args) {
+ this.bytecode.addStep('hasNot', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal hasValue method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ hasValue(args) {
+ this.bytecode.addStep('hasValue', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal id method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ id(args) {
+ this.bytecode.addStep('id', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal identity method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ identity(args) {
+ this.bytecode.addStep('identity', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal in method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ in_(args) {
+ this.bytecode.addStep('in', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal inE method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ inE(args) {
+ this.bytecode.addStep('inE', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal inV method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ inV(args) {
+ this.bytecode.addStep('inV', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal inject method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ inject(args) {
+ this.bytecode.addStep('inject', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal is method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ is(args) {
+ this.bytecode.addStep('is', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal key method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ key(args) {
+ this.bytecode.addStep('key', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal label method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ label(args) {
+ this.bytecode.addStep('label', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal limit method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ limit(args) {
+ this.bytecode.addStep('limit', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal local method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ local(args) {
+ this.bytecode.addStep('local', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal loops method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ loops(args) {
+ this.bytecode.addStep('loops', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal map method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ map(args) {
+ this.bytecode.addStep('map', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal mapKeys method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ mapKeys(args) {
+ this.bytecode.addStep('mapKeys', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal mapValues method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ mapValues(args) {
+ this.bytecode.addStep('mapValues', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal match method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ match(args) {
+ this.bytecode.addStep('match', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal max method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ max(args) {
+ this.bytecode.addStep('max', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal mean method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ mean(args) {
+ this.bytecode.addStep('mean', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal min method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ min(args) {
+ this.bytecode.addStep('min', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal not method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ not(args) {
+ this.bytecode.addStep('not', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal option method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ option(args) {
+ this.bytecode.addStep('option', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal optional method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ optional(args) {
+ this.bytecode.addStep('optional', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal or method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ or(args) {
+ this.bytecode.addStep('or', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal order method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ order(args) {
+ this.bytecode.addStep('order', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal otherV method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ otherV(args) {
+ this.bytecode.addStep('otherV', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal out method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ out(args) {
+ this.bytecode.addStep('out', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal outE method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ outE(args) {
+ this.bytecode.addStep('outE', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal outV method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ outV(args) {
+ this.bytecode.addStep('outV', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal pageRank method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ pageRank(args) {
+ this.bytecode.addStep('pageRank', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal path method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ path(args) {
+ this.bytecode.addStep('path', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal peerPressure method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ peerPressure(args) {
+ this.bytecode.addStep('peerPressure', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal profile method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ profile(args) {
+ this.bytecode.addStep('profile', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal program method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ program(args) {
+ this.bytecode.addStep('program', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal project method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ project(args) {
+ this.bytecode.addStep('project', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal properties method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ properties(args) {
+ this.bytecode.addStep('properties', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal property method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ property(args) {
+ this.bytecode.addStep('property', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal propertyMap method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ propertyMap(args) {
+ this.bytecode.addStep('propertyMap', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal range method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ range(args) {
+ this.bytecode.addStep('range', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal repeat method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ repeat(args) {
+ this.bytecode.addStep('repeat', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal sack method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ sack(args) {
+ this.bytecode.addStep('sack', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal sample method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ sample(args) {
+ this.bytecode.addStep('sample', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal select method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ select(args) {
+ this.bytecode.addStep('select', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal sideEffect method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ sideEffect(args) {
+ this.bytecode.addStep('sideEffect', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal simplePath method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ simplePath(args) {
+ this.bytecode.addStep('simplePath', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal store method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ store(args) {
+ this.bytecode.addStep('store', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal subgraph method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ subgraph(args) {
+ this.bytecode.addStep('subgraph', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal sum method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ sum(args) {
+ this.bytecode.addStep('sum', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal tail method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ tail(args) {
+ this.bytecode.addStep('tail', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal timeLimit method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ timeLimit(args) {
+ this.bytecode.addStep('timeLimit', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal times method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ times(args) {
+ this.bytecode.addStep('times', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal to method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ to(args) {
+ this.bytecode.addStep('to', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal toE method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ toE(args) {
+ this.bytecode.addStep('toE', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal toV method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ toV(args) {
+ this.bytecode.addStep('toV', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal tree method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ tree(args) {
+ this.bytecode.addStep('tree', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal unfold method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ unfold(args) {
+ this.bytecode.addStep('unfold', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal union method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ union(args) {
+ this.bytecode.addStep('union', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal until method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ until(args) {
+ this.bytecode.addStep('until', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal value method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ value(args) {
+ this.bytecode.addStep('value', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal valueMap method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ valueMap(args) {
+ this.bytecode.addStep('valueMap', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal values method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ values(args) {
+ this.bytecode.addStep('values', parseArgs.apply(null, arguments));
+ return this;
+ }
+
+ /**
+ * Graph traversal where method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ where(args) {
+ this.bytecode.addStep('where', parseArgs.apply(null, arguments));
+ return this;
+ }
+
}
-inherits(GraphTraversal, t.Traversal);
-
-/**
- * Graph traversal V method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.V = function (args) {
- this.bytecode.addStep('V', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal addE method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.addE = function (args) {
- this.bytecode.addStep('addE', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal addInE method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.addInE = function (args) {
- this.bytecode.addStep('addInE', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal addOutE method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.addOutE = function (args) {
- this.bytecode.addStep('addOutE', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal addV method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.addV = function (args) {
- this.bytecode.addStep('addV', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal aggregate method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.aggregate = function (args) {
- this.bytecode.addStep('aggregate', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal and method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.and = function (args) {
- this.bytecode.addStep('and', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal as method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.as = function (args) {
- this.bytecode.addStep('as', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal barrier method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.barrier = function (args) {
- this.bytecode.addStep('barrier', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal both method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.both = function (args) {
- this.bytecode.addStep('both', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal bothE method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.bothE = function (args) {
- this.bytecode.addStep('bothE', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal bothV method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.bothV = function (args) {
- this.bytecode.addStep('bothV', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal branch method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.branch = function (args) {
- this.bytecode.addStep('branch', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal by method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.by = function (args) {
- this.bytecode.addStep('by', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal cap method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.cap = function (args) {
- this.bytecode.addStep('cap', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal choose method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.choose = function (args) {
- this.bytecode.addStep('choose', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal coalesce method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.coalesce = function (args) {
- this.bytecode.addStep('coalesce', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal coin method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.coin = function (args) {
- this.bytecode.addStep('coin', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal constant method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.constant = function (args) {
- this.bytecode.addStep('constant', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal count method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.count = function (args) {
- this.bytecode.addStep('count', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal cyclicPath method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.cyclicPath = function (args) {
- this.bytecode.addStep('cyclicPath', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal dedup method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.dedup = function (args) {
- this.bytecode.addStep('dedup', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal drop method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.drop = function (args) {
- this.bytecode.addStep('drop', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal emit method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.emit = function (args) {
- this.bytecode.addStep('emit', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal filter method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.filter = function (args) {
- this.bytecode.addStep('filter', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal flatMap method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.flatMap = function (args) {
- this.bytecode.addStep('flatMap', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal fold method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.fold = function (args) {
- this.bytecode.addStep('fold', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal from method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.from_ = function (args) {
- this.bytecode.addStep('from', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal group method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.group = function (args) {
- this.bytecode.addStep('group', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal groupCount method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.groupCount = function (args) {
- this.bytecode.addStep('groupCount', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal groupV3d0 method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.groupV3d0 = function (args) {
- this.bytecode.addStep('groupV3d0', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal has method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.has = function (args) {
- this.bytecode.addStep('has', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal hasId method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.hasId = function (args) {
- this.bytecode.addStep('hasId', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal hasKey method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.hasKey = function (args) {
- this.bytecode.addStep('hasKey', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal hasLabel method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.hasLabel = function (args) {
- this.bytecode.addStep('hasLabel', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal hasNot method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.hasNot = function (args) {
- this.bytecode.addStep('hasNot', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal hasValue method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.hasValue = function (args) {
- this.bytecode.addStep('hasValue', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal id method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.id = function (args) {
- this.bytecode.addStep('id', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal identity method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.identity = function (args) {
- this.bytecode.addStep('identity', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal in method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.in_ = function (args) {
- this.bytecode.addStep('in', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal inE method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.inE = function (args) {
- this.bytecode.addStep('inE', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal inV method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.inV = function (args) {
- this.bytecode.addStep('inV', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal inject method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.inject = function (args) {
- this.bytecode.addStep('inject', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal is method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.is = function (args) {
- this.bytecode.addStep('is', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal key method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.key = function (args) {
- this.bytecode.addStep('key', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal label method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.label = function (args) {
- this.bytecode.addStep('label', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal limit method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.limit = function (args) {
- this.bytecode.addStep('limit', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal local method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.local = function (args) {
- this.bytecode.addStep('local', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal loops method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.loops = function (args) {
- this.bytecode.addStep('loops', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal map method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.map = function (args) {
- this.bytecode.addStep('map', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal mapKeys method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.mapKeys = function (args) {
- this.bytecode.addStep('mapKeys', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal mapValues method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.mapValues = function (args) {
- this.bytecode.addStep('mapValues', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal match method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.match = function (args) {
- this.bytecode.addStep('match', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal max method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.max = function (args) {
- this.bytecode.addStep('max', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal mean method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.mean = function (args) {
- this.bytecode.addStep('mean', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal min method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.min = function (args) {
- this.bytecode.addStep('min', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal not method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.not = function (args) {
- this.bytecode.addStep('not', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal option method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.option = function (args) {
- this.bytecode.addStep('option', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal optional method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.optional = function (args) {
- this.bytecode.addStep('optional', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal or method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.or = function (args) {
- this.bytecode.addStep('or', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal order method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.order = function (args) {
- this.bytecode.addStep('order', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal otherV method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.otherV = function (args) {
- this.bytecode.addStep('otherV', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal out method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.out = function (args) {
- this.bytecode.addStep('out', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal outE method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.outE = function (args) {
- this.bytecode.addStep('outE', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal outV method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.outV = function (args) {
- this.bytecode.addStep('outV', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal pageRank method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.pageRank = function (args) {
- this.bytecode.addStep('pageRank', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal path method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.path = function (args) {
- this.bytecode.addStep('path', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal peerPressure method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.peerPressure = function (args) {
- this.bytecode.addStep('peerPressure', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal profile method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.profile = function (args) {
- this.bytecode.addStep('profile', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal program method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.program = function (args) {
- this.bytecode.addStep('program', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal project method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.project = function (args) {
- this.bytecode.addStep('project', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal properties method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.properties = function (args) {
- this.bytecode.addStep('properties', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal property method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.property = function (args) {
- this.bytecode.addStep('property', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal propertyMap method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.propertyMap = function (args) {
- this.bytecode.addStep('propertyMap', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal range method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.range = function (args) {
- this.bytecode.addStep('range', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal repeat method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.repeat = function (args) {
- this.bytecode.addStep('repeat', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal sack method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.sack = function (args) {
- this.bytecode.addStep('sack', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal sample method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.sample = function (args) {
- this.bytecode.addStep('sample', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal select method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.select = function (args) {
- this.bytecode.addStep('select', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal sideEffect method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.sideEffect = function (args) {
- this.bytecode.addStep('sideEffect', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal simplePath method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.simplePath = function (args) {
- this.bytecode.addStep('simplePath', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal store method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.store = function (args) {
- this.bytecode.addStep('store', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal subgraph method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.subgraph = function (args) {
- this.bytecode.addStep('subgraph', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal sum method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.sum = function (args) {
- this.bytecode.addStep('sum', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal tail method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.tail = function (args) {
- this.bytecode.addStep('tail', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal timeLimit method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.timeLimit = function (args) {
- this.bytecode.addStep('timeLimit', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal times method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.times = function (args) {
- this.bytecode.addStep('times', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal to method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.to = function (args) {
- this.bytecode.addStep('to', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal toE method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.toE = function (args) {
- this.bytecode.addStep('toE', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal toV method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.toV = function (args) {
- this.bytecode.addStep('toV', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal tree method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.tree = function (args) {
- this.bytecode.addStep('tree', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal unfold method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.unfold = function (args) {
- this.bytecode.addStep('unfold', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal union method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.union = function (args) {
- this.bytecode.addStep('union', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal until method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.until = function (args) {
- this.bytecode.addStep('until', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal value method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.value = function (args) {
- this.bytecode.addStep('value', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal valueMap method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.valueMap = function (args) {
- this.bytecode.addStep('valueMap', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal values method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.values = function (args) {
- this.bytecode.addStep('values', parseArgs.apply(null, arguments));
- return this;
-};
-
-/**
- * Graph traversal where method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.where = function (args) {
- this.bytecode.addStep('where', parseArgs.apply(null, arguments));
- return this;
-};
-
/**
* Contains the static method definitions
* @type {Object}
*/
-var statics = {};
+const statics = {};
/**
* V() static method
@@ -1164,7 +1167,7 @@ var statics = {};
* @returns {GraphTraversal}
*/
statics.V = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.V.apply(g, arguments);
};
@@ -1174,7 +1177,7 @@ statics.V = function (args) {
* @returns {GraphTraversal}
*/
statics.addE = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.addE.apply(g, arguments);
};
@@ -1184,7 +1187,7 @@ statics.addE = function (args) {
* @returns {GraphTraversal}
*/
statics.addInE = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.addInE.apply(g, arguments);
};
@@ -1194,7 +1197,7 @@ statics.addInE = function (args) {
* @returns {GraphTraversal}
*/
statics.addOutE = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.addOutE.apply(g, arguments);
};
@@ -1204,7 +1207,7 @@ statics.addOutE = function (args) {
* @returns {GraphTraversal}
*/
statics.addV = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.addV.apply(g, arguments);
};
@@ -1214,7 +1217,7 @@ statics.addV = function (args) {
* @returns {GraphTraversal}
*/
statics.aggregate = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.aggregate.apply(g, arguments);
};
@@ -1224,7 +1227,7 @@ statics.aggregate = function (args) {
* @returns {GraphTraversal}
*/
statics.and = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.and.apply(g, arguments);
};
@@ -1234,7 +1237,7 @@ statics.and = function (args) {
* @returns {GraphTraversal}
*/
statics.as = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.as.apply(g, arguments);
};
@@ -1244,7 +1247,7 @@ statics.as = function (args) {
* @returns {GraphTraversal}
*/
statics.barrier = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.barrier.apply(g, arguments);
};
@@ -1254,7 +1257,7 @@ statics.barrier = function (args) {
* @returns {GraphTraversal}
*/
statics.both = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.both.apply(g, arguments);
};
@@ -1264,7 +1267,7 @@ statics.both = function (args) {
* @returns {GraphTraversal}
*/
statics.bothE = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.bothE.apply(g, arguments);
};
@@ -1274,7 +1277,7 @@ statics.bothE = function (args) {
* @returns {GraphTraversal}
*/
statics.bothV = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.bothV.apply(g, arguments);
};
@@ -1284,7 +1287,7 @@ statics.bothV = function (args) {
* @returns {GraphTraversal}
*/
statics.branch = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.branch.apply(g, arguments);
};
@@ -1294,7 +1297,7 @@ statics.branch = function (args) {
* @returns {GraphTraversal}
*/
statics.cap = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.cap.apply(g, arguments);
};
@@ -1304,7 +1307,7 @@ statics.cap = function (args) {
* @returns {GraphTraversal}
*/
statics.choose = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.choose.apply(g, arguments);
};
@@ -1314,7 +1317,7 @@ statics.choose = function (args) {
* @returns {GraphTraversal}
*/
statics.coalesce = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.coalesce.apply(g, arguments);
};
@@ -1324,7 +1327,7 @@ statics.coalesce = function (args) {
* @returns {GraphTraversal}
*/
statics.coin = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.coin.apply(g, arguments);
};
@@ -1334,7 +1337,7 @@ statics.coin = function (args) {
* @returns {GraphTraversal}
*/
statics.constant = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.constant.apply(g, arguments);
};
@@ -1344,7 +1347,7 @@ statics.constant = function (args) {
* @returns {GraphTraversal}
*/
statics.count = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.count.apply(g, arguments);
};
@@ -1354,7 +1357,7 @@ statics.count = function (args) {
* @returns {GraphTraversal}
*/
statics.cyclicPath = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.cyclicPath.apply(g, arguments);
};
@@ -1364,7 +1367,7 @@ statics.cyclicPath = function (args) {
* @returns {GraphTraversal}
*/
statics.dedup = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.dedup.apply(g, arguments);
};
@@ -1374,7 +1377,7 @@ statics.dedup = function (args) {
* @returns {GraphTraversal}
*/
statics.drop = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.drop.apply(g, arguments);
};
@@ -1384,7 +1387,7 @@ statics.drop = function (args) {
* @returns {GraphTraversal}
*/
statics.emit = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.emit.apply(g, arguments);
};
@@ -1394,7 +1397,7 @@ statics.emit = function (args) {
* @returns {GraphTraversal}
*/
statics.filter = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.filter.apply(g, arguments);
};
@@ -1404,7 +1407,7 @@ statics.filter = function (args) {
* @returns {GraphTraversal}
*/
statics.flatMap = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.flatMap.apply(g, arguments);
};
@@ -1414,7 +1417,7 @@ statics.flatMap = function (args) {
* @returns {GraphTraversal}
*/
statics.fold = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.fold.apply(g, arguments);
};
@@ -1424,7 +1427,7 @@ statics.fold = function (args) {
* @returns {GraphTraversal}
*/
statics.group = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.group.apply(g, arguments);
};
@@ -1434,7 +1437,7 @@ statics.group = function (args) {
* @returns {GraphTraversal}
*/
statics.groupCount = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.groupCount.apply(g, arguments);
};
@@ -1444,7 +1447,7 @@ statics.groupCount = function (args) {
* @returns {GraphTraversal}
*/
statics.groupV3d0 = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.groupV3d0.apply(g, arguments);
};
@@ -1454,7 +1457,7 @@ statics.groupV3d0 = function (args) {
* @returns {GraphTraversal}
*/
statics.has = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.has.apply(g, arguments);
};
@@ -1464,7 +1467,7 @@ statics.has = function (args) {
* @returns {GraphTraversal}
*/
statics.hasId = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.hasId.apply(g, arguments);
};
@@ -1474,7 +1477,7 @@ statics.hasId = function (args) {
* @returns {GraphTraversal}
*/
statics.hasKey = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.hasKey.apply(g, arguments);
};
@@ -1484,7 +1487,7 @@ statics.hasKey = function (args) {
* @returns {GraphTraversal}
*/
statics.hasLabel = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.hasLabel.apply(g, arguments);
};
@@ -1494,7 +1497,7 @@ statics.hasLabel = function (args) {
* @returns {GraphTraversal}
*/
statics.hasNot = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.hasNot.apply(g, arguments);
};
@@ -1504,7 +1507,7 @@ statics.hasNot = function (args) {
* @returns {GraphTraversal}
*/
statics.hasValue = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.hasValue.apply(g, arguments);
};
@@ -1514,7 +1517,7 @@ statics.hasValue = function (args) {
* @returns {GraphTraversal}
*/
statics.id = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.id.apply(g, arguments);
};
@@ -1524,7 +1527,7 @@ statics.id = function (args) {
* @returns {GraphTraversal}
*/
statics.identity = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.identity.apply(g, arguments);
};
@@ -1534,7 +1537,7 @@ statics.identity = function (args) {
* @returns {GraphTraversal}
*/
statics.in_ = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.in_.apply(g, arguments);
};
@@ -1544,7 +1547,7 @@ statics.in_ = function (args) {
* @returns {GraphTraversal}
*/
statics.inE = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.inE.apply(g, arguments);
};
@@ -1554,7 +1557,7 @@ statics.inE = function (args) {
* @returns {GraphTraversal}
*/
statics.inV = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.inV.apply(g, arguments);
};
@@ -1564,7 +1567,7 @@ statics.inV = function (args) {
* @returns {GraphTraversal}
*/
statics.inject = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.inject.apply(g, arguments);
};
@@ -1574,7 +1577,7 @@ statics.inject = function (args) {
* @returns {GraphTraversal}
*/
statics.is = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.is.apply(g, arguments);
};
@@ -1584,7 +1587,7 @@ statics.is = function (args) {
* @returns {GraphTraversal}
*/
statics.key = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.key.apply(g, arguments);
};
@@ -1594,7 +1597,7 @@ statics.key = function (args) {
* @returns {GraphTraversal}
*/
statics.label = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.label.apply(g, arguments);
};
@@ -1604,7 +1607,7 @@ statics.label = function (args) {
* @returns {GraphTraversal}
*/
statics.limit = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.limit.apply(g, arguments);
};
@@ -1614,7 +1617,7 @@ statics.limit = function (args) {
* @returns {GraphTraversal}
*/
statics.local = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.local.apply(g, arguments);
};
@@ -1624,7 +1627,7 @@ statics.local = function (args) {
* @returns {GraphTraversal}
*/
statics.loops = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.loops.apply(g, arguments);
};
@@ -1634,7 +1637,7 @@ statics.loops = function (args) {
* @returns {GraphTraversal}
*/
statics.map = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.map.apply(g, arguments);
};
@@ -1644,7 +1647,7 @@ statics.map = function (args) {
* @returns {GraphTraversal}
*/
statics.mapKeys = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.mapKeys.apply(g, arguments);
};
@@ -1654,7 +1657,7 @@ statics.mapKeys = function (args) {
* @returns {GraphTraversal}
*/
statics.mapValues = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.mapValues.apply(g, arguments);
};
@@ -1664,7 +1667,7 @@ statics.mapValues = function (args) {
* @returns {GraphTraversal}
*/
statics.match = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.match.apply(g, arguments);
};
@@ -1674,7 +1677,7 @@ statics.match = function (args) {
* @returns {GraphTraversal}
*/
statics.max = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.max.apply(g, arguments);
};
@@ -1684,7 +1687,7 @@ statics.max = function (args) {
* @returns {GraphTraversal}
*/
statics.mean = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.mean.apply(g, arguments);
};
@@ -1694,7 +1697,7 @@ statics.mean = function (args) {
* @returns {GraphTraversal}
*/
statics.min = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.min.apply(g, arguments);
};
@@ -1704,7 +1707,7 @@ statics.min = function (args) {
* @returns {GraphTraversal}
*/
statics.not = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.not.apply(g, arguments);
};
@@ -1714,7 +1717,7 @@ statics.not = function (args) {
* @returns {GraphTraversal}
*/
statics.optional = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.optional.apply(g, arguments);
};
@@ -1724,7 +1727,7 @@ statics.optional = function (args) {
* @returns {GraphTraversal}
*/
statics.or = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.or.apply(g, arguments);
};
@@ -1734,7 +1737,7 @@ statics.or = function (args) {
* @returns {GraphTraversal}
*/
statics.order = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.order.apply(g, arguments);
};
@@ -1744,7 +1747,7 @@ statics.order = function (args) {
* @returns {GraphTraversal}
*/
statics.otherV = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.otherV.apply(g, arguments);
};
@@ -1754,7 +1757,7 @@ statics.otherV = function (args) {
* @returns {GraphTraversal}
*/
statics.out = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.out.apply(g, arguments);
};
@@ -1764,7 +1767,7 @@ statics.out = function (args) {
* @returns {GraphTraversal}
*/
statics.outE = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.outE.apply(g, arguments);
};
@@ -1774,7 +1777,7 @@ statics.outE = function (args) {
* @returns {GraphTraversal}
*/
statics.outV = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.outV.apply(g, arguments);
};
@@ -1784,7 +1787,7 @@ statics.outV = function (args) {
* @returns {GraphTraversal}
*/
statics.path = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.path.apply(g, arguments);
};
@@ -1794,7 +1797,7 @@ statics.path = function (args) {
* @returns {GraphTraversal}
*/
statics.project = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.project.apply(g, arguments);
};
@@ -1804,7 +1807,7 @@ statics.project = function (args) {
* @returns {GraphTraversal}
*/
statics.properties = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.properties.apply(g, arguments);
};
@@ -1814,7 +1817,7 @@ statics.properties = function (args) {
* @returns {GraphTraversal}
*/
statics.property = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.property.apply(g, arguments);
};
@@ -1824,7 +1827,7 @@ statics.property = function (args) {
* @returns {GraphTraversal}
*/
statics.propertyMap = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.propertyMap.apply(g, arguments);
};
@@ -1834,7 +1837,7 @@ statics.propertyMap = function (args) {
* @returns {GraphTraversal}
*/
statics.range = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.range.apply(g, arguments);
};
@@ -1844,7 +1847,7 @@ statics.range = function (args) {
* @returns {GraphTraversal}
*/
statics.repeat = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.repeat.apply(g, arguments);
};
@@ -1854,7 +1857,7 @@ statics.repeat = function (args) {
* @returns {GraphTraversal}
*/
statics.sack = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.sack.apply(g, arguments);
};
@@ -1864,7 +1867,7 @@ statics.sack = function (args) {
* @returns {GraphTraversal}
*/
statics.sample = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.sample.apply(g, arguments);
};
@@ -1874,7 +1877,7 @@ statics.sample = function (args) {
* @returns {GraphTraversal}
*/
statics.select = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.select.apply(g, arguments);
};
@@ -1884,7 +1887,7 @@ statics.select = function (args) {
* @returns {GraphTraversal}
*/
statics.sideEffect = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.sideEffect.apply(g, arguments);
};
@@ -1894,7 +1897,7 @@ statics.sideEffect = function (args) {
* @returns {GraphTraversal}
*/
statics.simplePath = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.simplePath.apply(g, arguments);
};
@@ -1904,7 +1907,7 @@ statics.simplePath = function (args) {
* @returns {GraphTraversal}
*/
statics.store = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.store.apply(g, arguments);
};
@@ -1914,7 +1917,7 @@ statics.store = function (args) {
* @returns {GraphTraversal}
*/
statics.subgraph = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.subgraph.apply(g, arguments);
};
@@ -1924,7 +1927,7 @@ statics.subgraph = function (args) {
* @returns {GraphTraversal}
*/
statics.sum = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.sum.apply(g, arguments);
};
@@ -1934,7 +1937,7 @@ statics.sum = function (args) {
* @returns {GraphTraversal}
*/
statics.tail = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.tail.apply(g, arguments);
};
@@ -1944,7 +1947,7 @@ statics.tail = function (args) {
* @returns {GraphTraversal}
*/
statics.timeLimit = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.timeLimit.apply(g, arguments);
};
@@ -1954,7 +1957,7 @@ statics.timeLimit = function (args) {
* @returns {GraphTraversal}
*/
statics.times = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.times.apply(g, arguments);
};
@@ -1964,7 +1967,7 @@ statics.times = function (args) {
* @returns {GraphTraversal}
*/
statics.to = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.to.apply(g, arguments);
};
@@ -1974,7 +1977,7 @@ statics.to = function (args) {
* @returns {GraphTraversal}
*/
statics.toE = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.toE.apply(g, arguments);
};
@@ -1984,7 +1987,7 @@ statics.toE = function (args) {
* @returns {GraphTraversal}
*/
statics.toV = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.toV.apply(g, arguments);
};
@@ -1994,7 +1997,7 @@ statics.toV = function (args) {
* @returns {GraphTraversal}
*/
statics.tree = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.tree.apply(g, arguments);
};
@@ -2004,7 +2007,7 @@ statics.tree = function (args) {
* @returns {GraphTraversal}
*/
statics.unfold = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.unfold.apply(g, arguments);
};
@@ -2014,7 +2017,7 @@ statics.unfold = function (args) {
* @returns {GraphTraversal}
*/
statics.union = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.union.apply(g, arguments);
};
@@ -2024,7 +2027,7 @@ statics.union = function (args) {
* @returns {GraphTraversal}
*/
statics.until = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.until.apply(g, arguments);
};
@@ -2034,7 +2037,7 @@ statics.until = function (args) {
* @returns {GraphTraversal}
*/
statics.value = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.value.apply(g, arguments);
};
@@ -2044,7 +2047,7 @@ statics.value = function (args) {
* @returns {GraphTraversal}
*/
statics.valueMap = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.valueMap.apply(g, arguments);
};
@@ -2054,7 +2057,7 @@ statics.valueMap = function (args) {
* @returns {GraphTraversal}
*/
statics.values = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.values.apply(g, arguments);
};
@@ -2064,12 +2067,12 @@ statics.values = function (args) {
* @returns {GraphTraversal}
*/
statics.where = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.where.apply(g, arguments);
};
module.exports = {
- GraphTraversal: GraphTraversal,
- GraphTraversalSource: GraphTraversalSource,
- statics: statics
+ GraphTraversal,
+ GraphTraversalSource,
+ statics
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
index 22d6498..fbc3fba 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal-strategy.js
@@ -22,66 +22,63 @@
*/
'use strict';
-var utils = require('../utils');
+const utils = require('../utils');
-/**
- * Creates a new instance of TraversalStrategies.
- * @param {TraversalStrategies} [parent] The parent strategies from where to clone the values from.
- * @param {Function} [promiseFactory] The factory used to create the A+ Promise instances. Use it when you want to
- * create Promise instances without using ECMAScript Promise constructor, ie: bluebird or Q promises.
- * @constructor
- */
-function TraversalStrategies(parent, promiseFactory) {
- if (parent) {
- // Clone the strategies
- this.strategies = parent.strategies.slice(0);
- this.promiseFactory = parent.promiseFactory;
+class TraversalStrategies {
+ /**
+ * Creates a new instance of TraversalStrategies.
+ * @param {TraversalStrategies} [parent] The parent strategies from where to clone the values from.
+ * @param {Function} [promiseFactory] The factory used to create the A+ Promise instances. Use it when you want to
+ * create Promise instances without using ECMAScript Promise constructor, ie: bluebird or Q promises.
+ * @constructor
+ */
+ constructor(parent, promiseFactory) {
+ if (parent) {
+ // Clone the strategies
+ this.strategies = parent.strategies.slice(0);
+ this.promiseFactory = parent.promiseFactory;
+ }
+ else {
+ this.strategies = [];
+ }
+ if (promiseFactory) {
+ this.promiseFactory = promiseFactory;
+ }
}
- else {
- this.strategies = [];
+
+ /** @param {TraversalStrategy} strategy */
+ addStrategy(strategy) {
+ this.strategies.push(strategy);
}
- if (promiseFactory) {
- this.promiseFactory = promiseFactory;
+
+ /**
+ * @param {Traversal} traversal
+ * @returns {Promise}
+ */
+ applyStrategies(traversal) {
+ // Apply all strategies serially
+ const self = this;
+ return this.strategies.reduce(function reduceItem(promise, strategy) {
+ return promise.then(function () {
+ return strategy.apply(traversal, self.promiseFactory);
+ });
+ }, utils.resolvedPromise(this.promiseFactory));
}
}
-/** @param {TraversalStrategy} strategy */
-TraversalStrategies.prototype.addStrategy = function (strategy) {
- this.strategies.push(strategy);
-};
-
-/**
- * @param {Traversal} traversal
- * @returns {Promise}
- */
-TraversalStrategies.prototype.applyStrategies = function (traversal) {
- // Apply all strategies serially
- var self = this;
- return this.strategies.reduce(function reduceItem(promise, strategy) {
- return promise.then(function () {
- return strategy.apply(traversal, self.promiseFactory);
- });
- }, utils.resolvedPromise(this.promiseFactory));
-};
-
-/**
- * @abstract
- * @constructor
- */
-function TraversalStrategy() {
+/** @abstract */
+class TraversalStrategy {
+ /**
+ * @abstract
+ * @param {Traversal} traversal
+ * @param {Function|undefined} promiseFactory
+ * @returns {Promise}
+ */
+ apply(traversal, promiseFactory) {
+ }
}
-/**
- * @abstract
- * @param {Traversal} traversal
- * @param {Function|undefined} promiseFactory
- * @returns {Promise}
- */
-TraversalStrategy.prototype.apply = function (traversal, promiseFactory) {
-
-};
-
module.exports = {
TraversalStrategies: TraversalStrategies,
TraversalStrategy: TraversalStrategy
[37/50] [abbrv] tinkerpop git commit: TINKERPOP-1874 Added
P.within/out graphson examples for io docs
Posted by fl...@apache.org.
TINKERPOP-1874 Added P.within/out graphson examples for io docs
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1c333402
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1c333402
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1c333402
Branch: refs/heads/TINKERPOP-1854
Commit: 1c33340277612ba81ee751d8f91297621d9476de
Parents: 822b331
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 19 08:37:29 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jan 19 08:37:29 2018 -0500
----------------------------------------------------------------------
docs/src/dev/io/graphson.asciidoc | 194 +++++++++++++++++----------------
1 file changed, 102 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1c333402/docs/src/dev/io/graphson.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/io/graphson.asciidoc b/docs/src/dev/io/graphson.asciidoc
index efbaf9f..37af4ed 100644
--- a/docs/src/dev/io/graphson.asciidoc
+++ b/docs/src/dev/io/graphson.asciidoc
@@ -27,8 +27,7 @@ g = graph.traversal()
toJson = { o, type, comment = "" ->
println "Writing ${type}"
- "${type}\n" +
- "^".multiply(type.length()) + "\n\n" +
+ "==== ${type}\n\n" +
(comment.isEmpty() ? "" : comment + "\n\n") +
"[source,json]\n" +
"----\n" +
@@ -40,8 +39,7 @@ toJson = { o, type, comment = "" ->
file = new File("out-graphson-1d0.txt")
file.withWriter { writer ->
- writer.write("Graph Structure\n")
- writer.write("~~~~~~~~~~~~~~~\n\n")
+ writer.write("=== Graph Structure\n\n")
writer.write(toJson(graph.edges().next(), "Edge"))
writer.write(toJson(g.V().out().out().path().next(), "Path"))
writer.write(toJson(graph.edges().next().properties().next(), "Property"))
@@ -52,8 +50,7 @@ file.withWriter { writer ->
writer.write(toJson(graph.vertices().next().properties().next(), "VertexProperty"))
writer.write("\n")
- writer.write("RequestMessage\n")
- writer.write("~~~~~~~~~~~~~~\n\n")
+ writer.write("=== RequestMessage\n\n")
def msg = null
msg = RequestMessage.build("authentication").
add("saslMechanism", "PLAIN", "sasl", "AHN0ZXBocGhlbgBwYXNzd29yZA==").create()
@@ -75,8 +72,7 @@ file.withWriter { writer ->
writer.write(toJson(msg, "Sessionless Eval", "The following `RequestMessage` is an example of a sessionless request for a script evaluation with an alias that binds the `TraversalSource` of \"g\" to \"social\"."))
writer.write("\n")
- writer.write("ResponseMessage\n")
- writer.write("~~~~~~~~~~~~~~~\n\n")
+ writer.write("=== ResponseMessage\n\n")
msg = ResponseMessage.build(UUID.fromString("41d2e28a-20a4-4ab0-b379-d810dede3786")).
code(org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.AUTHENTICATE).create()
writer.write(toJson(msg, "Authentication Challenge", "When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but no in the default provided by Gremlin Server)."))
@@ -86,8 +82,7 @@ file.withWriter { writer ->
writer.write(toJson(msg, "Standard Result", "The following `ResponseMessage` is a typical example of the typical successful response Gremlin Server will return when returning results from a script."))
writer.write("\n")
- writer.write("Time\n")
- writer.write("~~~~\n\n")
+ writer.write("=== Time\n\n")
writer.write(toJson(Duration.ofDays(5), "Duration", "The following example is a `Duration` of five days."))
writer.write(toJson(Instant.now(), "Instant"))
writer.write(toJson(LocalDate.of(2016, 1, 1), "LocalDate"))
@@ -114,8 +109,7 @@ mapper = GraphSONMapper.build().
file = new File("out-graphson-2d0.txt")
file.withWriter { writer ->
- writer.write("Core\n")
- writer.write("~~~~\n\n")
+ writer.write("=== Core\n\n")
writer.write(toJson(File, "Class"))
writer.write(toJson(new Date(), "Date"))
writer.write(toJson(100.00d, "Double"))
@@ -126,8 +120,7 @@ file.withWriter { writer ->
writer.write(toJson(UUID.fromString("41d2e28a-20a4-4ab0-b379-d810dede3786"), "UUID"))
writer.write("\n")
- writer.write("Graph Structure\n")
- writer.write("~~~~~~~~~~~~~~~\n\n")
+ writer.write("=== Graph Structure\n\n")
writer.write(toJson(graph.edges().next(), "Edge"))
writer.write(toJson(g.V().out().out().path().next(), "Path"))
writer.write(toJson(graph.edges().next().properties().next(), "Property"))
@@ -138,8 +131,7 @@ file.withWriter { writer ->
writer.write(toJson(graph.vertices().next().properties().next(), "VertexProperty"))
writer.write("\n")
- writer.write("Graph Process\n")
- writer.write("~~~~~~~~~~~~~\n\n")
+ writer.write("=== Graph Process\n\n")
writer.write(toJson(SackFunctions.Barrier.normSack, "Barrier"))
writer.write(toJson(new Bytecode.Binding("x", 1), "Binding", "A \"Binding\" refers to a `Bytecode.Binding`."))
writer.write(toJson(g.V().hasLabel('person').out().in().tree(), "Bytecode", "The following `Bytecode` example represents the traversal of `g.V().hasLabel('person').out().in().tree()`. Obviously the serialized `Bytecode` woudl be quite different for the endless variations of commands that could be used together in the Gremlin language."))
@@ -156,6 +148,8 @@ file.withWriter { writer ->
metrics.addNested(new org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics(tm.getMetrics(1)));
writer.write(toJson(metrics, "Metrics"))
writer.write(toJson(P.gt(0), "P"))
+ writer.write(toJson(P.within(1), "P within"))
+ writer.write(toJson(P.without(1,2), "P without"))
writer.write(toJson(P.gt(0).and(P.lt(10)), "P and"))
writer.write(toJson(P.gt(0).or(P.within(-1, -10, -100)), "P or"))
writer.write(toJson(Scope.local, "Scope"))
@@ -164,8 +158,7 @@ file.withWriter { writer ->
writer.write(toJson(g.V().hasLabel('person').nextTraverser(), "Traverser"))
writer.write("\n")
- writer.write("RequestMessage\n")
- writer.write("~~~~~~~~~~~~~~\n\n")
+ writer.write("=== RequestMessage\n\n")
def msg = null
msg = RequestMessage.build("authentication").
add("saslMechanism", "PLAIN", "sasl", "AHN0ZXBocGhlbgBwYXNzd29yZA==").create()
@@ -187,8 +180,7 @@ file.withWriter { writer ->
writer.write(toJson(msg, "Sessionless Eval", "The following `RequestMessage` is an example of a sessionless request for a script evaluation with an alias that binds the `TraversalSource` of \"g\" to \"social\"."))
writer.write("\n")
- writer.write("ResponseMessage\n")
- writer.write("~~~~~~~~~~~~~~~\n\n")
+ writer.write("=== ResponseMessage\n\n")
msg = ResponseMessage.build(UUID.fromString("41d2e28a-20a4-4ab0-b379-d810dede3786")).
code(org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode.AUTHENTICATE).create()
writer.write(toJson(msg, "Authentication Challenge", "When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but no in the default provided by Gremlin Server)."))
@@ -198,8 +190,7 @@ file.withWriter { writer ->
writer.write(toJson(msg, "Standard Result", "The following `ResponseMessage` is a typical example of the typical successful response Gremlin Server will return when returning results from a script."))
writer.write("\n")
- writer.write("Extended\n")
- writer.write("~~~~~~~~\n\n")
+ writer.write("=== Extended\n\n")
writer.write("""Note that the "extended" types require the addition of the separate `GraphSONXModuleV2d0` module as follows:\n
[source,java]
----
@@ -1160,7 +1151,7 @@ The following `RequestMessage` is an example of the response that should be made
[source,json]
----
{
- "requestId" : "e943a111-a9f4-4fbd-bc47-28c5e01de67e",
+ "requestId" : "edf0a0b5-1d05-4b0f-96c7-3feaaf6ec45a",
"op" : "authentication",
"processor" : "",
"args" : {
@@ -1177,7 +1168,7 @@ The following `RequestMessage` is an example of a simple session request for a s
[source,json]
----
{
- "requestId" : "5d7e3354-cd29-47eb-b14a-d6fcc973e58e",
+ "requestId" : "f865b4dc-65f8-4732-a2f1-3bb1ae8823ef",
"op" : "eval",
"processor" : "session",
"args" : {
@@ -1198,7 +1189,7 @@ The following `RequestMessage` is an example of a session request for a script e
[source,json]
----
{
- "requestId" : "bb310bd3-f44f-4617-8195-4794e8e5851b",
+ "requestId" : "5a8408fc-08e4-409f-ac85-10e3afe0b8d0",
"op" : "eval",
"processor" : "session",
"args" : {
@@ -1222,7 +1213,7 @@ The following `RequestMessage` is an example of a request to close a session.
[source,json]
----
{
- "requestId" : "58d90945-76b1-4109-b6f8-44629752bda0",
+ "requestId" : "920b91b4-4ea6-4a35-80e6-a45c4e39830f",
"op" : "close",
"processor" : "session",
"args" : {
@@ -1238,7 +1229,7 @@ The following `RequestMessage` is an example of a simple sessionless request for
[source,json]
----
{
- "requestId" : "7239b3a7-0e5a-4b6f-b941-bcbc2b38bf3e",
+ "requestId" : "02d6325b-320c-42a7-9bb5-149db1cefbf7",
"op" : "eval",
"processor" : "",
"args" : {
@@ -1258,7 +1249,7 @@ The following `RequestMessage` is an example of a sessionless request for a scri
[source,json]
----
{
- "requestId" : "6e0fea49-2ea4-4cf9-859d-723b4b468efe",
+ "requestId" : "1fdf1159-cd7f-474b-ab2a-46d291095d78",
"op" : "eval",
"processor" : "",
"args" : {
@@ -1279,7 +1270,7 @@ The following `RequestMessage` is an example of a sessionless request for a scri
==== Authentication Challenge
-When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but not in the default provided by Gremlin Server).
+When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but no in the default provided by Gremlin Server).
[source,json]
----
@@ -1371,7 +1362,7 @@ The following example is a `Duration` of five days.
[source,json]
----
-"2016-10-04T12:17:19.571Z"
+"2018-01-19T13:30:19.931Z"
----
==== LocalDate
@@ -1406,14 +1397,14 @@ The following example is a `Duration` of five days.
[source,json]
----
-"2016-10-04T08:17:19.613-04:00"
+"2018-01-19T08:30:19.935-05:00"
----
==== OffsetTime
[source,json]
----
-"08:17:19.620-04:00"
+"08:30:19.935-05:00"
----
==== Period
@@ -1447,7 +1438,7 @@ The following example is a `YearMonth` of "June 2016"
[source,json]
----
-"2016-10-04T08:17:19.633-04:00[America/New_York]"
+"2018-01-19T08:30:19.937-05:00[America/New_York]"
----
==== ZoneOffset
@@ -1494,7 +1485,7 @@ types. By default, TinkerPop types will have the namespace "g" (or "gx" for "ext
----
{
"@type" : "g:Date",
- "@value" : 1475583442552
+ "@value" : 1516368624530
}
----
@@ -1544,7 +1535,7 @@ types. By default, TinkerPop types will have the namespace "g" (or "gx" for "ext
----
{
"@type" : "g:Timestamp",
- "@value" : 1475583442558
+ "@value" : 1516368624533
}
----
@@ -3416,16 +3407,7 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
{
"@type" : "g:Bytecode",
"@value" : {
- "step" : [ [ "V" ], [ "has", {
- "@type" : "g:T",
- "@value" : "label"
- }, {
- "@type" : "g:P",
- "@value" : {
- "predicate" : "eq",
- "value" : "person"
- }
- } ], [ "out" ], [ "in" ], [ "tree" ] ]
+ "step" : [ [ "V" ], [ "hasLabel", "person" ], [ "out" ], [ "in" ], [ "tree" ] ]
}
}
----
@@ -3490,6 +3472,16 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
}
----
+==== Pick
+
+[source,json]
+----
+{
+ "@type" : "g:Pick",
+ "@value" : "any"
+}
+----
+
==== Lambda
[source,json]
@@ -3513,7 +3505,7 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
"@value" : {
"dur" : {
"@type" : "g:Double",
- "@value" : 0.163871
+ "@value" : 0.138285
},
"counts" : {
"traverserCount" : {
@@ -3529,7 +3521,7 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
"annotations" : {
"percentDur" : {
"@type" : "g:Double",
- "@value" : 14.805689498929809
+ "@value" : 20.492768957867455
}
},
"id" : "7.0.0()",
@@ -3538,7 +3530,7 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
"@value" : {
"dur" : {
"@type" : "g:Double",
- "@value" : 0.293702
+ "@value" : 0.172605
},
"counts" : {
"traverserCount" : {
@@ -3554,7 +3546,7 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
"annotations" : {
"percentDur" : {
"@type" : "g:Double",
- "@value" : 26.535876495625722
+ "@value" : 25.57872788785994
}
},
"id" : "2.0.0()"
@@ -3580,6 +3572,41 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
}
----
+==== P within
+
+[source,json]
+----
+{
+ "@type" : "g:P",
+ "@value" : {
+ "predicate" : "within",
+ "value" : [ {
+ "@type" : "g:Int32",
+ "@value" : 1
+ } ]
+ }
+}
+----
+
+==== P without
+
+[source,json]
+----
+{
+ "@type" : "g:P",
+ "@value" : {
+ "predicate" : "without",
+ "value" : [ {
+ "@type" : "g:Int32",
+ "@value" : 1
+ }, {
+ "@type" : "g:Int32",
+ "@value" : 2
+ } ]
+ }
+}
+----
+
==== P and
[source,json]
@@ -3677,14 +3704,14 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
"@value" : {
"dur" : {
"@type" : "g:Double",
- "@value" : 1.10424
+ "@value" : 0.575429
},
"metrics" : [ {
- "@type" : "g:metrics",
+ "@type" : "g:Metrics",
"@value" : {
"dur" : {
"@type" : "g:Double",
- "@value" : 0.162194
+ "@value" : 0.087601
},
"counts" : {
"traverserCount" : {
@@ -3700,17 +3727,17 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
"annotations" : {
"percentDur" : {
"@type" : "g:Double",
- "@value" : 14.688292400202855
+ "@value" : 15.22359839354638
}
},
"id" : "7.0.0()"
}
}, {
- "@type" : "g:metrics",
+ "@type" : "g:Metrics",
"@value" : {
"dur" : {
"@type" : "g:Double",
- "@value" : 0.304753
+ "@value" : 0.154435
},
"counts" : {
"traverserCount" : {
@@ -3726,17 +3753,17 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
"annotations" : {
"percentDur" : {
"@type" : "g:Double",
- "@value" : 27.59843874520032
+ "@value" : 26.83823721084617
}
},
"id" : "2.0.0()"
}
}, {
- "@type" : "g:metrics",
+ "@type" : "g:Metrics",
"@value" : {
"dur" : {
"@type" : "g:Double",
- "@value" : 0.196628
+ "@value" : 0.18682
},
"counts" : {
"traverserCount" : {
@@ -3752,17 +3779,17 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
"annotations" : {
"percentDur" : {
"@type" : "g:Double",
- "@value" : 17.80663623849888
+ "@value" : 32.46621216518459
}
},
"id" : "3.0.0()"
}
}, {
- "@type" : "g:metrics",
+ "@type" : "g:Metrics",
"@value" : {
"dur" : {
"@type" : "g:Double",
- "@value" : 0.440665
+ "@value" : 0.146573
},
"counts" : {
"traverserCount" : {
@@ -3778,7 +3805,7 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
"annotations" : {
"percentDur" : {
"@type" : "g:Double",
- "@value" : 39.90663261609795
+ "@value" : 25.47195223042287
}
},
"id" : "4.0.0()"
@@ -3913,10 +3940,7 @@ The following `RequestMessage` is an example of the response that should be made
[source,json]
----
{
- "requestId" : {
- "@type" : "g:UUID",
- "@value" : "79fcec2e-62f3-4cb4-82a6-7f879bc04c42"
- },
+ "requestId" : "494a84a2-4829-4c37-8977-cff830f8cfb6",
"op" : "authentication",
"processor" : "",
"args" : {
@@ -3933,10 +3957,7 @@ The following `RequestMessage` is an example of a simple session request for a s
[source,json]
----
{
- "requestId" : {
- "@type" : "g:UUID",
- "@value" : "c4183c83-8cd5-4058-ae9d-53e74f383031"
- },
+ "requestId" : "ec474f7f-1ff5-404c-a9c8-3dbffa977eac",
"op" : "eval",
"processor" : "session",
"args" : {
@@ -3963,10 +3984,7 @@ The following `RequestMessage` is an example of a session request for a script e
[source,json]
----
{
- "requestId" : {
- "@type" : "g:UUID",
- "@value" : "11944916-6fbb-4746-9bf1-53e9754dbe28"
- },
+ "requestId" : "5f427442-3d46-4254-97c9-90ed7b631a9c",
"op" : "eval",
"processor" : "session",
"args" : {
@@ -3996,10 +4014,7 @@ The following `RequestMessage` is an example of a request to close a session.
[source,json]
----
{
- "requestId" : {
- "@type" : "g:UUID",
- "@value" : "4b5c19fa-3bb5-482c-bca1-ac8ae408c95b"
- },
+ "requestId" : "a648cf9d-6ddd-4c0e-9606-a7f3bfaf5171",
"op" : "close",
"processor" : "session",
"args" : {
@@ -4018,10 +4033,7 @@ The following `RequestMessage` is an example of a simple sessionless request for
[source,json]
----
{
- "requestId" : {
- "@type" : "g:UUID",
- "@value" : "3304b3e0-9995-4eca-b8fb-14bbef01f7b8"
- },
+ "requestId" : "b774546a-f26e-4613-b935-a7fea1047f4f",
"op" : "eval",
"processor" : "",
"args" : {
@@ -4044,10 +4056,7 @@ The following `RequestMessage` is an example of a sessionless request for a scri
[source,json]
----
{
- "requestId" : {
- "@type" : "g:UUID",
- "@value" : "0b93d54e-4124-4401-8b8f-addb18a213ea"
- },
+ "requestId" : "19ab1ce9-cf43-4e7e-80d2-94a0102e02b8",
"op" : "eval",
"processor" : "",
"args" : {
@@ -4066,11 +4075,12 @@ The following `RequestMessage` is an example of a sessionless request for a scri
}
----
+
=== ResponseMessage
==== Authentication Challenge
-When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but not in the default provided by Gremlin Server).
+When authentication is enabled, an initial request to the server will result in an authentication challenge. The typical response message will appear as follows, but handling it could be different dependending on the SASL implementation (e.g. multiple challenges maybe requested in some cases, but no in the default provided by Gremlin Server).
[source,json]
----
@@ -4298,7 +4308,7 @@ The following example is a `Duration` of five days.
----
{
"@type" : "gx:Instant",
- "@value" : "2016-10-04T12:17:22.696Z"
+ "@value" : "2018-01-19T13:30:24.598Z"
}
----
@@ -4348,7 +4358,7 @@ The following example is a `Duration` of five days.
----
{
"@type" : "gx:OffsetDateTime",
- "@value" : "2016-10-04T08:17:22.699-04:00"
+ "@value" : "2018-01-19T08:30:24.600-05:00"
}
----
@@ -4358,7 +4368,7 @@ The following example is a `Duration` of five days.
----
{
"@type" : "gx:OffsetTime",
- "@value" : "08:17:22.701-04:00"
+ "@value" : "08:30:24.601-05:00"
}
----
@@ -4414,7 +4424,7 @@ The following example is a `YearMonth` of "June 2016"
----
{
"@type" : "gx:ZonedDateTime",
- "@value" : "2016-10-04T08:17:22.708-04:00[America/New_York]"
+ "@value" : "2018-01-19T08:30:24.603-05:00[America/New_York]"
}
----
@@ -4428,4 +4438,4 @@ The following example is a `ZoneOffset` of three hours, six minutes, and nine se
"@type" : "gx:ZoneOffset",
"@value" : "+03:06:09"
}
-----
+----
\ No newline at end of file
[36/50] [abbrv] tinkerpop git commit: TINKERPOP-1874 keep P.within
and P.without using collection
Posted by fl...@apache.org.
TINKERPOP-1874 keep P.within and P.without using collection
GraphSON deserialization of P.within and P.without expects a single collection regardless of the number of values, so even a single argument should serialize to a list.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/822b3317
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/822b3317
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/822b3317
Branch: refs/heads/TINKERPOP-1854
Commit: 822b33174c87a2a918b3fc9df421585a57ef3345
Parents: 261b93b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jan 19 08:18:25 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jan 19 08:18:25 2018 -0500
----------------------------------------------------------------------
gremlin-dotnet/glv/P.template | 7 ++++++-
gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs | 6 ++----
2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/822b3317/gremlin-dotnet/glv/P.template
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/P.template b/gremlin-dotnet/glv/P.template
index f187cbb..f337127 100644
--- a/gremlin-dotnet/glv/P.template
+++ b/gremlin-dotnet/glv/P.template
@@ -32,12 +32,17 @@ namespace Gremlin.Net.Process.Traversal
/// </summary>
public class P
{
-<% pmethods.each { method -> %>
+<% pmethods.findAll{ !(it in ["within", "without"]) }.each { method -> %>
public static TraversalPredicate <%= toCSharpMethodName.call(method) %>(params object[] args)
{
var value = args.Length == 1 ? args[0] : args;
return new TraversalPredicate("<%= method %>", value);
}
+<% } %><% pmethods.findAll{ it in ["within", "without"] }.each { method -> %>
+ public static TraversalPredicate <%= toCSharpMethodName.call(method) %>(params object[] args)
+ {
+ return new TraversalPredicate("<%= method %>", args);
+ }
<% } %>
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/822b3317/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs
index 89bdc29..0a7809f 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs
@@ -101,14 +101,12 @@ namespace Gremlin.Net.Process.Traversal
public static TraversalPredicate Within(params object[] args)
{
- var value = args.Length == 1 ? args[0] : args;
- return new TraversalPredicate("within", value);
+ return new TraversalPredicate("within", args);
}
public static TraversalPredicate Without(params object[] args)
{
- var value = args.Length == 1 ? args[0] : args;
- return new TraversalPredicate("without", value);
+ return new TraversalPredicate("without", args);
}
}
[29/50] [abbrv] tinkerpop git commit: Use ES6 syntax
Posted by fl...@apache.org.
Use ES6 syntax
- Use class definitions
- Use const and let
- Computed property names in object literals
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d458f76d
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d458f76d
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d458f76d
Branch: refs/heads/TINKERPOP-1854
Commit: d458f76dc3d464dae3a5e3bb3b28f63e5b3eead1
Parents: b7f85ca
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 30 14:45:22 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:17 2018 +0100
----------------------------------------------------------------------
.../glv/GraphTraversalSource.template | 155 +-
gremlin-javascript/glv/TraversalSource.template | 247 +-
.../lib/driver/driver-remote-connection.js | 279 +-
.../lib/driver/remote-connection.js | 86 +-
.../gremlin-javascript/lib/process/bytecode.js | 125 +-
.../lib/process/graph-traversal.js | 2439 +++++++++---------
.../lib/process/traversal-strategy.js | 99 +-
.../gremlin-javascript/lib/process/traversal.js | 363 +--
.../gremlin-javascript/lib/structure/graph.js | 180 +-
.../lib/structure/io/graph-serializer.js | 535 +---
.../lib/structure/io/type-serializers.js | 288 +++
.../javascript/gremlin-javascript/lib/utils.js | 7 +-
.../test/integration/remote-connection-tests.js | 2 +-
.../test/integration/traversal-test.js | 2 +-
.../test/unit/exports-test.js | 4 +-
.../test/unit/graphson-test.js | 38 +-
.../test/unit/traversal-test.js | 26 +-
17 files changed, 2451 insertions(+), 2424 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/glv/GraphTraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/GraphTraversalSource.template b/gremlin-javascript/glv/GraphTraversalSource.template
index e0fb453..812cfcf 100644
--- a/gremlin-javascript/glv/GraphTraversalSource.template
+++ b/gremlin-javascript/glv/GraphTraversalSource.template
@@ -22,93 +22,96 @@
*/
'use strict';
-var t = require('./traversal.js');
-var remote = require('../driver/remote-connection');
-var utils = require('../utils');
-var Bytecode = require('./bytecode');
-var TraversalStrategies = require('./traversal-strategy').TraversalStrategies;
-var inherits = utils.inherits;
-var parseArgs = utils.parseArgs;
+const Traversal = require('./traversal').Traversal;
+const remote = require('../driver/remote-connection');
+const utils = require('../utils');
+const Bytecode = require('./bytecode');
+const TraversalStrategies = require('./traversal-strategy').TraversalStrategies;
+const parseArgs = utils.parseArgs;
-/**
- *
- * @param {Graph} graph
- * @param {TraversalStrategies} traversalStrategies
- * @param {Bytecode} [bytecode]
- * @constructor
- */
-function GraphTraversalSource(graph, traversalStrategies, bytecode) {
- this.graph = graph;
- this.traversalStrategies = traversalStrategies;
- this.bytecode = bytecode || new Bytecode();
-}
/**
- * @param remoteConnection
- * @returns {GraphTraversalSource}
+ * Represents the primary DSL of the Gremlin traversal machine.
*/
-GraphTraversalSource.prototype.withRemote = function (remoteConnection) {
- var traversalStrategy = new TraversalStrategies(this.traversalStrategies);
- traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
- return new GraphTraversalSource(this.graph, traversalStrategy, new Bytecode(this.bytecode));
-};
+class GraphTraversalSource {
+ /**
+ * @param {Graph} graph
+ * @param {TraversalStrategies} traversalStrategies
+ * @param {Bytecode} [bytecode]
+ */
+ constructor(graph, traversalStrategies, bytecode) {
+ this.graph = graph;
+ this.traversalStrategies = traversalStrategies;
+ this.bytecode = bytecode || new Bytecode();
+ }
-/**
- * Returns the string representation of the GraphTraversalSource.
- * @returns {string}
- */
-GraphTraversalSource.prototype.toString = function () {
- return 'graphtraversalsource[' + this.graph.toString() + ']';
-};
-<% sourceStepMethods.each{ method -> %>
-/**
- * Graph Traversal Source <%= method %> method.
- * @param {...Object} args
- * @returns {GraphTraversalSource}
- */
-GraphTraversalSource.prototype.<%= toJs.call(method) %> = function (args) {
- var b = new Bytecode(this.bytecode).addSource('<%= method %>', parseArgs.apply(null, arguments));
- return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-<%
+ /**
+ * @param remoteConnection
+ * @returns {GraphTraversalSource}
+ */
+ withRemote(remoteConnection) {
+ const traversalStrategy = new TraversalStrategies(this.traversalStrategies);
+ traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
+ return new GraphTraversalSource(this.graph, traversalStrategy, new Bytecode(this.bytecode));
+ }
+
+ /**
+ * Returns the string representation of the GraphTraversalSource.
+ * @returns {string}
+ */
+ toString() {
+ return 'graphtraversalsource[' + this.graph.toString() + ']';
+ }
+ <% sourceStepMethods.each{ method -> %>
+ /**
+ * Graph Traversal Source <%= method %> method.
+ * @param {...Object} args
+ * @returns {GraphTraversalSource}
+ */
+ <%= toJs.call(method) %>(args) {
+ const b = new Bytecode(this.bytecode).addSource('<%= method %>', parseArgs.apply(null, arguments));
+ return new GraphTraversalSource(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+ <%
+ }
+ sourceSpawnMethods.each{ method -> %>
+ /**
+ * <%= method %> GraphTraversalSource step method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ <%= toJs.call(method) %>(args) {
+ const b = new Bytecode(this.bytecode).addStep('<%= method %>', parseArgs.apply(null, arguments));
+ return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+ }
+ <% } %>
}
-sourceSpawnMethods.each{ method -> %>
-/**
- * <%= method %> GraphTraversalSource step method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversalSource.prototype.<%= toJs.call(method) %> = function (args) {
- var b = new Bytecode(this.bytecode).addStep('<%= method %>', parseArgs.apply(null, arguments));
- return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-};
-<% } %>
+
/**
* Represents a graph traversal.
- * @extends Traversal
- * @constructor
*/
-function GraphTraversal(graph, traversalStrategies, bytecode) {
- t.Traversal.call(this, graph, traversalStrategies, bytecode);
+class GraphTraversal extends Traversal {
+ constructor(graph, traversalStrategies, bytecode) {
+ super(graph, traversalStrategies, bytecode);
+ }
+ <% graphStepMethods.each{ method -> %>
+ /**
+ * Graph traversal <%= method %> method.
+ * @param {...Object} args
+ * @returns {GraphTraversal}
+ */
+ <%= toJs.call(method) %>(args) {
+ this.bytecode.addStep('<%= method %>', parseArgs.apply(null, arguments));
+ return this;
+ }
+ <% } %>
}
-inherits(GraphTraversal, t.Traversal);
-<% graphStepMethods.each{ method -> %>
-/**
- * Graph traversal <%= method %> method.
- * @param {...Object} args
- * @returns {GraphTraversal}
- */
-GraphTraversal.prototype.<%= toJs.call(method) %> = function (args) {
- this.bytecode.addStep('<%= method %>', parseArgs.apply(null, arguments));
- return this;
-};
-<% } %>
/**
* Contains the static method definitions
* @type {Object}
*/
-var statics = {};
+const statics = {};
<% anonStepMethods.each{ method -> %>
/**
* <%= method %>() static method
@@ -116,12 +119,12 @@ var statics = {};
* @returns {GraphTraversal}
*/
statics.<%= toJs.call(method) %> = function (args) {
- var g = new GraphTraversal(null, null, new Bytecode());
+ const g = new GraphTraversal(null, null, new Bytecode());
return g.<%= toJs.call(method) %>.apply(g, arguments);
};
<% } %>
module.exports = {
- GraphTraversal: GraphTraversal,
- GraphTraversalSource: GraphTraversalSource,
- statics: statics
+ GraphTraversal,
+ GraphTraversalSource,
+ statics
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template
index 0d45e90..d707a42 100644
--- a/gremlin-javascript/glv/TraversalSource.template
+++ b/gremlin-javascript/glv/TraversalSource.template
@@ -26,142 +26,149 @@ const utils = require('../utils');
const parseArgs = utils.parseArgs;
const itemDone = Object.freeze({ value: null, done: true });
-function Traversal(graph, traversalStrategies, bytecode) {
- this.graph = graph;
- this.traversalStrategies = traversalStrategies;
- this.bytecode = bytecode;
- /** @type {Array<Traverser>} */
- this.traversers = null;
- this.sideEffects = null;
- this._traversalStrategiesPromise = null;
- this._traversersIteratorIndex = 0;
-}
+class Traversal {
+ constructor(graph, traversalStrategies, bytecode) {
+ this.graph = graph;
+ this.traversalStrategies = traversalStrategies;
+ this.bytecode = bytecode;
+ /** @type {Array<Traverser>} */
+ this.traversers = null;
+ this.sideEffects = null;
+ this._traversalStrategiesPromise = null;
+ this._traversersIteratorIndex = 0;
+ }
-/** @returns {Bytecode} */
-Traversal.prototype.getBytecode = function () {
- return this.bytecode;
-};
+ /** @returns {Bytecode} */
+ getBytecode() {
+ return this.bytecode;
+ }
-/**
- * Returns an Array containing the traverser objects.
- * @returns {Promise.<Array>}
- */
-Traversal.prototype.toList = function () {
- return this._applyStrategies().then(() => {
- const result = [];
- let it;
- while ((it = this._getNext()) && !it.done) {
- result.push(it.value);
- }
- return result;
- });
-};
+ /**
+ * Returns an Array containing the traverser objects.
+ * @returns {Promise.<Array>}
+ */
+ toList() {
+ return this._applyStrategies().then(() => {
+ const result = [];
+ let it;
+ while ((it = this._getNext()) && !it.done) {
+ result.push(it.value);
+ }
+ return result;
+ });
+ };
+
+ /**
+ * Iterates all Traverser instances in the traversal.
+ * @returns {Promise}
+ */
+ iterate() {
+ return this._applyStrategies().then(() => {
+ let it;
+ while ((it = this._getNext()) && !it.done) {
+ }
+ });
+ }
-/**
- * Iterates all Traverser instances in the traversal.
- * @returns {Promise}
- */
-Traversal.prototype.iterate = function () {
- return this._applyStrategies().then(() => {
- let it;
- while ((it = this._getNext()) && !it.done) {
- }
- });
-};
+ /**
+ * Async iterator method implementation.
+ * Returns a promise containing an iterator item.
+ * @returns {Promise.<{value, done}>}
+ */
+ next() {
+ return this._applyStrategies().then(() => this._getNext());
+ }
-/**
- * Async iterator method implementation.
- * Returns a promise containing an iterator item.
- * @returns {Promise.<{value, done}>}
- */
-Traversal.prototype.next = function () {
- return this._applyStrategies().then(() => this._getNext());
-};
+ /**
+ * Synchronous iterator of traversers including
+ * @private
+ */
+ _getNext() {
+ while (this.traversers && this._traversersIteratorIndex < this.traversers.length) {
+ let traverser = this.traversers[this._traversersIteratorIndex];
+ if (traverser.bulk > 0) {
+ traverser.bulk--;
+ return { value: traverser.object, done: false };
+ }
+ this._traversersIteratorIndex++;
+ }
+ return itemDone;
+ }
-/**
- * Synchronous iterator of traversers including
- * @private
- */
-Traversal.prototype._getNext = function () {
- while (this.traversers && this._traversersIteratorIndex < this.traversers.length) {
- let traverser = this.traversers[this._traversersIteratorIndex];
- if (traverser.bulk > 0) {
- traverser.bulk--;
- return { value: traverser.object, done: false };
+ _applyStrategies() {
+ if (this._traversalStrategiesPromise) {
+ // Apply strategies only once
+ return this._traversalStrategiesPromise;
}
- this._traversersIteratorIndex++;
+ return this._traversalStrategiesPromise = this.traversalStrategies.applyStrategies(this);
}
- return itemDone;
-};
-Traversal.prototype._applyStrategies = function () {
- if (this._traversalStrategiesPromise) {
- // Apply strategies only once
- return this._traversalStrategiesPromise;
+ /**
+ * Returns the Bytecode JSON representation of the traversal
+ * @returns {String}
+ */
+ toString() {
+ return this.bytecode.toString();
+ };
+}
+
+class P {
+ /**
+ * Represents an operation.
+ * @constructor
+ */
+ constructor(operator, value, other) {
+ this.operator = operator;
+ this.value = value;
+ this.other = other;
}
- return this._traversalStrategiesPromise = this.traversalStrategies.applyStrategies(this);
-};
-/**
- * Returns the Bytecode JSON representation of the traversal
- * @returns {String}
- */
-Traversal.prototype.toString = function () {
- return this.bytecode.toString();
-};
+ /**
+ * Returns the string representation of the instance.
+ * @returns {string}
+ */
+ toString() {
+ if (this.other === undefined) {
+ return this.operator + '(' + this.value + ')';
+ }
+ return this.operator + '(' + this.value + ', ' + this.other + ')';
+ }
-/**
- * Represents an operation.
- * @constructor
- */
-function P(operator, value, other) {
- this.operator = operator;
- this.value = value;
- this.other = other;
-}
+ and(arg) {
+ return new P('and', this, arg);
+ }
-/**
- * Returns the string representation of the instance.
- * @returns {string}
- */
-P.prototype.toString = function () {
- if (this.other === undefined) {
- return this.operator + '(' + this.value + ')';
+ or(arg) {
+ return new P('or', this, arg);
+ }
+<% pmethods.each{ method -> %>
+ /** @param {...Object} args */
+ static <%= toJs.call(method) %>(args) {
+ return createP('<%= method %>', parseArgs.apply(null, arguments));
}
- return this.operator + '(' + this.value + ', ' + this.other + ')';
-};
+<% } %>
+}
function createP(operator, args) {
args.unshift(null, operator);
return new (Function.prototype.bind.apply(P, args));
}
-<% pmethods.each{ method -> %>
-/** @param {...Object} args */
-P.<%= toJs.call(method) %> = function (args) {
- return createP('<%= method %>', parseArgs.apply(null, arguments));
-};
-<% } %>
-P.prototype.and = function (arg) {
- return new P('and', this, arg);
-};
-
-P.prototype.or = function (arg) {
- return new P('or', this, arg);
-};
-function Traverser(object, bulk) {
- this.object = object;
- this.bulk = bulk || 1;
+class Traverser {
+ constructor(object, bulk) {
+ this.object = object;
+ this.bulk = bulk || 1;
+ }
}
-function TraversalSideEffects() {
+class TraversalSideEffects {
}
function toEnum(typeName, keys) {
- var result = {};
- keys.split(' ').forEach(function (k) {
- var jsKey = k;
+ const result = {};
+ keys.split(' ').forEach(k => {
+ let jsKey = k;
if (jsKey === jsKey.toUpperCase()) {
jsKey = jsKey.toLowerCase();
}
@@ -170,17 +177,19 @@ function toEnum(typeName, keys) {
return result;
}
-function EnumValue(typeName, elementName) {
- this.typeName = typeName;
- this.elementName = elementName;
+class EnumValue {
+ constructor(typeName, elementName) {
+ this.typeName = typeName;
+ this.elementName = elementName;
+ }
}
module.exports = {
- EnumValue: EnumValue,
- P: P,
- Traversal: Traversal,
- TraversalSideEffects: TraversalSideEffects,
- Traverser: Traverser<%
+ EnumValue,
+ P,
+ Traversal,
+ TraversalSideEffects,
+ Traverser<%
enums.each{ enumClass ->
out.print ",\n " + decapitalize.call(enumClass.simpleName) + ": toEnum('" + enumClass.simpleName + "', '" +
enumClass.getEnumConstants().sort { a, b -> a.name() <=> b.name() }.collect { toJs.call(it.name()) }.join(' ') + "')"
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 51661c3..ac3fb0f 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -22,165 +22,164 @@
*/
'use strict';
-var crypto = require('crypto');
-var WebSocket = require('ws');
-var util = require('util');
-var RemoteConnection = require('./remote-connection').RemoteConnection;
-var utils = require('../utils');
-var serializer = require('../structure/io/graph-serializer');
-var inherits = utils.inherits;
-var defaultMimeType = 'application/vnd.gremlin-v2.0+json';
-var responseStatusCode = {
+const crypto = require('crypto');
+const WebSocket = require('ws');
+const util = require('util');
+const RemoteConnection = require('./remote-connection').RemoteConnection;
+const utils = require('../utils');
+const serializer = require('../structure/io/graph-serializer');
+const responseStatusCode = {
success: 200,
noContent: 204,
partialContent: 206
};
+const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
-/**
- * Creates a new instance of DriverRemoteConnection.
- * @param {String} url The resource uri.
- * @param {Object} [options] The connection options.
- * @param {Array} [options.ca] Trusted certificates.
- * @param {String|Array|Buffer} [options.cert] The certificate key.
- * @param {String} [options.mimeType] The mime type to use.
- * @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs.
- * @param {GraphSONReader} [options.reader] The reader to use.
- * @param {Boolean} [options.rejectUnauthorized] Determines whether to verify or not the server certificate.
- * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
- * @param {GraphSONWriter} [options.writer] The writer to use.
- * @constructor
- */
-function DriverRemoteConnection(url, options) {
- RemoteConnection.call(this, url);
- options = options || {};
- this._ws = new WebSocket(url, {
- ca: options.ca,
- cert: options.cert,
- pfx: options.pfx,
- rejectUnauthorized: options.rejectUnauthorized
- });
- var self = this;
- this._ws.on('open', function opened () {
- self.isOpen = true;
- if (self._openCallback) {
- self._openCallback();
- }
- });
- this._ws.on('message', function incoming (data) {
- self._handleMessage(data);
- });
- // A map containing the request id and the handler
- this._responseHandlers = {};
- this._reader = options.reader || new serializer.GraphSONReader();
- this._writer = options.writer || new serializer.GraphSONWriter();
- this._openPromise = null;
- this._openCallback = null;
- this._closePromise = null;
- var mimeType = options.mimeType || defaultMimeType;
- this._header = String.fromCharCode(mimeType.length) + mimeType;
- this.isOpen = false;
- this.traversalSource = options.traversalSource || 'g';
-}
-
-inherits(DriverRemoteConnection, RemoteConnection);
+class DriverRemoteConnection extends RemoteConnection {
+ /**
+ * Creates a new instance of DriverRemoteConnection.
+ * @param {String} url The resource uri.
+ * @param {Object} [options] The connection options.
+ * @param {Array} [options.ca] Trusted certificates.
+ * @param {String|Array|Buffer} [options.cert] The certificate key.
+ * @param {String} [options.mimeType] The mime type to use.
+ * @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs.
+ * @param {GraphSONReader} [options.reader] The reader to use.
+ * @param {Boolean} [options.rejectUnauthorized] Determines whether to verify or not the server certificate.
+ * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
+ * @param {GraphSONWriter} [options.writer] The writer to use.
+ * @constructor
+ */
+ constructor(url, options) {
+ super(url);
+ options = options || {};
+ this._ws = new WebSocket(url, {
+ ca: options.ca,
+ cert: options.cert,
+ pfx: options.pfx,
+ rejectUnauthorized: options.rejectUnauthorized
+ });
+ var self = this;
+ this._ws.on('open', function opened () {
+ self.isOpen = true;
+ if (self._openCallback) {
+ self._openCallback();
+ }
+ });
+ this._ws.on('message', function incoming (data) {
+ self._handleMessage(data);
+ });
+ // A map containing the request id and the handler
+ this._responseHandlers = {};
+ this._reader = options.reader || new serializer.GraphSONReader();
+ this._writer = options.writer || new serializer.GraphSONWriter();
+ this._openPromise = null;
+ this._openCallback = null;
+ this._closePromise = null;
+ const mimeType = options.mimeType || defaultMimeType;
+ this._header = String.fromCharCode(mimeType.length) + mimeType;
+ this.isOpen = false;
+ this.traversalSource = options.traversalSource || 'g';
+ }
-/**
- * Opens the connection, if its not already opened.
- * @returns {Promise}
- */
-DriverRemoteConnection.prototype.open = function (promiseFactory) {
- if (this._closePromise) {
+ /**
+ * Opens the connection, if its not already opened.
+ * @returns {Promise}
+ */
+ open(promiseFactory) {
+ if (this._closePromise) {
+ return this._openPromise = utils.toPromise(promiseFactory, function promiseHandler(callback) {
+ callback(new Error('Connection has been closed'));
+ });
+ }
+ if (this._openPromise) {
+ return this._openPromise;
+ }
+ const self = this;
return this._openPromise = utils.toPromise(promiseFactory, function promiseHandler(callback) {
- callback(new Error('Connection has been closed'));
+ if (self.isOpen) {
+ return callback();
+ }
+ // It will be invoked when opened
+ self._openCallback = callback;
});
}
- if (this._openPromise) {
- return this._openPromise;
+
+ /** @override */
+ submit(bytecode, promiseFactory) {
+ const self = this;
+ return this.open().then(function () {
+ return utils.toPromise(promiseFactory, function promiseHandler(callback) {
+ const requestId = getUuid();
+ self._responseHandlers[requestId] = {
+ callback: callback,
+ result: null
+ };
+ const message = bufferFromString(self._header + JSON.stringify(self._getRequest(requestId, bytecode)));
+ self._ws.send(message);
+ });
+ });
}
- var self = this;
- return this._openPromise = utils.toPromise(promiseFactory, function promiseHandler(callback) {
- if (self.isOpen) {
- return callback();
- }
- // It will be invoked when opened
- self._openCallback = callback;
- });
-};
-/** @override */
-DriverRemoteConnection.prototype.submit = function (bytecode, promiseFactory) {
- var self = this;
- return this.open().then(function () {
- return utils.toPromise(promiseFactory, function promiseHandler(callback) {
- var requestId = getUuid();
- self._responseHandlers[requestId] = {
- callback: callback,
- result: null
- };
- var message = bufferFromString(self._header + JSON.stringify(self._getRequest(requestId, bytecode)));
- self._ws.send(message);
+ _getRequest(id, bytecode) {
+ return ({
+ 'requestId': { '@type': 'g:UUID', '@value': id },
+ 'op': 'bytecode',
+ 'processor': 'traversal',
+ 'args': {
+ 'gremlin': this._writer.adaptObject(bytecode),
+ 'aliases': { 'g': this.traversalSource }
+ }
});
- });
-};
+ }
-DriverRemoteConnection.prototype._getRequest = function (id, bytecode) {
- return ({
- 'requestId': { '@type': 'g:UUID', '@value': id },
- 'op': 'bytecode',
- 'processor': 'traversal',
- 'args': {
- 'gremlin': this._writer.adaptObject(bytecode),
- 'aliases': { 'g': this.traversalSource }
+ _handleMessage(data) {
+ const response = this._reader.read(JSON.parse(data.toString()));
+ const handler = this._responseHandlers[response.requestId];
+ if (response.status.code >= 400) {
+ // callback in error
+ return handler.callback(
+ new Error(util.format('Server error: %s (%d)', response.status.message, response.status.code)));
}
- });
-};
-
-DriverRemoteConnection.prototype._handleMessage = function (data) {
- var response = this._reader.read(JSON.parse(data.toString()));
- var handler = this._responseHandlers[response.requestId];
- if (response.status.code >= 400) {
- // callback in error
- return handler.callback(
- new Error(util.format('Server error: %s (%d)', response.status.message, response.status.code)));
- }
- switch (response.status.code) {
- case responseStatusCode.noContent:
- return handler.callback(null, { traversers: []});
- case responseStatusCode.partialContent:
- handler.result = handler.result || [];
- handler.result.push.apply(handler.result, response.result.data);
- break;
- default:
- if (handler.result) {
+ switch (response.status.code) {
+ case responseStatusCode.noContent:
+ return handler.callback(null, { traversers: []});
+ case responseStatusCode.partialContent:
+ handler.result = handler.result || [];
handler.result.push.apply(handler.result, response.result.data);
- }
- else {
- handler.result = response.result.data;
- }
- return handler.callback(null, { traversers: handler.result });
+ break;
+ default:
+ if (handler.result) {
+ handler.result.push.apply(handler.result, response.result.data);
+ }
+ else {
+ handler.result = response.result.data;
+ }
+ return handler.callback(null, { traversers: handler.result });
+ }
}
-};
-/**
- * Closes the Connection.
- * @return {Promise}
- */
-DriverRemoteConnection.prototype.close = function (promiseFactory) {
- if (this._closePromise) {
- return this._closePromise;
- }
- var self = this;
- return this._closePromise = utils.toPromise(promiseFactory, function promiseHandler(callback) {
- self._ws.on('close', function () {
- self.isOpen = false;
- callback();
+ /**
+ * Closes the Connection.
+ * @return {Promise}
+ */
+ close(promiseFactory) {
+ if (this._closePromise) {
+ return this._closePromise;
+ }
+ const self = this;
+ return this._closePromise = utils.toPromise(promiseFactory, function promiseHandler(callback) {
+ self._ws.on('close', function () {
+ self.isOpen = false;
+ callback();
+ });
+ self._ws.close();
});
- self._ws.close();
- });
-};
+ }
+}
function getUuid() {
- var buffer = crypto.randomBytes(16);
+ const buffer = crypto.randomBytes(16);
//clear the version
buffer[6] &= 0x0f;
//set the version 4
@@ -189,7 +188,7 @@ function getUuid() {
buffer[8] &= 0x3f;
//set the IETF variant
buffer[8] |= 0x80;
- var hex = buffer.toString('hex');
+ const hex = buffer.toString('hex');
return (
hex.substr(0, 8) + '-' +
hex.substr(8, 4) + '-' +
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
index 235375a..37f3d0e 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
@@ -22,60 +22,54 @@
*/
'use strict';
-var t = require('../process/traversal');
-var TraversalStrategy = require('../process/traversal-strategy').TraversalStrategy;
-var utils = require('../utils');
-var inherits = utils.inherits;
+const t = require('../process/traversal');
+const TraversalStrategy = require('../process/traversal-strategy').TraversalStrategy;
-function RemoteConnection(url) {
- this.url = url;
-}
-
-/**
- * @abstract
- * @param {Bytecode} bytecode
- * @param {Function|undefined} promiseFactory
- * @returns {Promise}
- */
-RemoteConnection.prototype.submit = function (bytecode, promiseFactory) {
- throw new Error('submit() was not implemented');
-};
+class RemoteConnection {
+ constructor(url) {
+ this.url = url;
+ }
-/**
- * @extends {Traversal}
- * @constructor
- */
-function RemoteTraversal(traversers, sideEffects) {
- t.Traversal.call(this, null, null, null);
- this.traversers = traversers;
- this.sideEffects = sideEffects;
+ /**
+ * @abstract
+ * @param {Bytecode} bytecode
+ * @param {Function|undefined} promiseFactory
+ * @returns {Promise}
+ */
+ submit(bytecode, promiseFactory) {
+ throw new Error('submit() was not implemented');
+ };
}
-inherits(RemoteTraversal, t.Traversal);
-
-/**
- *
- * @param {RemoteConnection} connection
- * @extends {TraversalStrategy}
- * @constructor
- */
-function RemoteStrategy(connection) {
- TraversalStrategy.call(this);
- this.connection = connection;
+class RemoteTraversal extends t.Traversal {
+ constructor(traversers, sideEffects) {
+ super(null, null, null);
+ this.traversers = traversers;
+ this.sideEffects = sideEffects;
+ }
}
-inherits(RemoteStrategy, TraversalStrategy);
+class RemoteStrategy extends TraversalStrategy {
+ /**
+ * Creates a new instance of RemoteStrategy.
+ * @param {RemoteConnection} connection
+ */
+ constructor(connection) {
+ super();
+ this.connection = connection;
+ }
-/** @override */
-RemoteStrategy.prototype.apply = function (traversal, promiseFactory) {
- if (traversal.traversers) {
- return utils.resolvedPromise(promiseFactory);
+ /** @override */
+ apply(traversal, promiseFactory) {
+ if (traversal.traversers) {
+ return utils.resolvedPromise(promiseFactory);
+ }
+ return this.connection.submit(traversal.getBytecode(), promiseFactory).then(function (remoteTraversal) {
+ traversal.sideEffects = remoteTraversal.sideEffects;
+ traversal.traversers = remoteTraversal.traversers;
+ });
}
- return this.connection.submit(traversal.getBytecode(), promiseFactory).then(function (remoteTraversal) {
- traversal.sideEffects = remoteTraversal.sideEffects;
- traversal.traversers = remoteTraversal.traversers;
- });
-};
+}
module.exports = {
RemoteConnection: RemoteConnection,
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d458f76d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
index 2909718..85a4fc2 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
@@ -22,78 +22,77 @@
*/
'use strict';
-/**
- * Creates a new instance of Bytecode
- * @param {Bytecode} [toClone]
- * @constructor
- */
-function Bytecode(toClone) {
- if (!toClone) {
- this.sourceInstructions = [];
- this.stepInstructions = [];
- }
- else {
- this.sourceInstructions = toClone.sourceInstructions.slice(0);
- this.stepInstructions = toClone.stepInstructions.slice(0);
+class Bytecode {
+ /**
+ * Creates a new instance of Bytecode
+ * @param {Bytecode} [toClone]
+ */
+ constructor(toClone) {
+ if (!toClone) {
+ this.sourceInstructions = [];
+ this.stepInstructions = [];
+ }
+ else {
+ this.sourceInstructions = toClone.sourceInstructions.slice(0);
+ this.stepInstructions = toClone.stepInstructions.slice(0);
+ }
}
-}
-/**
- * Adds a new source instructions
- * @param {String} name
- * @param {Array} values
- * @returns {Bytecode}
- */
-Bytecode.prototype.addSource = function (name, values) {
- if (name === undefined) {
- throw new Error('Name is not defined');
+ /**
+ * Adds a new source instructions
+ * @param {String} name
+ * @param {Array} values
+ * @returns {Bytecode}
+ */
+ addSource(name, values) {
+ if (name === undefined) {
+ throw new Error('Name is not defined');
+ }
+ const instruction = new Array(values.length + 1);
+ instruction[0] = name;
+ for (let i = 0; i < values.length; ++i) {
+ instruction[i + 1] = values[i];
+ }
+ this.sourceInstructions.push(Bytecode._generateInstruction(name, values));
+ return this;
}
- var instruction = new Array(values.length + 1);
- instruction[0] = name;
- for (var i = 0; i < values.length; ++i) {
- instruction[i + 1] = this._convertToArgument(values[i]);
+
+ /**
+ * Adds a new step instructions
+ * @param {String} name
+ * @param {Array} values
+ * @returns {Bytecode}
+ */
+ addStep(name, values) {
+ if (name === undefined) {
+ throw new Error('Name is not defined');
+ }
+ this.stepInstructions.push(Bytecode._generateInstruction(name, values));
+ return this;
}
- this.sourceInstructions.push(this._generateInstruction(name, values));
- return this;
-};
-/**
- * Adds a new step instructions
- * @param {String} name
- * @param {Array} values
- * @returns {Bytecode}
- */
-Bytecode.prototype.addStep = function (name, values) {
- if (name === undefined) {
- throw new Error('Name is not defined');
+ static _generateInstruction(name, values) {
+ const length = (values ? values.length : 0) + 1;
+ const instruction = new Array(length);
+ instruction[0] = name;
+ for (let i = 1; i < length; i++) {
+ instruction[i] = values[i - 1];
+ }
+ return instruction;
}
- this.stepInstructions.push(this._generateInstruction(name, values));
- return this;
-};
-Bytecode.prototype._generateInstruction = function (name, values) {
- var length = (values ? values.length : 0) + 1;
- var instruction = new Array(length);
- instruction[0] = name;
- for (var i = 1; i < length; i++) {
- instruction[i] = this._convertToArgument(values[i - 1]);
+ /**
+ * Returns the JSON representation of the source and step instructions
+ * @returns {String}
+ */
+ toString() {
+ return (
+ (this.sourceInstructions.length > 0 ? JSON.stringify(this.sourceInstructions) : '') +
+ (this.stepInstructions.length > 0 ? JSON.stringify(this.stepInstructions) : '')
+ );
}
- return instruction;
-};
+}
-/**
- * Returns the JSON representation of the source and step instructions
- * @returns {String}
- */
-Bytecode.prototype.toString = function () {
- return (
- (this.sourceInstructions.length > 0 ? JSON.stringify(this.sourceInstructions) : '') +
- (this.stepInstructions.length > 0 ? JSON.stringify(this.stepInstructions) : '')
- );
-};
-Bytecode.prototype._convertToArgument = function (value) {
- return value;
-};
module.exports = Bytecode;
\ No newline at end of file
[03/50] [abbrv] tinkerpop git commit: TINKERPOP-1489 Regenerated
traversal.js
Posted by fl...@apache.org.
TINKERPOP-1489 Regenerated traversal.js
which added Pick.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e94d4154
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e94d4154
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e94d4154
Branch: refs/heads/TINKERPOP-1854
Commit: e94d4154e02566d9197db81a8d940876be68a311
Parents: 7f5d030
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 18 12:48:27 2017 -0400
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:14 2018 +0100
----------------------------------------------------------------------
.../src/main/javascript/gremlin-javascript/process/traversal.js | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e94d4154/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
index f585161..9709a4f 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
@@ -377,6 +377,7 @@
direction: toEnum('Direction', 'BOTH IN OUT'),
operator: toEnum('Operator', 'addAll and assign div max min minus mult or sum sumLong'),
order: toEnum('Order', 'decr incr keyDecr keyIncr shuffle valueDecr valueIncr'),
+ pick: toEnum('Pick', 'any none'),
pop: toEnum('Pop', 'all first last'),
scope: toEnum('Scope', 'global local'),
t: toEnum('T', 'id key label value')
[23/50] [abbrv] tinkerpop git commit: Include information of Js
development env and release
Posted by fl...@apache.org.
Include information of Js development env and release
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8d722a94
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8d722a94
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8d722a94
Branch: refs/heads/TINKERPOP-1854
Commit: 8d722a94d3a280f031658d8e647b52740589cffa
Parents: 2afd971
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Jan 8 12:13:36 2018 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:17 2018 +0100
----------------------------------------------------------------------
.../dev/developer/development-environment.asciidoc | 15 +++++++++++++++
gremlin-javascript/pom.xml | 10 ++++++++++
2 files changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8d722a94/docs/src/dev/developer/development-environment.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/development-environment.asciidoc b/docs/src/dev/developer/development-environment.asciidoc
index 52542f8..b3b7706 100644
--- a/docs/src/dev/developer/development-environment.asciidoc
+++ b/docs/src/dev/developer/development-environment.asciidoc
@@ -131,6 +131,17 @@ This should update `~/.config/NuGet/NuGet.Config` a file with an entry containin
See release documentation for more information on configuration for release.
+
+[[nodejs-environment]]
+=== JavaScript Environment
+When building `gremlin-javascript`, mvn command will include a local copy of Node.js runtime and npm inside your project
+using `com.github.eirslett:frontend-maven-plugin` plugin. This copy of the Node.js runtime will not affect any
+other existing Node.js runtime instances in your machine.
+
+The release manager should have the authentication token set, for more information see the Release Environment
+section below.
+
+
[[release-environment]]
=== Release Environment
@@ -166,6 +177,10 @@ password =
The release manager shall use the project's pypi credentials, which are available in the PMC repository.
The `password` should be left blank so the deployment process in Maven will prompt for it at deployment time.
+To deploy `gremlin-javascript` on the link:https://www.npmjs.com[npm registry], the release manager must set the
+authentication information on the ~/.npmrc file. The easiest way to do that is to use the `npm adduser` command. This
+must be done only once, as the auth token doesn't have an expiration date and it's stored on your file system.
+
[[building-testing]]
== Building and Testing
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8d722a94/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index 0825ba6..e55bc1e 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -246,6 +246,16 @@ limitations under the License.
<nodeVersion>v4.8.3</nodeVersion>
</configuration>
</plugin>
+ <!--
+ there is no point to deploying the jvm stuff - there is no java source really - just poms
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
</build>
<profiles>
[16/50] [abbrv] tinkerpop git commit: Fix Bytecode cloning
Posted by fl...@apache.org.
Fix Bytecode cloning
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b9ca2ca9
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b9ca2ca9
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b9ca2ca9
Branch: refs/heads/TINKERPOP-1854
Commit: b9ca2ca933989840a2aa6da24af4d7311acdcbc6
Parents: 9339a83
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Nov 28 11:02:10 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:16 2018 +0100
----------------------------------------------------------------------
.../src/main/javascript/gremlin-javascript/lib/process/bytecode.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b9ca2ca9/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
index 9256e6a..2909718 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/bytecode.js
@@ -34,7 +34,7 @@ function Bytecode(toClone) {
}
else {
this.sourceInstructions = toClone.sourceInstructions.slice(0);
- this.stepInstructions = toClone.sourceInstructions.slice(0);
+ this.stepInstructions = toClone.stepInstructions.slice(0);
}
}
[22/50] [abbrv] tinkerpop git commit: Parse traversal parameters and
use empty graph
Posted by fl...@apache.org.
Parse traversal parameters and use empty graph
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/15c86798
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/15c86798
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/15c86798
Branch: refs/heads/TINKERPOP-1854
Commit: 15c86798aacf2732120f303a001421e4111c230c
Parents: e73038c
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Nov 24 15:04:41 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:16 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/glv/PackageJson.template | 5 +-
.../gremlin-javascript/lib/structure/graph.js | 31 ++++
.../javascript/gremlin-javascript/package.json | 5 +-
.../test/cucumber/feature-steps.js | 156 +++++++++++++++----
.../gremlin-javascript/test/cucumber/world.js | 33 +++-
.../test/integration/remote-connection-tests.js | 2 +-
.../test/integration/traversal-test.js | 2 +-
7 files changed, 195 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/15c86798/gremlin-javascript/glv/PackageJson.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/PackageJson.template b/gremlin-javascript/glv/PackageJson.template
index 52d2c1d..4f1ac05 100644
--- a/gremlin-javascript/glv/PackageJson.template
+++ b/gremlin-javascript/glv/PackageJson.template
@@ -37,7 +37,8 @@
},
"devDependencies": {
"mocha": "~4.0.1",
- "cucumber": "~3.1.0"
+ "cucumber": "~3.1.0",
+ "chai": "~4.1.2"
},
"repository": {
"type": "git",
@@ -48,7 +49,7 @@
},
"scripts": {
"test": "./node_modules/.bin/mocha test/unit test/integration -t 5000",
- "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/map/Count.feature",
+ "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/map/AddVertex.feature",
"unit-test": "./node_modules/.bin/mocha test/unit"
},
"engines": {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/15c86798/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
index 4ef3fd5..95fd30f 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
@@ -128,6 +128,37 @@ function Path(labels, objects) {
this.objects = objects;
}
+Path.prototype.equals = function (other) {
+ if (!(other instanceof Path)) {
+ return false;
+ }
+ if (other === this) {
+ return true;
+ }
+ return areEqual(this.objects, other.objects) && areEqual(this.labels, other.labels);
+};
+
+function areEqual(obj1, obj2) {
+ if (obj1 === obj2) {
+ return true;
+ }
+ if (typeof obj1.equals === 'function') {
+ return obj1.equals(obj2);
+ }
+ if (Array.isArray(obj1) && Array.isArray(obj2)) {
+ if (obj1.length !== obj2.length) {
+ return false;
+ }
+ for (let i = 0; i < obj1.length; i++) {
+ if (!areEqual(obj1[i], obj2[i])){
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
module.exports = {
Edge: Edge,
Graph: Graph,
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/15c86798/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index 43cf35f..aae9eb9 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -18,7 +18,8 @@
},
"devDependencies": {
"mocha": "~4.0.1",
- "cucumber": "~3.1.0"
+ "cucumber": "~3.1.0",
+ "chai": "~4.1.2"
},
"repository": {
"type": "git",
@@ -29,7 +30,7 @@
},
"scripts": {
"test": "./node_modules/.bin/mocha test/unit test/integration -t 5000",
- "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/map/Count.feature",
+ "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/",
"unit-test": "./node_modules/.bin/mocha test/unit"
},
"engines": {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/15c86798/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
index 5270b39..6625f29 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -23,36 +23,60 @@
'use strict';
const defineSupportCode = require('cucumber').defineSupportCode;
-const assert = require('assert');
const vm = require('vm');
+const expect = require('chai').expect;
const graphModule = require('../../lib/structure/graph');
const graphTraversalModule = require('../../lib/process/graph-traversal');
const traversalModule = require('../../lib/process/traversal');
const Graph = graphModule.Graph;
+const Path = graphModule.Path;
const __ = graphTraversalModule.statics;
+const parsers = [
+ [ 'd\\[([\\d.]+)\\]\\.[ilfdm]', toNumeric ],
+ [ 'v\\[(.+)\\]', toVertex ],
+ [ 'v\\[(.+)\\]\\.id', toVertexId ],
+ [ 'v\\[(.+)\\]\\.sid', toVertexIdString ],
+ [ 'e\\[(.+)\\]', toEdge ],
+ [ 'e\\[(.+)\\]\\.id', toEdgeId ],
+ [ 'e\\[(.+)\\]\\.sid', toEdgeIdString ],
+ [ 'p\\[(.+)\\]', toPath ],
+ [ 'l\\[(.*)\\]', toArray ],
+ [ 's\\[(.*)\\]', toArray ],
+ [ 'm\\[(.+)\\]', toMap ],
+ [ 'c\\[(.+)\\]', toLambda ]
+].map(x => [ new RegExp('^' + x[0] + '$'), x[1] ]);
+
defineSupportCode(function(methods) {
methods.Given(/^the (.+) graph$/, function (graphName) {
+ this.graphName = graphName;
+ const data = this.getData();
+ this.g = new Graph().traversal().withRemote(data.connection);
if (graphName === 'empty') {
- //TODO
+ return this.cleanEmptyGraph();
}
- const data = this.getDataByGraphName(graphName);
- this.graphName = graphName;
- this.g = new Graph().traversal().withRemote(data.connection)
});
- methods.Given('the graph initializer of', function () {
- //TODO
+ methods.Given('the graph initializer of', function (traversalText) {
+ const traversal = vm.runInNewContext(translate(traversalText), getSandbox(this.g, this.parameters));
+ return traversal.toList();
});
methods.Given('an unsupported test', () => {});
methods.Given('the traversal of', function (traversalText) {
- this.traversal = vm.runInNewContext(translate(traversalText), getSandbox(this.g));
+ this.traversal = vm.runInNewContext(translate(traversalText), getSandbox(this.g, this.parameters));
});
- methods.Given(/^$/, function (paramName, stringValue) {
- //TODO: Add parameter
+ methods.Given(/^using the parameter (.+) defined as "(.+)"$/, function (paramName, stringValue) {
+ let p = Promise.resolve();
+ if (this.graphName === 'empty') {
+ p = this.loadEmptyGraphData();
+ }
+ const self = this;
+ return p.then(() => {
+ self.parameters[paramName] = parseValue.call(self, stringValue);
+ });
});
methods.When('iterated to list', function () {
@@ -63,35 +87,44 @@ defineSupportCode(function(methods) {
return this.traversal.next().then(it => this.result = it.value);
});
- methods.Then(/^the result should be (\w+)$/, function (characterizedAs, resultTable) {
+ methods.Then(/^the result should be (\w+)$/, function assertResult(characterizedAs, resultTable) {
+ if (characterizedAs === 'empty') {
+ expect(this.result).to.be.empty;
+ if (typeof resultTable === 'function'){
+ return resultTable();
+ }
+ return;
+ }
+ const expectedResult = resultTable.rows().map(row => parseRow.call(this, row));
switch (characterizedAs) {
- case 'empty':
- assert.strictEqual(0, result.length);
- break;
case 'ordered':
- const expectedResult = resultTable.rows().map(parseRow);
console.log('--- ordered', expectedResult);
+ expect(this.result).to.have.deep.ordered.members(expectedResult);
+ break;
+ case 'unordered':
+ console.log('--- unordered expected:', expectedResult);
+ console.log('--- obtained:', this.result);
+ expect(this.result).to.have.deep.members(expectedResult);
break;
- }
- //TODO
- if (typeof resultTable === 'function'){
- return resultTable();
}
});
- methods.Then(/^the graph should return (\d+) for count of (.+)$/, function (stringCount, traversalString) {
-
+ methods.Then(/^the graph should return (\d+) for count of "(.+)"$/, function (stringCount, traversalText) {
+ const traversal = vm.runInNewContext(translate(traversalText), getSandbox(this.g, this.parameters));
+ return traversal.toList().then(list => {
+ expect(list).to.have.lengthOf(parseInt(stringCount, 10));
+ });
});
methods.Then(/^the result should have a count of (\d+)$/, function (stringCount) {
-
+ expect(this.result).to.have.lengthOf(parseInt(stringCount, 10));
});
- methods.Then('nothing should happen because', () => {});
+ methods.Then('nothing should happen because', _ => {});
});
-function getSandbox(g) {
- return {
+function getSandbox(g, parameters) {
+ const sandbox = {
g: g,
__: __,
Cardinality: traversalModule.cardinality,
@@ -104,14 +137,79 @@ function getSandbox(g) {
Operator: traversalModule.operator,
T: traversalModule.t,
};
+ // Pass the parameter to the sandbox
+ Object.keys(parameters).forEach(paramName => sandbox[paramName] = parameters[paramName]);
+ return sandbox;
}
function translate(traversalText) {
- traversalText = traversalText.replace('.in(', '.in_(');
- traversalText = traversalText.replace('.from(', '.from_(');
+ // Remove escaped chars
+ traversalText = traversalText.replace(/\\"/g, '"');
+ // Change according to naming convention
+ traversalText = traversalText.replace(/\.in\(/g, '.in_(');
+ traversalText = traversalText.replace(/\.from\(/g, '.from_(');
return traversalText;
}
function parseRow(row) {
- return row[0];
-}
\ No newline at end of file
+ return parseValue.call(this, row[0]);
+}
+
+function parseValue(stringValue) {
+ let extractedValue = null;
+ let parser = null;
+ for (let item of parsers) {
+ let re = item[0];
+ let match = re.exec(stringValue);
+ if (match && match.length > 1) {
+ parser = item[1];
+ extractedValue = match[1];
+ break;
+ }
+ }
+ return parser !== null ? parser.call(this, extractedValue) : stringValue;
+}
+
+function toNumeric(stringValue) {
+ return parseFloat(stringValue);
+}
+
+function toVertex(name) {
+ return this.getData().vertices[name];
+}
+
+function toVertexId(name) {
+ return toVertex.call(this, name).id;
+}
+
+function toVertexIdString(name) {
+ return toVertex.call(this, name).id.toString();
+}
+
+function toEdge(name) {
+ return this.getData().edges[name];
+}
+
+function toEdgeId(name) {
+ return toEdge.call(this, name).id;
+}
+
+function toEdgeIdString(name) {
+ return toEdge.call(this, name).id.toString();
+}
+
+function toPath(value) {
+ const parts = value.split(',');
+ return new Path(parts.map(_ => new Array(0)), parts.map(x => parseValue.call(this, x)));
+}
+
+function toArray(stringList) {
+ if (stringList === '') {
+ return new Array(0);
+ }
+ return stringList.split(',').map(x => parseValue.call(this, x));
+}
+
+function toMap() {}
+
+function toLambda() {}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/15c86798/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
index 8f72c58..946d124 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
@@ -37,18 +37,43 @@ defineSupportCode(function (methods) {
this.traversal = null;
this.result = null;
this.cache = null;
+ this.graphName = null;
+ this.parameters = {};
}
- TinkerPopWorld.prototype.getDataByGraphName = function (name) {
- return this.cache[name];
+ TinkerPopWorld.prototype.getData = function () {
+ if (!this.graphName) {
+ throw new Error("Graph name is not set");
+ }
+ return this.cache[this.graphName];
+ };
+
+ TinkerPopWorld.prototype.cleanEmptyGraph = function () {
+ const connection = this.cache['empty'].connection;
+ const g = new Graph().traversal().withRemote(connection);
+ return g.V().drop().toList();
+ };
+
+ TinkerPopWorld.prototype.loadEmptyGraphData = function () {
+ const cacheData = this.cache['empty'];
+ const c = cacheData.connection;
+ return Promise.all([ getVertices(c), getEdges(c) ]).then(values => {
+ cacheData.vertices = values[0];
+ cacheData.edges = values[1];
+ });
};
methods.setWorldConstructor(TinkerPopWorld);
methods.BeforeAll(function () {
// load all traversals
- const promises = ['modern', 'classic', 'crew', 'grateful'].map(graphName => {
- const connection = helper.getConnection('g' + graphName);
+ const promises = ['modern', 'classic', 'crew', 'grateful', 'empty'].map(graphName => {
+ let connection = null;
+ if (graphName === 'empty') {
+ connection = helper.getConnection('ggraph');
+ return connection.open().then(() => cache['empty'] = { connection: connection });
+ }
+ connection = helper.getConnection('g' + graphName);
return connection.open()
.then(() => Promise.all([getVertices(connection), getEdges(connection)]))
.then(values => {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/15c86798/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
index 268773c..e4895fe 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
@@ -39,7 +39,7 @@ describe('DriverRemoteConnection', function () {
});
describe('#submit()', function () {
it('should send the request and parse the response', function () {
- return connection.submit(new Bytecode().addStep('addV', [ 'person' ]).addStep('property', [ 'name', 'marko']))
+ return connection.submit(new Bytecode().addStep('V', []).addStep('tail', []))
.then(function (response) {
assert.ok(response);
assert.ok(response.traversers);
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/15c86798/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
index adb7d6c..7109427 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
@@ -44,7 +44,7 @@ describe('Traversal', function () {
var g = new Graph().traversal().withRemote(connection);
return g.V().toList().then(function (list) {
assert.ok(list);
- assert.strictEqual(list.length, 7);
+ assert.strictEqual(list.length, 6);
list.forEach(v => assert.ok(v instanceof Vertex));
});
});
[09/50] [abbrv] tinkerpop git commit: TINKERPOP-1489 Bump to
3.2.7-SNAPSHOT for gremlin-javascript
Posted by fl...@apache.org.
TINKERPOP-1489 Bump to 3.2.7-SNAPSHOT for gremlin-javascript
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/80e1c7ea
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/80e1c7ea
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/80e1c7ea
Branch: refs/heads/TINKERPOP-1854
Commit: 80e1c7ea3c02d3e872ac99324a854348d5e6f854
Parents: 98dc52c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Sep 5 10:15:11 2017 -0400
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:15 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80e1c7ea/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index 203e59e..919c87e 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkerpop</artifactId>
- <version>3.2.6-SNAPSHOT</version>
+ <version>3.2.7-SNAPSHOT</version>
</parent>
<artifactId>gremlin-javascript</artifactId>
<name>Apache TinkerPop :: Gremlin Javascript</name>
[13/50] [abbrv] tinkerpop git commit: Add travis support
Posted by fl...@apache.org.
Add travis support
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d35aef7c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d35aef7c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d35aef7c
Branch: refs/heads/TINKERPOP-1854
Commit: d35aef7c8d2b0f4df78ca6aacd16f6e6891d4d23
Parents: eccbd15
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Wed Nov 22 15:46:14 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:15 2018 +0100
----------------------------------------------------------------------
.travis.yml | 3 ++-
gremlin-javascript/pom.xml | 1 -
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d35aef7c/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 9b7029c..2c86de3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,4 +15,5 @@ before_install:
jobs:
include:
- script: "mvn clean install -Dci"
- - script: "touch gremlin-dotnet/src/.glv && touch gremlin-dotnet/test/.glv && mvn clean install -pl :gremlin-dotnet,:gremlin-dotnet-tests -P gremlin-dotnet -DskipIntegrationTests=false"
\ No newline at end of file
+ - script: "touch gremlin-dotnet/src/.glv && touch gremlin-dotnet/test/.glv && mvn clean install -pl :gremlin-dotnet,:gremlin-dotnet-tests -P gremlin-dotnet -DskipIntegrationTests=false"
+ - script: "mvn clean install -pl :gremlin-javascript -DskipIntegrationTests=false"
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d35aef7c/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index 919c87e..c08b59b 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -31,7 +31,6 @@ limitations under the License.
<artifactId>gremlin-core</artifactId>
<version>${project.version}</version>
</dependency>
- <!-- TESTING -->
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkergraph-gremlin</artifactId>
[04/50] [abbrv] tinkerpop git commit: TINKERPOP-1489 Cleaned up pom
Posted by fl...@apache.org.
TINKERPOP-1489 Cleaned up pom
Removed some weird characters in license and bumped version to 3.2.5-SNAPSHOT
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7f5d0306
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7f5d0306
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7f5d0306
Branch: refs/heads/TINKERPOP-1854
Commit: 7f5d0306e2e20ae756292bf829b9ddcfbbac0db6
Parents: 598b991
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 18 12:47:48 2017 -0400
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:14 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/pom.xml | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7f5d0306/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index 387e628..b9b78cc 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -1,22 +1,19 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ 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.
- -->
+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.
+-->
<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">
@@ -24,7 +21,7 @@
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkerpop</artifactId>
- <version>3.2.3-SNAPSHOT</version>
+ <version>3.2.5-SNAPSHOT</version>
</parent>
<artifactId>gremlin-javascript</artifactId>
<name>Apache TinkerPop :: Gremlin Javascript</name>
[24/50] [abbrv] tinkerpop git commit: Make Travis use a newer version
of Maven.
Posted by fl...@apache.org.
Make Travis use a newer version of Maven.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/397393d2
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/397393d2
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/397393d2
Branch: refs/heads/TINKERPOP-1854
Commit: 397393d27786e0366991215c36e7ea903fba3d67
Parents: 8d722a9
Author: Lukas Krejci <lk...@redhat.com>
Authored: Tue Nov 15 11:21:34 2016 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:17 2018 +0100
----------------------------------------------------------------------
.travis.install-maven.sh | 19 +++++++++++++++++++
.travis.yml | 13 ++++++++++++-
pom.xml | 1 +
3 files changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/397393d2/.travis.install-maven.sh
----------------------------------------------------------------------
diff --git a/.travis.install-maven.sh b/.travis.install-maven.sh
new file mode 100644
index 0000000..66affe6
--- /dev/null
+++ b/.travis.install-maven.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -xe
+
+MVN_VERSION="$1"
+MVN_INSTALL_DIR="$2"
+
+if [ ! -f "${MVN_INSTALL_DIR}/lib/maven-artifact-${MVN_VERSION}.jar" ]; then
+ rm -Rf "${MVN_INSTALL_DIR}"
+ mkdir -p "${MVN_INSTALL_DIR}"
+
+ APACHE_MIRROR="$(curl -sL https://www.apache.org/dyn/closer.cgi?asjson=1 | python -c 'import sys, json; print json.load(sys.stdin)["preferred"]')"
+ curl -o "${HOME}/apache-maven-$MVN_VERSION-bin.tar.gz" "$APACHE_MIRROR/maven/maven-3/$MVN_VERSION/binaries/apache-maven-$MVN_VERSION-bin.tar.gz"
+ cd "${MVN_INSTALL_DIR}"
+ tar -xzf "${HOME}/apache-maven-$MVN_VERSION-bin.tar.gz" --strip 1
+ chmod +x "${MVN_INSTALL_DIR}/bin/mvn"
+else
+ echo "Using cached Maven ${MVN_VERSION}"
+fi
+${MVN_INSTALL_DIR}/bin/mvn -version
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/397393d2/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 2c86de3..442de5e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,17 @@ jdk:
- oraclejdk8
sudo: required
dist: trusty
+cache:
+ directories:
+ - $HOME/mvn-home
+
+install:
+ # install maven 3.3.9 if it is not in cache already
+ - bash .travis.install-maven.sh "3.3.9" "${HOME}/mvn-home"
+ - export M2_HOME=${HOME}/mvn-home
+ - export PATH=${HOME}/mvn-home/bin:${PATH}
+ # visual check that we have the correct maven version installed
+ - mvn -version
before_install:
- sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
@@ -16,4 +27,4 @@ jobs:
include:
- script: "mvn clean install -Dci"
- script: "touch gremlin-dotnet/src/.glv && touch gremlin-dotnet/test/.glv && mvn clean install -pl :gremlin-dotnet,:gremlin-dotnet-tests -P gremlin-dotnet -DskipIntegrationTests=false"
- - script: "mvn clean install -pl :gremlin-javascript -DskipIntegrationTests=false"
\ No newline at end of file
+ - script: "mvn clean install -pl :gremlin-javascript -DskipIntegrationTests=false"
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/397393d2/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 157b9bf..259f16a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -287,6 +287,7 @@ limitations under the License.
<excludeSubProjects>false</excludeSubProjects>
<excludes>
<exclude>.travis.yml</exclude>
+ <exclude>.travis.*.sh</exclude>
<exclude>.dockerignore</exclude>
<exclude>**/.classpath</exclude>
<exclude>**/.project</exclude>
[12/50] [abbrv] tinkerpop git commit: Use cucumber-js
Posted by fl...@apache.org.
Use cucumber-js
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/56ddcb02
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/56ddcb02
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/56ddcb02
Branch: refs/heads/TINKERPOP-1854
Commit: 56ddcb027a622c6d8a4a5c3ebe923bb567263a69
Parents: d35aef7
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Wed Nov 22 17:44:18 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:15 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/glv/PackageJson.template | 4 +-
gremlin-javascript/pom.xml | 16 ++++-
.../javascript/gremlin-javascript/package.json | 4 +-
.../test/cucumber/feature-steps.js | 69 ++++++++++++++++++++
.../gremlin-javascript/test/cucumber/world.js | 33 ++++++++++
5 files changed, 121 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/56ddcb02/gremlin-javascript/glv/PackageJson.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/PackageJson.template b/gremlin-javascript/glv/PackageJson.template
index f61913f..3ff17af 100644
--- a/gremlin-javascript/glv/PackageJson.template
+++ b/gremlin-javascript/glv/PackageJson.template
@@ -36,7 +36,8 @@
"ws": "^3.0.0"
},
"devDependencies": {
- "mocha": ">= 1.14.0"
+ "mocha": "~4.0.1",
+ "cucumber": "~3.1.0"
},
"repository": {
"type": "git",
@@ -47,6 +48,7 @@
},
"scripts": {
"test": "./node_modules/.bin/mocha test --recursive -t 5000",
+ "features": "./node_modules/.bin/cucumber.js ../../../../../gremlin-test/features/",
"unit-test": "./node_modules/.bin/mocha test/unit"
},
"engines": {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/56ddcb02/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index c08b59b..871fd7a 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -269,31 +269,41 @@ server.stop().join()
<executions>
<execution>
<id>install node and npm</id>
+ <phase>generate-test-resources</phase>
<goals>
<goal>install-node-and-npm</goal>
</goals>
- <phase>generate-test-resources</phase>
</execution>
<execution>
<id>npm install</id>
+ <phase>generate-test-resources</phase>
<goals>
<goal>npm</goal>
</goals>
- <phase>generate-test-resources</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>npm test</id>
+ <phase>integration-test</phase>
<goals>
<goal>npm</goal>
</goals>
- <phase>integration-test</phase>
<configuration>
<arguments>test</arguments>
</configuration>
</execution>
+ <execution>
+ <id>npm test gherkin features</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>npm</goal>
+ </goals>
+ <configuration>
+ <arguments>run-script features</arguments>
+ </configuration>
+ </execution>
</executions>
<configuration>
<skip>${skipIntegrationTests}</skip>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/56ddcb02/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index 1228dd4..dfbaff2 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -17,7 +17,8 @@
"ws": "^3.0.0"
},
"devDependencies": {
- "mocha": ">= 1.14.0"
+ "mocha": "~4.0.1",
+ "cucumber": "~3.1.0"
},
"repository": {
"type": "git",
@@ -28,6 +29,7 @@
},
"scripts": {
"test": "./node_modules/.bin/mocha test --recursive -t 5000",
+ "features": "./node_modules/.bin/cucumber.js ../../../../../gremlin-test/features/",
"unit-test": "./node_modules/.bin/mocha test/unit"
},
"engines": {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/56ddcb02/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
new file mode 100644
index 0000000..10680b7
--- /dev/null
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+const {defineSupportCode} = require('cucumber');
+const vm = require('vm');
+
+
+defineSupportCode(function({Given, When, Then}) {
+ Given(/^the (.+) graph$/, function (graphName) {
+ //TODO: Set context g
+ });
+ // Given('the graph initializer of');
+ Given('an unsupported test', () => {});
+
+ Given('the traversal of', function (traversalText) {
+ //TODO: make traversal
+ });
+
+ Given(/^$/, function (paramName, stringValue) {
+ //TODO: Add parameter
+ });
+
+ When('iterated to list', function () {
+ //TODO
+ });
+
+ When('iterated next', function () {
+ //TODO
+ });
+
+ Then(/^the result should be (\w+)$/, function (characterizedAs, resultTable) {
+ //TODO
+ //console.log('--resultTable', resultTable.rows());
+ if (typeof resultTable === 'function'){
+ return resultTable();
+ }
+ });
+
+ Then(/^the graph should return (\d+) for count of (.+)$/, function (stringCount, traversalString) {
+
+ });
+
+ Then(/^the result should have a count of (\d+)$/, function (stringCount) {
+
+ });
+
+ Then('nothing should happen because', () => {});
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/56ddcb02/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
new file mode 100644
index 0000000..f1cd7a6
--- /dev/null
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+const {defineSupportCode} = require('cucumber');
+
+defineSupportCode(function ({setWorldConstructor}) {
+ function TinkerPopWorld(){
+ this.g = null;
+ this.traversal = null;
+ }
+ setWorldConstructor(TinkerPopWorld);
+});
\ No newline at end of file
[33/50] [abbrv] tinkerpop git commit: install Maven 3.3.9 as part of
the Docker build process
Posted by fl...@apache.org.
install Maven 3.3.9 as part of the Docker build process
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3553ea99
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3553ea99
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3553ea99
Branch: refs/heads/TINKERPOP-1854
Commit: 3553ea9903a2a5cd4dbc41f3aeb82941bc13f817
Parents: 397393d
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Apr 6 14:40:05 2017 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:18 2018 +0100
----------------------------------------------------------------------
docker/build/Dockerfile.template | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3553ea99/docker/build/Dockerfile.template
----------------------------------------------------------------------
diff --git a/docker/build/Dockerfile.template b/docker/build/Dockerfile.template
index 84f551d..17084c9 100644
--- a/docker/build/Dockerfile.template
+++ b/docker/build/Dockerfile.template
@@ -20,3 +20,7 @@ FROM tinkerpop:hadoop-HADOOP_VERSION
RUN mkdir -p /usr/src/tinkerpop
WORKDIR /usr/src/tinkerpop
COPY . /usr/src/tinkerpop
+RUN chmod 744 ./.travis.install-maven.sh
+ENV M2_HOME /root/mvn-home
+ENV PATH ${M2_HOME}/bin:${PATH}
+RUN ./.travis.install-maven.sh 3.3.9 ${M2_HOME}
[08/50] [abbrv] tinkerpop git commit: Use new server start groovy
scripts
Posted by fl...@apache.org.
Use new server start groovy scripts
- Use new server start/stop groovy scripts
- Support different traversal sources at connection level
- Avoid destructuring syntax (not support on Node.js v4)
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9bf65000
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9bf65000
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9bf65000
Branch: refs/heads/TINKERPOP-1854
Commit: 9bf6500026d10ceaaa64cc2b46dc8ce335f3d0d0
Parents: 56ddcb0
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 23 10:20:19 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:15 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/glv/PackageJson.template | 4 +-
gremlin-javascript/pom.xml | 67 +++++++++++---------
.../lib/driver/driver-remote-connection.js | 6 +-
.../javascript/gremlin-javascript/package.json | 4 +-
.../test/cucumber/feature-steps.js | 29 +++++----
.../gremlin-javascript/test/cucumber/world.js | 12 +++-
.../gremlin-javascript/test/helper.js | 29 +++++++++
.../test/integration/remote-connection-tests.js | 18 ++----
.../test/integration/traversal-test.js | 16 ++---
9 files changed, 111 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bf65000/gremlin-javascript/glv/PackageJson.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/PackageJson.template b/gremlin-javascript/glv/PackageJson.template
index 3ff17af..52d2c1d 100644
--- a/gremlin-javascript/glv/PackageJson.template
+++ b/gremlin-javascript/glv/PackageJson.template
@@ -47,8 +47,8 @@
"url": "https://issues.apache.org/jira/browse/TINKERPOP"
},
"scripts": {
- "test": "./node_modules/.bin/mocha test --recursive -t 5000",
- "features": "./node_modules/.bin/cucumber.js ../../../../../gremlin-test/features/",
+ "test": "./node_modules/.bin/mocha test/unit test/integration -t 5000",
+ "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/map/Count.feature",
"unit-test": "./node_modules/.bin/mocha test/unit"
},
"engines": {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bf65000/gremlin-javascript/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml
index 871fd7a..830052b 100644
--- a/gremlin-javascript/pom.xml
+++ b/gremlin-javascript/pom.xml
@@ -202,26 +202,30 @@ packageJsonFile.newWriter().withWriter{ it << packageJsonTemplate }
<goal>execute</goal>
</goals>
<configuration>
+ <properties>
+ <property>
+ <name>skipTests</name>
+ <value>${skipTests}</value>
+ </property>
+ <property>
+ <name>python</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>gremlinServerDir</name>
+ <value>${gremlin.server.dir}</value>
+ </property>
+ <property>
+ <name>settingsFile</name>
+ <value>${gremlin.server.dir}/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml</value>
+ </property>
+ <property>
+ <name>executionName</name>
+ <value>${project.name}</value>
+ </property>
+ </properties>
<scripts>
- <script>
- <![CDATA[
-import org.apache.tinkerpop.gremlin.server.GremlinServer
-import org.apache.tinkerpop.gremlin.server.Settings
-import org.apache.tinkerpop.gremlin.server.Settings.ScriptEngineSettings
-import org.apache.tinkerpop.gremlin.server.op.session.Session
-
-if (${skipIntegrationTests}) return
-log.info("Starting Gremlin Server instances for native testing of gremlin-javascript")
-def settings = Settings.read("${gremlin.server.dir}/conf/gremlin-server-modern.yaml")
-settings.graphs.graph = "${gremlin.server.dir}/conf/tinkergraph-empty.properties"
-settings.scriptEngines["gremlin-groovy"].scripts = ["${gremlin.server.dir}/scripts/generate-modern.groovy"]
-settings.port = 45950
-def server = new GremlinServer(settings)
-server.start().join()
-project.setContextValue("gremlin.javascript.server", server)
-log.info("Gremlin Server started on port 45950")
-]]>
- </script>
+ <script>${gremlin.server.dir}/src/test/scripts/test-server-start.groovy</script>
</scripts>
</configuration>
</execution>
@@ -232,19 +236,18 @@ log.info("Gremlin Server started on port 45950")
<goal>execute</goal>
</goals>
<configuration>
+ <properties>
+ <property>
+ <name>skipTests</name>
+ <value>${skipTests}</value>
+ </property>
+ <property>
+ <name>executionName</name>
+ <value>${project.name}</value>
+ </property>
+ </properties>
<scripts>
- <script>
- <![CDATA[
-import org.apache.tinkerpop.gremlin.server.GremlinServer
-import org.apache.tinkerpop.gremlin.server.op.session.Session
-
-if (${skipIntegrationTests}) return
-log.info("Tests for native gremlin-javascript complete")
-def server = project.getContextValue("gremlin.javascript.server")
-log.info("Shutting down $server")
-server.stop().join()
-]]>
- </script>
+ <script>${gremlin.server.dir}/src/test/scripts/test-server-stop.groovy</script>
</scripts>
</configuration>
</execution>
@@ -292,6 +295,7 @@ server.stop().join()
</goals>
<configuration>
<arguments>test</arguments>
+ <failOnError>true</failOnError>
</configuration>
</execution>
<execution>
@@ -302,6 +306,7 @@ server.stop().join()
</goals>
<configuration>
<arguments>run-script features</arguments>
+ <failOnError>true</failOnError>
</configuration>
</execution>
</executions>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bf65000/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 0d6d507..18c551c 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -41,6 +41,7 @@ var responseStatusCode = {
* Creates a new instance of DriverRemoteConnection.
* @param {String} url The resource uri.
* @param {Object} [options] The connection options.
+ * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
* @param {Array} [options.ca] Trusted certificates.
* @param {String|Array|Buffer} [options.cert] The certificate key.
* @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs.
@@ -71,6 +72,7 @@ function DriverRemoteConnection(url, options) {
this._responseHandlers = {};
this._reader = options.reader || new serializer.GraphSONReader();
this._writer = options.writer || new serializer.GraphSONWriter();
+ this._traversalSource = options.traversalSource || 'g';
this._openPromise = null;
this._openCallback = null;
this._closePromise = null;
@@ -125,7 +127,7 @@ DriverRemoteConnection.prototype._getRequest = function (id, bytecode) {
'processor': 'traversal',
'args': {
'gremlin': this._writer.adaptObject(bytecode),
- 'aliases': { 'g': 'g'}
+ 'aliases': { 'g': this._traversalSource }
}
});
};
@@ -193,7 +195,7 @@ function getUuid() {
hex.substr(20, 12));
}
-var bufferFromString = Buffer.from || function newBuffer(text) {
+const bufferFromString = (Int8Array.from !== Buffer.from && Buffer.from) || function newBuffer(text) {
return new Buffer(text, 'utf8');
};
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bf65000/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
index dfbaff2..43cf35f 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json
@@ -28,8 +28,8 @@
"url": "https://issues.apache.org/jira/browse/TINKERPOP"
},
"scripts": {
- "test": "./node_modules/.bin/mocha test --recursive -t 5000",
- "features": "./node_modules/.bin/cucumber.js ../../../../../gremlin-test/features/",
+ "test": "./node_modules/.bin/mocha test/unit test/integration -t 5000",
+ "features": "./node_modules/.bin/cucumber.js --require test/cucumber ../../../../../gremlin-test/features/map/Count.feature",
"unit-test": "./node_modules/.bin/mocha test/unit"
},
"engines": {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bf65000/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
index 10680b7..bea7321 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -22,34 +22,37 @@
*/
'use strict';
-const {defineSupportCode} = require('cucumber');
+const defineSupportCode = require('cucumber').defineSupportCode;
const vm = require('vm');
-defineSupportCode(function({Given, When, Then}) {
- Given(/^the (.+) graph$/, function (graphName) {
+defineSupportCode(function(methods) {
+ methods.Given(/^the (.+) graph$/, function (graphName) {
//TODO: Set context g
});
- // Given('the graph initializer of');
- Given('an unsupported test', () => {});
+ methods.Given('the graph initializer of', function () {
+ //TODO
+ });
+
+ methods.Given('an unsupported test', () => {});
- Given('the traversal of', function (traversalText) {
+ methods.Given('the traversal of', function (traversalText) {
//TODO: make traversal
});
- Given(/^$/, function (paramName, stringValue) {
+ methods.Given(/^$/, function (paramName, stringValue) {
//TODO: Add parameter
});
- When('iterated to list', function () {
+ methods.When('iterated to list', function () {
//TODO
});
- When('iterated next', function () {
+ methods.When('iterated next', function () {
//TODO
});
- Then(/^the result should be (\w+)$/, function (characterizedAs, resultTable) {
+ methods.Then(/^the result should be (\w+)$/, function (characterizedAs, resultTable) {
//TODO
//console.log('--resultTable', resultTable.rows());
if (typeof resultTable === 'function'){
@@ -57,13 +60,13 @@ defineSupportCode(function({Given, When, Then}) {
}
});
- Then(/^the graph should return (\d+) for count of (.+)$/, function (stringCount, traversalString) {
+ methods.Then(/^the graph should return (\d+) for count of (.+)$/, function (stringCount, traversalString) {
});
- Then(/^the result should have a count of (\d+)$/, function (stringCount) {
+ methods.Then(/^the result should have a count of (\d+)$/, function (stringCount) {
});
- Then('nothing should happen because', () => {});
+ methods.Then('nothing should happen because', () => {});
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bf65000/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
index f1cd7a6..2e4f6e1 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
@@ -22,12 +22,18 @@
*/
'use strict';
-const {defineSupportCode} = require('cucumber');
+const defineSupportCode = require('cucumber').defineSupportCode;
-defineSupportCode(function ({setWorldConstructor}) {
+defineSupportCode(function (methods) {
function TinkerPopWorld(){
this.g = null;
this.traversal = null;
}
- setWorldConstructor(TinkerPopWorld);
+ methods.setWorldConstructor(TinkerPopWorld);
+ methods.BeforeAll(function () {
+ // load all traversals
+ });
+ methods.Before(function () {
+
+ });
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bf65000/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
new file mode 100644
index 0000000..546840e
--- /dev/null
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+const DriverRemoteConnection = require('../lib/driver/driver-remote-connection');
+
+exports.getConnection = function getConnection(traversalSource) {
+ return new DriverRemoteConnection('ws://localhost:45940/gremlin', { traversalSource: traversalSource });
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bf65000/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
index df813ad..268773c 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/remote-connection-tests.js
@@ -22,16 +22,16 @@
*/
'use strict';
-var assert = require('assert');
-var Bytecode = require('../../lib/process/bytecode');
-var DriverRemoteConnection = require('../../lib/driver/driver-remote-connection');
-var graphModule = require('../../lib/structure/graph');
+const assert = require('assert');
+const Bytecode = require('../../lib/process/bytecode');
+const graphModule = require('../../lib/structure/graph');
+const helper = require('../helper');
var connection;
describe('DriverRemoteConnection', function () {
before(function () {
- connection = new DriverRemoteConnection('ws://localhost:45950/gremlin');
+ connection = helper.getConnection();
return connection.open();
});
after(function () {
@@ -55,10 +55,4 @@ describe('DriverRemoteConnection', function () {
});
});
});
-});
-
-function delay(ms) {
- return new Promise(function (resolve) {
- setTimeout(resolve, ms);
- });
-}
\ No newline at end of file
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bf65000/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
index 90afced..96de7c7 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
@@ -22,20 +22,18 @@
*/
'use strict';
-var assert = require('assert');
-var graphModule = require('../../lib/structure/graph');
-var Graph = graphModule.Graph;
-var Vertex = graphModule.Vertex;
-var utils = require('../../lib/utils');
-var t = require('../../lib/process/traversal');
-var TraversalStrategies = require('../../lib/process/traversal-strategy').TraversalStrategies;
-var DriverRemoteConnection = require('../../lib/driver/driver-remote-connection');
+const assert = require('assert');
+const graphModule = require('../../lib/structure/graph');
+const Graph = graphModule.Graph;
+const Vertex = graphModule.Vertex;
+const utils = require('../../lib/utils');
+const helper = require('../helper');
var connection;
describe('Traversal', function () {
before(function () {
- connection = new DriverRemoteConnection('ws://localhost:45950/gremlin');
+ connection = helper.getConnection();
return connection.open();
});
after(function () {
[07/50] [abbrv] tinkerpop git commit: Setup world and basic steps
Posted by fl...@apache.org.
Setup world and basic steps
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e73038cd
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e73038cd
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e73038cd
Branch: refs/heads/TINKERPOP-1854
Commit: e73038cd0a353b92c2c5f78b7133951eff0cd1a4
Parents: 9bf6500
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 23 15:06:17 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:15 2018 +0100
----------------------------------------------------------------------
.../lib/driver/driver-remote-connection.js | 4 +-
.../test/cucumber/feature-steps.js | 59 +++++++++++++++---
.../gremlin-javascript/test/cucumber/world.js | 64 +++++++++++++++++++-
.../test/integration/traversal-test.js | 6 +-
4 files changed, 119 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e73038cd/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 18c551c..31f27cd 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -72,11 +72,11 @@ function DriverRemoteConnection(url, options) {
this._responseHandlers = {};
this._reader = options.reader || new serializer.GraphSONReader();
this._writer = options.writer || new serializer.GraphSONWriter();
- this._traversalSource = options.traversalSource || 'g';
this._openPromise = null;
this._openCallback = null;
this._closePromise = null;
this.isOpen = false;
+ this.traversalSource = options.traversalSource || 'g';
}
inherits(DriverRemoteConnection, RemoteConnection);
@@ -127,7 +127,7 @@ DriverRemoteConnection.prototype._getRequest = function (id, bytecode) {
'processor': 'traversal',
'args': {
'gremlin': this._writer.adaptObject(bytecode),
- 'aliases': { 'g': this._traversalSource }
+ 'aliases': { 'g': this.traversalSource }
}
});
};
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e73038cd/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
index bea7321..5270b39 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -23,13 +23,24 @@
'use strict';
const defineSupportCode = require('cucumber').defineSupportCode;
+const assert = require('assert');
const vm = require('vm');
-
+const graphModule = require('../../lib/structure/graph');
+const graphTraversalModule = require('../../lib/process/graph-traversal');
+const traversalModule = require('../../lib/process/traversal');
+const Graph = graphModule.Graph;
+const __ = graphTraversalModule.statics;
defineSupportCode(function(methods) {
methods.Given(/^the (.+) graph$/, function (graphName) {
- //TODO: Set context g
+ if (graphName === 'empty') {
+ //TODO
+ }
+ const data = this.getDataByGraphName(graphName);
+ this.graphName = graphName;
+ this.g = new Graph().traversal().withRemote(data.connection)
});
+
methods.Given('the graph initializer of', function () {
//TODO
});
@@ -37,7 +48,7 @@ defineSupportCode(function(methods) {
methods.Given('an unsupported test', () => {});
methods.Given('the traversal of', function (traversalText) {
- //TODO: make traversal
+ this.traversal = vm.runInNewContext(translate(traversalText), getSandbox(this.g));
});
methods.Given(/^$/, function (paramName, stringValue) {
@@ -45,16 +56,24 @@ defineSupportCode(function(methods) {
});
methods.When('iterated to list', function () {
- //TODO
+ return this.traversal.toList().then(list => this.result = list);
});
methods.When('iterated next', function () {
- //TODO
+ return this.traversal.next().then(it => this.result = it.value);
});
methods.Then(/^the result should be (\w+)$/, function (characterizedAs, resultTable) {
+ switch (characterizedAs) {
+ case 'empty':
+ assert.strictEqual(0, result.length);
+ break;
+ case 'ordered':
+ const expectedResult = resultTable.rows().map(parseRow);
+ console.log('--- ordered', expectedResult);
+ break;
+ }
//TODO
- //console.log('--resultTable', resultTable.rows());
if (typeof resultTable === 'function'){
return resultTable();
}
@@ -69,4 +88,30 @@ defineSupportCode(function(methods) {
});
methods.Then('nothing should happen because', () => {});
-});
\ No newline at end of file
+});
+
+function getSandbox(g) {
+ return {
+ g: g,
+ __: __,
+ Cardinality: traversalModule.cardinality,
+ Column: traversalModule.column,
+ Direction: traversalModule.direction,
+ Order: traversalModule.order,
+ P: traversalModule.P,
+ Pick: traversalModule.pick,
+ Scope: traversalModule.scope,
+ Operator: traversalModule.operator,
+ T: traversalModule.t,
+ };
+}
+
+function translate(traversalText) {
+ traversalText = traversalText.replace('.in(', '.in_(');
+ traversalText = traversalText.replace('.from(', '.from_(');
+ return traversalText;
+}
+
+function parseRow(row) {
+ return row[0];
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e73038cd/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
index 2e4f6e1..8f72c58 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
@@ -23,17 +23,77 @@
'use strict';
const defineSupportCode = require('cucumber').defineSupportCode;
+const helper = require('../helper');
+const graphModule = require('../../lib/structure/graph');
+const graphTraversalModule = require('../../lib/process/graph-traversal');
+const Graph = graphModule.Graph;
+const __ = graphTraversalModule.statics;
defineSupportCode(function (methods) {
+ const cache = {};
+
function TinkerPopWorld(){
this.g = null;
this.traversal = null;
+ this.result = null;
+ this.cache = null;
}
+
+ TinkerPopWorld.prototype.getDataByGraphName = function (name) {
+ return this.cache[name];
+ };
+
methods.setWorldConstructor(TinkerPopWorld);
+
methods.BeforeAll(function () {
// load all traversals
+ const promises = ['modern', 'classic', 'crew', 'grateful'].map(graphName => {
+ const connection = helper.getConnection('g' + graphName);
+ return connection.open()
+ .then(() => Promise.all([getVertices(connection), getEdges(connection)]))
+ .then(values => {
+ cache[graphName] = {
+ connection: connection,
+ vertices: values[0],
+ edges: values[1]
+ };
+ });
+ });
+ return Promise.all(promises);
});
- methods.Before(function () {
+ methods.AfterAll(function () {
+ return Promise.all(Object.keys(cache).map(graphName => cache[graphName].connection.close()));
});
-});
\ No newline at end of file
+
+ methods.Before(function () {
+ this.cache = cache;
+ });
+});
+
+function getVertices(connection) {
+ const g = new Graph().traversal().withRemote(connection);
+ return g.V().group().by('name').by(__.tail()).next().then(it => it.value);
+}
+
+function getEdges(connection) {
+ const g = new Graph().traversal().withRemote(connection);
+ return g.E().group()
+ .by(__.project("o", "l", "i").by(__.outV().values("name")).by(__.inV().values("name")))
+ .by(__.tail())
+ .next()
+ .then(it => {
+ const edges = {};
+ Object.keys(it.value).map(key => {
+ edges[getEdgeKey(key)] = it.value[key];
+ });
+ return edges;
+ });
+}
+
+function getEdgeKey(key) {
+ const o = /o=(.+?)[,}]/.exec(key)[1];
+ const l = /l=(.+?)[,}]/.exec(key)[1];
+ const i = /i=(.+?)[,}]/.exec(key)[1];
+ return o + "-" + l + "->" + i;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e73038cd/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
index 96de7c7..adb7d6c 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
@@ -42,10 +42,10 @@ describe('Traversal', function () {
describe('#toList()', function () {
it('should submit the traversal and return a list', function () {
var g = new Graph().traversal().withRemote(connection);
- return g.addV('user').toList().then(function (list) {
+ return g.V().toList().then(function (list) {
assert.ok(list);
- assert.strictEqual(list.length, 1);
- assert.ok(list[0] instanceof Vertex);
+ assert.strictEqual(list.length, 7);
+ list.forEach(v => assert.ok(v instanceof Vertex));
});
});
});
[42/50] [abbrv] tinkerpop git commit: Merge branch 'pr-778' into tp32
Posted by fl...@apache.org.
Merge branch 'pr-778' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/4d67feb2
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/4d67feb2
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/4d67feb2
Branch: refs/heads/TINKERPOP-1854
Commit: 4d67feb268e085d4f40fc62d039973b92ddddbd3
Parents: a31c3b2 f1ac225
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jan 23 08:33:13 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jan 23 08:33:13 2018 -0500
----------------------------------------------------------------------
gremlin-core/pom.xml | 10 ++-
.../traversal/TraversalVertexProgram.java | 9 +--
.../computer/traversal/WorkerExecutor.java | 14 ++--
.../traverser/util/VertexTraverserSet.java | 71 ++++++++++++++++++++
.../gremlin/structure/io/gryo/GryoVersion.java | 6 +-
.../process/traversal/step/map/ProgramTest.java | 3 +-
6 files changed, 96 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
[21/50] [abbrv] tinkerpop git commit: Support bulk
Posted by fl...@apache.org.
Support bulk
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/53a7f279
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/53a7f279
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/53a7f279
Branch: refs/heads/TINKERPOP-1854
Commit: 53a7f2798209de4c2a8449d3676ca00785360858
Parents: 15c8679
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Nov 27 12:13:28 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:16 2018 +0100
----------------------------------------------------------------------
gremlin-javascript/glv/TraversalSource.template | 48 +++++++------
.../gremlin-javascript/lib/process/traversal.js | 48 +++++++------
.../test/unit/traversal-test.js | 71 ++++++++++++++++++--
3 files changed, 119 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/53a7f279/gremlin-javascript/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template
index dbb7bc4..f75765f 100644
--- a/gremlin-javascript/glv/TraversalSource.template
+++ b/gremlin-javascript/glv/TraversalSource.template
@@ -22,15 +22,15 @@
*/
'use strict';
-var utils = require('../utils');
-var parseArgs = utils.parseArgs;
-var itemDone = Object.freeze({ value: null, done: true });
-var emptyArray = Object.freeze([]);
+const utils = require('../utils');
+const parseArgs = utils.parseArgs;
+const itemDone = Object.freeze({ value: null, done: true });
function Traversal(graph, traversalStrategies, bytecode) {
this.graph = graph;
this.traversalStrategies = traversalStrategies;
this.bytecode = bytecode;
+ /** @type {Array<Traverser>} */
this.traversers = null;
this.sideEffects = null;
this._traversalStrategiesPromise = null;
@@ -47,17 +47,13 @@ Traversal.prototype.getBytecode = function () {
* @returns {Promise.<Array>}
*/
Traversal.prototype.toList = function () {
- var self = this;
- return this._applyStrategies().then(function () {
- if (!self.traversers || self._traversersIteratorIndex === self.traversers.length) {
- return emptyArray;
+ return this._applyStrategies().then(() => {
+ const result = [];
+ let it;
+ while ((it = this._getNext()) && !it.done) {
+ result.push(it.value);
}
- var arr = new Array(self.traversers.length - self._traversersIteratorIndex);
- for (var i = self._traversersIteratorIndex; i < self.traversers.length; i++) {
- arr[i] = self.traversers[i].object;
- }
- self._traversersIteratorIndex = self.traversers.length;
- return arr;
+ return result;
});
};
@@ -67,13 +63,23 @@ Traversal.prototype.toList = function () {
* @returns {Promise.<{value, done}>}
*/
Traversal.prototype.next = function () {
- var self = this;
- return this._applyStrategies().then(function () {
- if (!self.traversers || self._traversersIteratorIndex === self.traversers.length) {
- return itemDone;
+ return this._applyStrategies().then(() => this._getNext());
+};
+
+/**
+ * Synchronous iterator of traversers including
+ * @private
+ */
+Traversal.prototype._getNext = function () {
+ while (this.traversers && this._traversersIteratorIndex < this.traversers.length) {
+ let traverser = this.traversers[this._traversersIteratorIndex];
+ if (traverser.bulk > 0) {
+ traverser.bulk--;
+ return { value: traverser.object, done: false };
}
- return { value: self.traversers[self._traversersIteratorIndex++].object, done: false };
- });
+ this._traversersIteratorIndex++;
+ }
+ return itemDone;
};
Traversal.prototype._applyStrategies = function () {
@@ -133,7 +139,7 @@ P.prototype.or = function (arg) {
function Traverser(object, bulk) {
this.object = object;
- this.bulk = bulk == undefined ? 1 : bulk;
+ this.bulk = bulk || 1;
}
function TraversalSideEffects() {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/53a7f279/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
index 49c6aef..ebf8755 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
@@ -22,15 +22,15 @@
*/
'use strict';
-var utils = require('../utils');
-var parseArgs = utils.parseArgs;
-var itemDone = Object.freeze({ value: null, done: true });
-var emptyArray = Object.freeze([]);
+const utils = require('../utils');
+const parseArgs = utils.parseArgs;
+const itemDone = Object.freeze({ value: null, done: true });
function Traversal(graph, traversalStrategies, bytecode) {
this.graph = graph;
this.traversalStrategies = traversalStrategies;
this.bytecode = bytecode;
+ /** @type {Array<Traverser>} */
this.traversers = null;
this.sideEffects = null;
this._traversalStrategiesPromise = null;
@@ -47,17 +47,13 @@ Traversal.prototype.getBytecode = function () {
* @returns {Promise.<Array>}
*/
Traversal.prototype.toList = function () {
- var self = this;
- return this._applyStrategies().then(function () {
- if (!self.traversers || self._traversersIteratorIndex === self.traversers.length) {
- return emptyArray;
+ return this._applyStrategies().then(() => {
+ const result = [];
+ let it;
+ while ((it = this._getNext()) && !it.done) {
+ result.push(it.value);
}
- var arr = new Array(self.traversers.length - self._traversersIteratorIndex);
- for (var i = self._traversersIteratorIndex; i < self.traversers.length; i++) {
- arr[i] = self.traversers[i].object;
- }
- self._traversersIteratorIndex = self.traversers.length;
- return arr;
+ return result;
});
};
@@ -67,13 +63,23 @@ Traversal.prototype.toList = function () {
* @returns {Promise.<{value, done}>}
*/
Traversal.prototype.next = function () {
- var self = this;
- return this._applyStrategies().then(function () {
- if (!self.traversers || self._traversersIteratorIndex === self.traversers.length) {
- return itemDone;
+ return this._applyStrategies().then(() => this._getNext());
+};
+
+/**
+ * Synchronous iterator of traversers including
+ * @private
+ */
+Traversal.prototype._getNext = function () {
+ while (this.traversers && this._traversersIteratorIndex < this.traversers.length) {
+ let traverser = this.traversers[this._traversersIteratorIndex];
+ if (traverser.bulk > 0) {
+ traverser.bulk--;
+ return { value: traverser.object, done: false };
}
- return { value: self.traversers[self._traversersIteratorIndex++].object, done: false };
- });
+ this._traversersIteratorIndex++;
+ }
+ return itemDone;
};
Traversal.prototype._applyStrategies = function () {
@@ -193,7 +199,7 @@ P.prototype.or = function (arg) {
function Traverser(object, bulk) {
this.object = object;
- this.bulk = bulk == undefined ? 1 : bulk;
+ this.bulk = bulk || 1;
}
function TraversalSideEffects() {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/53a7f279/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
index c5271c9..635c7e8 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/traversal-test.js
@@ -22,14 +22,17 @@
*/
'use strict';
-var assert = require('assert');
-var graph = require('../../lib/structure/graph');
-var utils = require('../../lib/utils');
-var t = require('../../lib/process/traversal');
-var TraversalStrategies = require('../../lib/process/traversal-strategy').TraversalStrategies;
+const assert = require('assert');
+const expect = require('chai').expect;
+const graph = require('../../lib/structure/graph');
+const utils = require('../../lib/utils');
+const t = require('../../lib/process/traversal');
+const TraversalStrategies = require('../../lib/process/traversal-strategy').TraversalStrategies;
describe('Traversal', function () {
+
describe('#getByteCode()', function () {
+
it('should add steps for with a string parameter', function () {
var g = new graph.Graph().traversal();
var bytecode = g.V().out('created').getBytecode();
@@ -40,6 +43,7 @@ describe('Traversal', function () {
assert.strictEqual(bytecode.stepInstructions[1][0], 'out');
assert.strictEqual(bytecode.stepInstructions[1][1], 'created');
});
+
it('should add steps with an enum value', function () {
var g = new graph.Graph().traversal();
var bytecode = g.V().order().by('age', t.order.decr).getBytecode();
@@ -55,7 +59,9 @@ describe('Traversal', function () {
assert.strictEqual(bytecode.stepInstructions[2][2].elementName, 'decr');
});
});
+
describe('#next()', function () {
+
it('should apply the strategies and return a Promise with the iterator item', function () {
var strategyMock = {
apply: function (traversal) {
@@ -83,8 +89,43 @@ describe('Traversal', function () {
return traversal.next();
});
});
+
+ it('should support bulk', function () {
+ const strategyMock = {
+ apply: function (traversal) {
+ traversal.traversers = [ new t.Traverser(1, 2), new t.Traverser(2, 1) ];
+ return utils.resolvedPromise();
+ }
+ };
+ const strategies = new TraversalStrategies();
+ strategies.addStrategy(strategyMock);
+ const traversal = new t.Traversal(null, strategies, null);
+ return traversal.next()
+ .then(function (item) {
+ assert.strictEqual(item.value, 1);
+ assert.strictEqual(item.done, false);
+ return traversal.next();
+ })
+ .then(function (item) {
+ assert.strictEqual(item.value, 1);
+ assert.strictEqual(item.done, false);
+ return traversal.next();
+ })
+ .then(function (item) {
+ assert.strictEqual(item.value, 2);
+ assert.strictEqual(item.done, false);
+ return traversal.next();
+ })
+ .then(function (item) {
+ assert.strictEqual(item.value, null);
+ assert.strictEqual(item.done, true);
+ return traversal.next();
+ });
+ });
});
+
describe('#toList()', function () {
+
it('should apply the strategies and return a Promise with an array', function () {
var strategyMock = {
apply: function (traversal) {
@@ -100,6 +141,7 @@ describe('Traversal', function () {
assert.deepEqual(list, [ 'a', 'b' ]);
});
});
+
it('should return an empty array when traversers is empty', function () {
var strategyMock = {
apply: function (traversal) {
@@ -114,6 +156,23 @@ describe('Traversal', function () {
assert.ok(Array.isArray(list));
assert.strictEqual(list.length, 0);
});
- })
+ });
+
+ it('should support bulk', function () {
+ const strategyMock = {
+ apply: function (traversal) {
+ traversal.traversers = [ new t.Traverser(1, 1), new t.Traverser(2, 3), new t.Traverser(3, 2),
+ new t.Traverser(4, 1) ];
+ return utils.resolvedPromise();
+ }
+ };
+ const strategies = new TraversalStrategies();
+ strategies.addStrategy(strategyMock);
+ const traversal = new t.Traversal(null, strategies, null);
+ return traversal.toList()
+ .then(list => {
+ expect(list).to.have.members([1, 2, 2, 2, 3, 3, 4]);
+ });
+ });
});
});
\ No newline at end of file
[50/50] [abbrv] tinkerpop git commit: TINKERPOP-1854 Add Lambdas for
Gremlin.Net
Posted by fl...@apache.org.
TINKERPOP-1854 Add Lambdas for Gremlin.Net
All features are passing now (no ignored ones any more).
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b4586c71
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b4586c71
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b4586c71
Branch: refs/heads/TINKERPOP-1854
Commit: b4586c710a97a42c8efc73cee8d78d6f73998821
Parents: 0bcab7f
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Jan 24 18:56:07 2018 +0100
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Fri Jan 26 17:20:31 2018 +0100
----------------------------------------------------------------------
docs/src/reference/gremlin-variants.asciidoc | 27 ++++++--
gremlin-dotnet/glv/generate.groovy | 2 +-
.../Process/Traversal/GraphTraversal.cs | 10 +--
.../src/Gremlin.Net/Process/Traversal/Lambda.cs | 67 ++++++++++++++++++++
.../src/Gremlin.Net/Process/Traversal/__.cs | 10 +--
.../Structure/IO/GraphSON/GraphSONWriter.cs | 3 +-
.../Structure/IO/GraphSON/LambdaSerializer.cs | 45 +++++++++++++
.../Gherkin/CommonSteps.cs | 2 +-
.../Gherkin/GherkinTestRunner.cs | 35 ++--------
.../Gherkin/IgnoreException.cs | 55 ----------------
.../TraversalEvaluation/TraversalParser.cs | 2 +-
.../IO/GraphSON/GraphSONWriterTests.cs | 13 ++++
12 files changed, 169 insertions(+), 102 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index 4a2fe7a..072001b 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -46,7 +46,7 @@ implementation of Gremlin and serves as the foundation by which all other Gremli
=== The Lambda Solution
Supporting link:https://en.wikipedia.org/wiki/Anonymous_function[anonymous functions] across languages is difficult as
-most language do not support lambda introspection and thus, code analysis. In Gremlin-Java, Java8 lambdas can be leveraged.
+most languages do not support lambda introspection and thus, code analysis. In Gremlin-Java, Java8 lambdas can be leveraged.
[source,java]
g.V().out("knows").map(t -> t.get().value("name") + " is the friend name") <1>
@@ -281,7 +281,7 @@ re-construction machine-side.
=== The Lambda Solution
Supporting link:https://en.wikipedia.org/wiki/Anonymous_function[anonymous functions] across languages is difficult as
-most language do not support lambda introspection and thus, code analysis. In Gremlin-Python,
+most languages do not support lambda introspection and thus, code analysis. In Gremlin-Python,
a link:https://docs.python.org/2/reference/expressions.html#lambda[Python lambda] should be represented as a zero-arg callable
that returns a string representation of a lambda. The default lambda language is `gremlin-python` and can be changed via
`gremlin_python.statics.default_lambda_language`. When the lambda is represented in `Bytecode` its language is encoded
@@ -346,8 +346,10 @@ var g = graph.Traversal().WithRemote(new DriverRemoteConnection(new GremlinClien
When a traversal from the `GraphTraversalSource` is iterated, the traversal’s `Bytecode` is sent over the wire via the registered
`IRemoteConnection`. The bytecode is used to construct the equivalent traversal at the remote traversal source.
-Since Gremlin.Net currently doesn't support lambda expressions, all traversals can be translated to Gremlin-Java on the remote
-location (e.g. Gremlin Server).
+Moreover, typically the bytecode is analyzed to determine which language the bytecode should be translated to. If the traversal
+does not contain lambdas, the remote location (e.g. Gremlin Server) will typically
+use Gremlin-Java. If it has lambdas written in Groovy, it will use Gremlin-Groovy (e.g. `GremlinGroovyScriptEngine`).
+Likewise, if it has lambdas represented in Python, it will use Gremlin-Python (e.g. `GremlinJythonScriptEngine`).
IMPORTANT: Gremlin.Net’s `ITraversal` interface supports the standard Gremlin methods such as `Next()`, `NextTraverser()`, `ToSet()`,
`ToList()`, etc. Such "terminal" methods trigger the evaluation of the traversal.
@@ -436,6 +438,22 @@ NOTE: Many of the TraversalStrategy classes in Gremlin.Net are proxies to the re
JVM-based Gremlin traversal machine. As such, their `Apply(ITraversal)` method does nothing. However, the strategy is
encoded in the Gremlin.Net bytecode and transmitted to the Gremlin traversal machine for re-construction machine-side.
+=== The Lambda Solution
+
+Supporting link:https://en.wikipedia.org/wiki/Anonymous_function[anonymous functions] across languages is difficult as
+most languages do not support lambda introspection and thus, code analysis. While Gremlin.Net doesn't support C# lambdas, it
+is still able to represent lambdas in other languages. When the lambda is represented in `Bytecode` its language is encoded
+such that the remote connection host can infer which translator and ultimate execution engine to use.
+
+[source,csharp]
+----
+g.V().Out().Map<int>(Lambda.Groovy("it.get().value('name').length()")).Sum<int>().ToList(); <1>
+g.V().Out().Map<int>(Lambda.Python("lambda x: len(x.get().value('name'))")).Sum<int>().ToList(); <2>
+----
+
+<1> `Lambda.Groovy()` can be used to create a Groovy lambda.
+<2> `Lambda.Python()` can be used to create a Python lambda.
+
[[gremlin-javascript]]
== Gremlin-JavaScript
@@ -504,3 +522,4 @@ const __ = gremlin.process.statics;
g.V().repeat(__.out()).times(2).values("name").fold().toList();
----
+
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/generate.groovy b/gremlin-dotnet/glv/generate.groovy
index 12cfa88..f1b0ee4 100644
--- a/gremlin-dotnet/glv/generate.groovy
+++ b/gremlin-dotnet/glv/generate.groovy
@@ -48,7 +48,7 @@ def toCSharpTypeMap = ["Long": "long",
"TraversalMetrics": "E2",
"Traversal": "ITraversal",
"Traversal[]": "ITraversal[]",
- "Predicate": "TraversalPredicate",
+ "Predicate": "object",
"P": "TraversalPredicate",
"TraversalStrategy": "ITraversalStrategy",
"TraversalStrategy[]": "ITraversalStrategy[]",
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/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 d8e26ad..1c00f11 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -355,7 +355,7 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the choose step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal<S, E2> Choose<E2> (TraversalPredicate choosePredicate, ITraversal trueChoice)
+ public GraphTraversal<S, E2> Choose<E2> (object choosePredicate, ITraversal trueChoice)
{
Bytecode.AddStep("choose", choosePredicate, trueChoice);
return Wrap<S, E2>(this);
@@ -364,7 +364,7 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the choose step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal<S, E2> Choose<E2> (TraversalPredicate choosePredicate, ITraversal trueChoice, ITraversal falseChoice)
+ public GraphTraversal<S, E2> Choose<E2> (object choosePredicate, ITraversal trueChoice, ITraversal falseChoice)
{
Bytecode.AddStep("choose", choosePredicate, trueChoice, falseChoice);
return Wrap<S, E2>(this);
@@ -496,7 +496,7 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the emit step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal<S, E> Emit (TraversalPredicate emitPredicate)
+ public GraphTraversal<S, E> Emit (object emitPredicate)
{
Bytecode.AddStep("emit", emitPredicate);
return Wrap<S, E>(this);
@@ -514,7 +514,7 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the filter step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal<S, E> Filter (TraversalPredicate predicate)
+ public GraphTraversal<S, E> Filter (object predicate)
{
Bytecode.AddStep("filter", predicate);
return Wrap<S, E>(this);
@@ -1591,7 +1591,7 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the until step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal<S, E> Until (TraversalPredicate untilPredicate)
+ public GraphTraversal<S, E> Until (object untilPredicate)
{
Bytecode.AddStep("until", untilPredicate);
return Wrap<S, E>(this);
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Lambda.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Lambda.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Lambda.cs
new file mode 100644
index 0000000..5709567
--- /dev/null
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Lambda.cs
@@ -0,0 +1,67 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+namespace Gremlin.Net.Process.Traversal
+{
+ /// <summary>
+ /// Represents a lambda.
+ /// </summary>
+ public class Lambda
+ {
+ private Lambda(string expression, string language)
+ {
+ LambdaExpression = expression;
+ Language = language;
+ }
+
+ /// <summary>
+ /// Gets the lambda expression.
+ /// </summary>
+ public string LambdaExpression { get; }
+
+ /// <summary>
+ /// Gets the language of this lambda.
+ /// </summary>
+ public string Language { get; }
+
+ /// <summary>
+ /// Creates a new Groovy <see cref="Lambda"/>.
+ /// </summary>
+ /// <param name="expression">The lambda expression.</param>
+ /// <returns>The created <see cref="Lambda"/>.</returns>
+ public static Lambda Groovy(string expression)
+ {
+ return new Lambda(expression, "gremlin-groovy");
+ }
+
+ /// <summary>
+ /// Creates a new Python <see cref="Lambda"/>.
+ /// </summary>
+ /// <param name="expression">The lambda expression.</param>
+ /// <returns>The created <see cref="Lambda"/>.</returns>
+ public static Lambda Python(string expression)
+ {
+ return new Lambda(expression, "gremlin-python");
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
index 1788bad..9c186ee 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
@@ -231,7 +231,7 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the choose step to that traversal.
/// </summary>
- public static GraphTraversal<object, E2> Choose<E2>(TraversalPredicate choosePredicate, ITraversal trueChoice)
+ public static GraphTraversal<object, E2> Choose<E2>(object choosePredicate, ITraversal trueChoice)
{
return new GraphTraversal<object, E2>().Choose<E2>(choosePredicate, trueChoice);
}
@@ -239,7 +239,7 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the choose step to that traversal.
/// </summary>
- public static GraphTraversal<object, E2> Choose<E2>(TraversalPredicate choosePredicate, ITraversal trueChoice, ITraversal falseChoice)
+ public static GraphTraversal<object, E2> Choose<E2>(object choosePredicate, ITraversal trueChoice, ITraversal falseChoice)
{
return new GraphTraversal<object, E2>().Choose<E2>(choosePredicate, trueChoice, falseChoice);
}
@@ -357,7 +357,7 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the emit step to that traversal.
/// </summary>
- public static GraphTraversal<object, object> Emit(TraversalPredicate emitPredicate)
+ public static GraphTraversal<object, object> Emit(object emitPredicate)
{
return new GraphTraversal<object, object>().Emit(emitPredicate);
}
@@ -373,7 +373,7 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the filter step to that traversal.
/// </summary>
- public static GraphTraversal<object, object> Filter(TraversalPredicate predicate)
+ public static GraphTraversal<object, object> Filter(object predicate)
{
return new GraphTraversal<object, object>().Filter(predicate);
}
@@ -1239,7 +1239,7 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the until step to that traversal.
/// </summary>
- public static GraphTraversal<object, object> Until(TraversalPredicate untilPredicate)
+ public static GraphTraversal<object, object> Until(object untilPredicate)
{
return new GraphTraversal<object, object>().Until(untilPredicate);
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
index a60a558..e4a2999 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
@@ -59,7 +59,8 @@ namespace Gremlin.Net.Structure.IO.GraphSON
{typeof(Edge), new EdgeSerializer()},
{typeof(Property), new PropertySerializer()},
{typeof(VertexProperty), new VertexPropertySerializer()},
- {typeof(AbstractTraversalStrategy), new TraversalStrategySerializer()}
+ {typeof(AbstractTraversalStrategy), new TraversalStrategySerializer()},
+ {typeof(Lambda), new LambdaSerializer()}
};
/// <summary>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/LambdaSerializer.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/LambdaSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/LambdaSerializer.cs
new file mode 100644
index 0000000..8e712b1
--- /dev/null
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/LambdaSerializer.cs
@@ -0,0 +1,45 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System.Collections.Generic;
+using Gremlin.Net.Process.Traversal;
+
+namespace Gremlin.Net.Structure.IO.GraphSON
+{
+ internal class LambdaSerializer : IGraphSONSerializer
+ {
+ private const int DefaultArgument = -1;
+
+ public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
+ {
+ Lambda lambda = objectData;
+ var valueDict = new Dictionary<string, dynamic>
+ {
+ {"script", lambda.LambdaExpression},
+ {"language", lambda.Language},
+ {"arguments", DefaultArgument}
+ };
+ return GraphSONUtil.ToTypedValue(nameof(Lambda), valueDict);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 0abc247..dd96474 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -233,7 +233,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
private static object ToLambda(string stringLambda, string graphName)
{
- throw new IgnoreException(IgnoreReason.LambdaNotSupported);
+ return Lambda.Groovy(stringLambda);
}
private static object ToNumber(string stringNumber, string graphName)
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index 9cb3cf0..2db1c9b 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -37,9 +37,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
{
public class GherkinTestRunner
{
- private static readonly IDictionary<string, IgnoreReason> IgnoredScenarios =
- new Dictionary<string, IgnoreReason>();
-
private static class Keywords
{
public const string Given = "GIVEN";
@@ -84,11 +81,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
{
var failedSteps = new Dictionary<Step, Exception>();
resultFeature.Scenarios[scenario] = failedSteps;
- if (IgnoredScenarios.TryGetValue(scenario.Name, out var reason))
- {
- failedSteps.Add(scenario.Steps.First(), new IgnoreException(reason));
- break;
- }
StepBlock? currentStep = null;
StepDefinition stepDefinition = null;
foreach (var step in scenario.Steps)
@@ -136,7 +128,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
var failures = new List<Tuple<string, Exception>>();
var totalScenarios = 0;
var totalFailed = 0;
- var totalIgnored = 0;
foreach (var resultFeature in results)
{
foreach (var resultScenario in resultFeature.Scenarios)
@@ -152,16 +143,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
}
else
{
- if (failure is IgnoreException)
- {
- totalIgnored++;
- WriteOutput($" {++identifier}) {step.Keyword} {step.Text} (ignored)");
- }
- else
- {
- totalFailed++;
- WriteOutput($" {++identifier}) {step.Keyword} {step.Text} (failed)");
- }
+ totalFailed++;
+ WriteOutput($" {++identifier}) {step.Keyword} {step.Text} (failed)");
failures.Add(Tuple.Create(resultScenario.Key.Name, failure));
}
}
@@ -169,24 +152,18 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
}
if (totalFailed > 0)
{
- WriteOutput("Failures" + (totalIgnored > 0 ? " and skipped scenarios" : "") + ":");
- }
- else if (totalIgnored > 0)
- {
- WriteOutput("Skipped scenarios:");
+ WriteOutput("Failures:");
}
for (var index = 0; index < failures.Count; index++)
{
var failure = failures[index];
- var message = failure.Item2 is IgnoreException
- ? ": " + failure.Item2.Message
- : ": Failed\n" + failure.Item2;
+ var message = ": Failed\n" + failure.Item2;
WriteOutput($"{index+1}) {failure.Item1}{message}");
}
WriteOutput("-----------------");
WriteOutput($"Total scenarios: {totalScenarios}." +
- $" Passed: {totalScenarios-totalFailed-totalIgnored}." +
- $" Failed: {totalFailed}. Skipped: {totalIgnored}.");
+ $" Passed: {totalScenarios-totalFailed}." +
+ $" Failed: {totalFailed}.");
if (totalFailed == 0)
{
return;
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
deleted file mode 100644
index ae236c7..0000000
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-#region License
-
-/*
- * 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.
- */
-
-#endregion
-
-using System;
-
-namespace Gremlin.Net.IntegrationTest.Gherkin
-{
- /// <summary>
- /// Represents a test exception that should be ignored, given a reason (ie: feature not supported in the .NET GLV)
- /// </summary>
- public class IgnoreException : Exception
- {
- public IgnoreException(IgnoreReason reason) : base(GetMessage(reason))
- {
-
- }
-
- private static string GetMessage(IgnoreReason reason)
- {
- string reasonSuffix = null;
- switch (reason)
- {
- case IgnoreReason.LambdaNotSupported:
- reasonSuffix = " because lambdas are not supported in Gremlin.NET";
- break;
- }
- return $"Scenario ignored" + reasonSuffix;
- }
- }
-
- public enum IgnoreReason
- {
- LambdaNotSupported
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 118fcea..aeef107 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -398,7 +398,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
{
return ParseNumber(text, ref i);
}
- if (text.Substring(i, 3).StartsWith("__."))
+ if (text.Length >= i + 3 && text.Substring(i, 3).StartsWith("__."))
{
var startIndex = i;
var tokens = ParseTokens(text, ref i);
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4586c71/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
index 3d02533..7774907 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
@@ -333,6 +333,19 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
const string expected = "{\"@type\":\"g:SubgraphStrategy\",\"@value\":{}}";
Assert.Equal(expected, graphSon);
}
+
+ [Fact]
+ public void ShouldSerializeLambda()
+ {
+ var writer = CreateStandardGraphSONWriter();
+ var lambda = Lambda.Groovy("{ it.get() }");
+
+ var graphSon = writer.WriteObject(lambda);
+
+ const string expected =
+ "{\"@type\":\"g:Lambda\",\"@value\":{\"script\":\"{ it.get() }\",\"language\":\"gremlin-groovy\",\"arguments\":-1}}";
+ Assert.Equal(expected, graphSon);
+ }
}
internal class TestGraphSONSerializer : IGraphSONSerializer
[17/50] [abbrv] tinkerpop git commit: Parse maps and mark scenarios
with lambdas as skipped
Posted by fl...@apache.org.
Parse maps and mark scenarios with lambdas as skipped
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9339a837
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9339a837
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9339a837
Branch: refs/heads/TINKERPOP-1854
Commit: 9339a837b83aa6d72e22cd292fa8a68880b1b51e
Parents: 219ead0
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Nov 27 14:42:26 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Jan 19 09:30:16 2018 +0100
----------------------------------------------------------------------
.../test/cucumber/feature-steps.js | 84 ++++++++++++++++++--
.../gremlin-javascript/test/cucumber/world.js | 2 +-
2 files changed, 78 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9339a837/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
index 6625f29..8ec2bdc 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -25,6 +25,7 @@
const defineSupportCode = require('cucumber').defineSupportCode;
const vm = require('vm');
const expect = require('chai').expect;
+const util = require('util');
const graphModule = require('../../lib/structure/graph');
const graphTraversalModule = require('../../lib/process/graph-traversal');
const traversalModule = require('../../lib/process/traversal');
@@ -32,6 +33,10 @@ const Graph = graphModule.Graph;
const Path = graphModule.Path;
const __ = graphTraversalModule.statics;
+// Determines whether the feature maps (m[]), are deserialized as objects (true) or maps (false).
+// Use false for GraphSON3.
+const mapAsObject = true;
+
const parsers = [
[ 'd\\[([\\d.]+)\\]\\.[ilfdm]', toNumeric ],
[ 'v\\[(.+)\\]', toVertex ],
@@ -69,6 +74,8 @@ defineSupportCode(function(methods) {
});
methods.Given(/^using the parameter (.+) defined as "(.+)"$/, function (paramName, stringValue) {
+ // Remove escaped chars
+ stringValue = stringValue.replace(/\\"/g, '"');
let p = Promise.resolve();
if (this.graphName === 'empty') {
p = this.loadEmptyGraphData();
@@ -76,6 +83,11 @@ defineSupportCode(function(methods) {
const self = this;
return p.then(() => {
self.parameters[paramName] = parseValue.call(self, stringValue);
+ }).catch(err => {
+ if (err instanceof IgnoreError) {
+ return 'skipped';
+ }
+ throw err;
});
});
@@ -98,14 +110,14 @@ defineSupportCode(function(methods) {
const expectedResult = resultTable.rows().map(row => parseRow.call(this, row));
switch (characterizedAs) {
case 'ordered':
- console.log('--- ordered', expectedResult);
expect(this.result).to.have.deep.ordered.members(expectedResult);
break;
case 'unordered':
- console.log('--- unordered expected:', expectedResult);
- console.log('--- obtained:', this.result);
expect(this.result).to.have.deep.members(expectedResult);
break;
+ case 'of':
+ expect(this.result).to.include.deep.members(expectedResult);
+ break;
}
});
@@ -117,7 +129,22 @@ defineSupportCode(function(methods) {
});
methods.Then(/^the result should have a count of (\d+)$/, function (stringCount) {
- expect(this.result).to.have.lengthOf(parseInt(stringCount, 10));
+ const expected = parseInt(stringCount, 10);
+ if (!Array.isArray(this.result)) {
+ let count = 0;
+ if (this.result instanceof Map) {
+ count = this.result.size;
+ }
+ else if (typeof this.result === 'object') {
+ count = Object.keys(this.result).length;
+ }
+ else {
+ throw new Error('result not supported: ' + util.inspect(this.result));
+ }
+ expect(count).to.be.equal(expected);
+ return;
+ }
+ expect(this.result).to.have.lengthOf(expected);
});
methods.Then('nothing should happen because', _ => {});
@@ -187,7 +214,11 @@ function toVertexIdString(name) {
}
function toEdge(name) {
- return this.getData().edges[name];
+ const e = this.getData().edges[name];
+ if (!e) {
+ throw new Error(util.format('Edge with key "%s" not found', name));
+ }
+ return e;
}
function toEdgeId(name) {
@@ -210,6 +241,45 @@ function toArray(stringList) {
return stringList.split(',').map(x => parseValue.call(this, x));
}
-function toMap() {}
+function toMap(stringMap) {
+ return parseMapValue.call(this, JSON.parse(stringMap));
+}
+
+function parseMapValue(value) {
+ if (typeof value === 'string') {
+ return parseValue.call(this, value);
+ }
+ if (Array.isArray(value)) {
+ return value.map(x => parseMapValue.call(this, x));
+ }
+ if (typeof value !== 'object') {
+ return value;
+ }
+ if (mapAsObject) {
+ const result = {};
+ Object.keys(value).forEach(key => {
+ result[key] = parseMapValue.call(this, value[key]);
+ });
+ return result;
+ }
+ const map = new Map();
+ Object.keys(value).forEach(key => {
+ map.set(key, parseMapValue.call(this, value[key]));
+ });
+ return map;
+}
+
+function toLambda() {
+ throw new IgnoreError(IgnoreError.reason.lambdaNotSupported);
+}
+
+function IgnoreError(reason) {
+ Error.call(this, reason);
+ Error.captureStackTrace(this, IgnoreError);
+}
+
+util.inherits(IgnoreError, Error);
-function toLambda() {}
\ No newline at end of file
+IgnoreError.reason = {
+ lambdaNotSupported: 'Lambdas are not supported on gremlin-javascript',
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9339a837/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
index 946d124..03febd1 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/world.js
@@ -104,7 +104,7 @@ function getVertices(connection) {
function getEdges(connection) {
const g = new Graph().traversal().withRemote(connection);
return g.E().group()
- .by(__.project("o", "l", "i").by(__.outV().values("name")).by(__.inV().values("name")))
+ .by(__.project("o", "l", "i").by(__.outV().values("name")).by(__.label()).by(__.inV().values("name")))
.by(__.tail())
.next()
.then(it => {
[41/50] [abbrv] tinkerpop git commit: Merge branch 'pr-780' into tp32
Posted by fl...@apache.org.
Merge branch 'pr-780' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a31c3b2e
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a31c3b2e
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a31c3b2e
Branch: refs/heads/TINKERPOP-1854
Commit: a31c3b2eaa136e115d29b6fe17fd902e1bd64bd6
Parents: 92a09d8 b22d78b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jan 23 08:18:53 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jan 23 08:18:53 2018 -0500
----------------------------------------------------------------------
.../gremlin/structure/util/reference/ReferenceElement.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------