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 2017/11/01 19:09:31 UTC
[8/9] tinkerpop git commit: Fix merge of 'tp32' into master for
TINKERPOP-1752 branch
Fix merge of 'tp32' into master for TINKERPOP-1752 branch
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ab2fd2ca
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ab2fd2ca
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ab2fd2ca
Branch: refs/heads/master
Commit: ab2fd2cadd64a7af1438977ad9d31e9feff16eec
Parents: 8e224ef
Author: florianhockmann <fh...@florian-hockmann.de>
Authored: Wed Nov 1 19:35:53 2017 +0100
Committer: florianhockmann <fh...@florian-hockmann.de>
Committed: Wed Nov 1 19:35:53 2017 +0100
----------------------------------------------------------------------
gremlin-dotnet/glv/generate.groovy | 25 +--
.../Process/Traversal/GraphTraversal.cs | 154 ++++++++-----------
.../Process/Traversal/GraphTraversalSource.cs | 37 +++--
.../src/Gremlin.Net/Process/Traversal/__.cs | 122 +++++----------
.../GraphTraversalTests.cs | 2 +-
.../GraphSON/BytecodeGraphSONSerializerTests.cs | 4 +-
.../IO/GraphSON/GraphSONWriterTests.cs | 6 +-
7 files changed, 140 insertions(+), 210 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ab2fd2ca/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/generate.groovy b/gremlin-dotnet/glv/generate.groovy
index 4e5997f..791654e 100644
--- a/gremlin-dotnet/glv/generate.groovy
+++ b/gremlin-dotnet/glv/generate.groovy
@@ -71,6 +71,7 @@ def methodsWithSpecificTypes = ["constant": useE2,
"skip": useE2,
"sum": useE2,
"tail": useE2,
+ "unfold": useE2,
"valueMap": ["IDictionary<TKey, TValue>", "TKey, TValue"],]
def getCSharpGenericTypeParam = { typeName ->
@@ -165,24 +166,6 @@ def hasMethodNoGenericCounterPartInGraphTraversal = { method ->
if (method.name.equals("fold")) {
return parameterTypeNames.size() == 0
}
- if (method.name.equals("limit")) {
- if (parameterTypeNames.size() == 1) {
- return parameterTypeNames[0].equals("long")
- }
- }
- if (method.name.equals("range")) {
- if (parameterTypeNames.size() == 2) {
- return parameterTypeNames[0].equals("long") && parameterTypeNames[1].equals("long")
- }
- }
- if (method.name.equals("tail")) {
- if (parameterTypeNames.size() == 0) {
- return true
- }
- if (parameterTypeNames.size() == 1) {
- return parameterTypeNames[0].equals("long")
- }
- }
return false
}
@@ -205,7 +188,6 @@ def binding = ["pmethods": P.class.getMethods().
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)
}.
@@ -239,6 +221,11 @@ def binding = ["pmethods": P.class.getMethods().
def t1 = toCSharpType(typeNames[0])
def t2 = toCSharpType(typeNames[1])
def tParam = getCSharpGenericTypeParam(t2)
+ def specificTypes = methodsWithSpecificTypes.get(javaMethod.name)
+ if (specificTypes) {
+ t2 = specificTypes[0]
+ tParam = specificTypes.size() > 1 ? "<" + specificTypes[1] + ">" : ""
+ }
def parameters = getCSharpParamString(javaMethod)
def paramNames = getParamNames(javaMethod.parameters)
return ["methodName": javaMethod.name, "t1":t1, "t2":t2, "tParam":tParam, "parameters":parameters, "paramNames":paramNames]
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ab2fd2ca/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 601e381..45d55f5 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -76,17 +76,6 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the addE step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , Edge > AddE (Direction direction, string firstVertexKeyOrEdgeLabel, string edgeLabelOrSecondVertexKey, params object[] propertyKeyValues)
- {
- var args = new List<object>(3 + propertyKeyValues.Length) {direction, firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey};
- args.AddRange(propertyKeyValues);
- Bytecode.AddStep("addE", args.ToArray());
- return Wrap< S , Edge >(this);
- }
-
- /// <summary>
- /// Adds the addE step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
public GraphTraversal< S , Edge > AddE (string edgeLabel)
{
Bytecode.AddStep("addE", edgeLabel);
@@ -94,24 +83,11 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
- /// Adds the addInE step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal< S , Edge > AddInE (string firstVertexKeyOrEdgeLabel, string edgeLabelOrSecondVertexKey, params object[] propertyKeyValues)
- {
- var args = new List<object>(2 + propertyKeyValues.Length) {firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey};
- args.AddRange(propertyKeyValues);
- Bytecode.AddStep("addInE", args.ToArray());
- return Wrap< S , Edge >(this);
- }
-
- /// <summary>
- /// Adds the addOutE step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// Adds the addE step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , Edge > AddOutE (string firstVertexKeyOrEdgeLabel, string edgeLabelOrSecondVertexKey, params object[] propertyKeyValues)
+ public GraphTraversal< S , Edge > AddE (ITraversal edgeLabelTraversal)
{
- var args = new List<object>(2 + propertyKeyValues.Length) {firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey};
- args.AddRange(propertyKeyValues);
- Bytecode.AddStep("addOutE", args.ToArray());
+ Bytecode.AddStep("addE", edgeLabelTraversal);
return Wrap< S , Edge >(this);
}
@@ -127,20 +103,18 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the addV step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , Vertex > AddV (params object[] propertyKeyValues)
+ public GraphTraversal< S , Vertex > AddV (string vertexLabel)
{
- var args = new List<object>(0 + propertyKeyValues.Length) {};
- args.AddRange(propertyKeyValues);
- Bytecode.AddStep("addV", args.ToArray());
+ Bytecode.AddStep("addV", vertexLabel);
return Wrap< S , Vertex >(this);
}
/// <summary>
/// Adds the addV step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , Vertex > AddV (string vertexLabel)
+ public GraphTraversal< S , Vertex > AddV (ITraversal vertexLabelTraversal)
{
- Bytecode.AddStep("addV", vertexLabel);
+ Bytecode.AddStep("addV", vertexLabelTraversal);
return Wrap< S , Vertex >(this);
}
@@ -584,6 +558,15 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
+ /// Adds the from step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
+ public GraphTraversal< S , E > From (Vertex fromVertex)
+ {
+ Bytecode.AddStep("from", fromVertex);
+ return Wrap< S , E >(this);
+ }
+
+ /// <summary>
/// Adds the group step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
public GraphTraversal< S , IDictionary<K, V> > Group<K, V> ()
@@ -620,24 +603,6 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
- /// Adds the groupV3d0 step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal< S , IDictionary<K, V> > GroupV3d0<K, V> ()
- {
- Bytecode.AddStep("groupV3d0");
- return Wrap< S , IDictionary<K, V> >(this);
- }
-
- /// <summary>
- /// Adds the groupV3d0 step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal< S , E > GroupV3d0 (string sideEffectKey)
- {
- Bytecode.AddStep("groupV3d0", sideEffectKey);
- return Wrap< S , E >(this);
- }
-
- /// <summary>
/// Adds the has step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
public GraphTraversal< S , E > Has (string propertyKey)
@@ -915,10 +880,10 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the limit step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E > Limit (long limit)
+ public GraphTraversal< S , E2 > Limit<E2> (long limit)
{
Bytecode.AddStep("limit", limit);
- return Wrap< S , E >(this);
+ return Wrap< S , E2 >(this);
}
/// <summary>
@@ -958,24 +923,6 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
- /// Adds the mapKeys step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal< S , E2 > MapKeys<E2> ()
- {
- Bytecode.AddStep("mapKeys");
- return Wrap< S , E2 >(this);
- }
-
- /// <summary>
- /// Adds the mapValues step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal< S , E2 > MapValues<E2> ()
- {
- Bytecode.AddStep("mapValues");
- return Wrap< S , E2 >(this);
- }
-
- /// <summary>
/// Adds the match step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
public GraphTraversal< S , IDictionary<string, E2> > Match<E2> (params ITraversal[] matchTraversals)
@@ -987,6 +934,15 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
+ /// Adds the math step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
+ public GraphTraversal< S , double > Math (string expression)
+ {
+ Bytecode.AddStep("math", expression);
+ return Wrap< S , double >(this);
+ }
+
+ /// <summary>
/// Adds the max step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
public GraphTraversal< S , E2 > Max<E2> ()
@@ -1275,10 +1231,10 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the range step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E > Range (long low, long high)
+ public GraphTraversal< S , E2 > Range<E2> (long low, long high)
{
Bytecode.AddStep("range", low, high);
- return Wrap< S , E >(this);
+ return Wrap< S , E2 >(this);
}
/// <summary>
@@ -1309,15 +1265,6 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
- /// Adds the sack step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal< S , E > Sack (object sackOperator, string elementPropertyKey)
- {
- Bytecode.AddStep("sack", sackOperator, elementPropertyKey);
- return Wrap< S , E >(this);
- }
-
- /// <summary>
/// Adds the sample step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
public GraphTraversal< S , E > Sample (Scope scope, int amountToSample)
@@ -1412,6 +1359,24 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
+ /// Adds the skip step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
+ public GraphTraversal< S , E2 > Skip<E2> (Scope scope, long skip)
+ {
+ Bytecode.AddStep("skip", scope, skip);
+ return Wrap< S , E2 >(this);
+ }
+
+ /// <summary>
+ /// Adds the skip step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
+ public GraphTraversal< S , E2 > Skip<E2> (long skip)
+ {
+ Bytecode.AddStep("skip", skip);
+ return Wrap< S , E2 >(this);
+ }
+
+ /// <summary>
/// Adds the store step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
public GraphTraversal< S , E > Store (string sideEffectKey)
@@ -1450,10 +1415,10 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the tail step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E > Tail ()
+ public GraphTraversal< S , E2 > Tail<E2> ()
{
Bytecode.AddStep("tail");
- return Wrap< S , E >(this);
+ return Wrap< S , E2 >(this);
}
/// <summary>
@@ -1477,10 +1442,10 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the tail step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E > Tail (long limit)
+ public GraphTraversal< S , E2 > Tail<E2> (long limit)
{
Bytecode.AddStep("tail", limit);
- return Wrap< S , E >(this);
+ return Wrap< S , E2 >(this);
}
/// <summary>
@@ -1531,6 +1496,15 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
+ /// Adds the to step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
+ public GraphTraversal< S , E > To (Vertex toVertex)
+ {
+ Bytecode.AddStep("to", toVertex);
+ return Wrap< S , E >(this);
+ }
+
+ /// <summary>
/// Adds the toE step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
public GraphTraversal< S , Edge > ToE (Direction direction, params string[] edgeLabels)
@@ -1618,23 +1592,23 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Adds the valueMap step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , IDictionary<string, E2> > ValueMap<E2> (params string[] propertyKeys)
+ public GraphTraversal< S , IDictionary<TKey, TValue> > ValueMap<TKey, TValue> (params string[] propertyKeys)
{
var args = new List<object>(0 + propertyKeys.Length) {};
args.AddRange(propertyKeys);
Bytecode.AddStep("valueMap", args.ToArray());
- return Wrap< S , IDictionary<string, E2> >(this);
+ return Wrap< S , IDictionary<TKey, TValue> >(this);
}
/// <summary>
/// Adds the valueMap step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , IDictionary<string, E2> > ValueMap<E2> (bool includeTokens, params string[] propertyKeys)
+ public GraphTraversal< S , IDictionary<TKey, TValue> > ValueMap<TKey, TValue> (bool includeTokens, params string[] propertyKeys)
{
var args = new List<object>(1 + propertyKeys.Length) {includeTokens};
args.AddRange(propertyKeys);
Bytecode.AddStep("valueMap", args.ToArray());
- return Wrap< S , IDictionary<string, E2> >(this);
+ return Wrap< S , IDictionary<TKey, TValue> >(this);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ab2fd2ca/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
index 63ef48e..9453505 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
@@ -210,37 +210,35 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addV step to that
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addE step to that
/// traversal.
/// </summary>
- public GraphTraversal< Vertex,Vertex > AddV()
+ public GraphTraversal< Edge,Edge > AddE(string label)
{
- var traversal = new GraphTraversal< Vertex,Vertex >(TraversalStrategies, new Bytecode(Bytecode));
- traversal.Bytecode.AddStep("addV");
+ var traversal = new GraphTraversal< Edge,Edge >(TraversalStrategies, new Bytecode(Bytecode));
+ traversal.Bytecode.AddStep("addE", label);
return traversal;
}
/// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addV step to that
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addE step to that
/// traversal.
/// </summary>
- public GraphTraversal< Vertex,Vertex > AddV(params object[] keyValues)
+ public GraphTraversal< Edge,Edge > AddE(ITraversal edgeLabelTraversal)
{
- var traversal = new GraphTraversal< Vertex,Vertex >(TraversalStrategies, new Bytecode(Bytecode));
- var args = new List<object>(0 + keyValues.Length) {};
- args.AddRange(keyValues);
- traversal.Bytecode.AddStep("addV", args.ToArray());
+ var traversal = new GraphTraversal< Edge,Edge >(TraversalStrategies, new Bytecode(Bytecode));
+ traversal.Bytecode.AddStep("addE", edgeLabelTraversal);
return traversal;
}
/// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addE step to that
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addV step to that
/// traversal.
/// </summary>
- public GraphTraversal< Edge,Edge > AddE(params object[] args)
+ public GraphTraversal< Vertex,Vertex > AddV()
{
- var traversal = new GraphTraversal< Edge,Edge >(TraversalStrategies, new Bytecode(Bytecode));
- traversal.Bytecode.AddStep("addE", args);
+ var traversal = new GraphTraversal< Vertex,Vertex >(TraversalStrategies, new Bytecode(Bytecode));
+ traversal.Bytecode.AddStep("addV");
return traversal;
}
@@ -255,6 +253,17 @@ namespace Gremlin.Net.Process.Traversal
return traversal;
}
+ /// <summary>
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addV step to that
+ /// traversal.
+ /// </summary>
+ public GraphTraversal< Vertex,Vertex > AddV(ITraversal vertexLabelTraversal)
+ {
+ var traversal = new GraphTraversal< Vertex,Vertex >(TraversalStrategies, new Bytecode(Bytecode));
+ traversal.Bytecode.AddStep("addV", vertexLabelTraversal);
+ return traversal;
+ }
+
}
#pragma warning restore 1591
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ab2fd2ca/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 c9ced7b..bcb400a 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
@@ -53,39 +53,17 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the addE step to that traversal.
/// </summary>
- public static GraphTraversal<object, Edge> AddE(Direction direction, string firstVertexKeyOrEdgeLabel, string edgeLabelOrSecondVertexKey, params object[] propertyKeyValues)
- {
- return propertyKeyValues.Length == 0
- ? new GraphTraversal<object, Edge>().AddE(direction, firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey)
- : new GraphTraversal<object, Edge>().AddE(direction, firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey, propertyKeyValues);
- }
-
- /// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the addE step to that traversal.
- /// </summary>
public static GraphTraversal<object, Edge> AddE(string edgeLabel)
{
return new GraphTraversal<object, Edge>().AddE(edgeLabel);
}
/// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the addInE step to that traversal.
- /// </summary>
- public static GraphTraversal<object, Edge> AddInE(string firstVertexKeyOrEdgeLabel, string edgeLabelOrSecondVertexKey, params object[] propertyKeyValues)
- {
- return propertyKeyValues.Length == 0
- ? new GraphTraversal<object, Edge>().AddInE(firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey)
- : new GraphTraversal<object, Edge>().AddInE(firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey, propertyKeyValues);
- }
-
- /// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the addOutE step to that traversal.
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the addE step to that traversal.
/// </summary>
- public static GraphTraversal<object, Edge> AddOutE(string firstVertexKeyOrEdgeLabel, string edgeLabelOrSecondVertexKey, params object[] propertyKeyValues)
+ public static GraphTraversal<object, Edge> AddE(ITraversal edgeLabelTraversal)
{
- return propertyKeyValues.Length == 0
- ? new GraphTraversal<object, Edge>().AddOutE(firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey)
- : new GraphTraversal<object, Edge>().AddOutE(firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey, propertyKeyValues);
+ return new GraphTraversal<object, Edge>().AddE(edgeLabelTraversal);
}
/// <summary>
@@ -99,19 +77,17 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the addV step to that traversal.
/// </summary>
- public static GraphTraversal<object, Vertex> AddV(params object[] propertyKeyValues)
+ public static GraphTraversal<object, Vertex> AddV(string vertexLabel)
{
- return propertyKeyValues.Length == 0
- ? new GraphTraversal<object, Vertex>().AddV()
- : new GraphTraversal<object, Vertex>().AddV(propertyKeyValues);
+ return new GraphTraversal<object, Vertex>().AddV(vertexLabel);
}
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the addV step to that traversal.
/// </summary>
- public static GraphTraversal<object, Vertex> AddV(string vertexLabel)
+ public static GraphTraversal<object, Vertex> AddV(ITraversal vertexLabelTraversal)
{
- return new GraphTraversal<object, Vertex>().AddV(vertexLabel);
+ return new GraphTraversal<object, Vertex>().AddV(vertexLabelTraversal);
}
/// <summary>
@@ -451,22 +427,6 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the groupV3d0 step to that traversal.
- /// </summary>
- public static GraphTraversal<object, IDictionary<K, V>> GroupV3d0<K, V>()
- {
- return new GraphTraversal<object, IDictionary<K, V>>().GroupV3d0<K, V>();
- }
-
- /// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the groupV3d0 step to that traversal.
- /// </summary>
- public static GraphTraversal<object, object> GroupV3d0(string sideEffectKey)
- {
- return new GraphTraversal<object, object>().GroupV3d0(sideEffectKey);
- }
-
- /// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the has step to that traversal.
/// </summary>
public static GraphTraversal<object, object> Has(string propertyKey)
@@ -717,7 +677,7 @@ namespace Gremlin.Net.Process.Traversal
/// </summary>
public static GraphTraversal<object, E2> Limit<E2>(long limit)
{
- return new GraphTraversal<object, E2>().Limit(limit);
+ return new GraphTraversal<object, E2>().Limit<E2>(limit);
}
/// <summary>
@@ -753,22 +713,6 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the mapKeys step to that traversal.
- /// </summary>
- public static GraphTraversal<object, E2> MapKeys<E2>()
- {
- return new GraphTraversal<object, E2>().MapKeys<E2>();
- }
-
- /// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the mapValues step to that traversal.
- /// </summary>
- public static GraphTraversal<object, E2> MapValues<E2>()
- {
- return new GraphTraversal<object, E2>().MapValues<E2>();
- }
-
- /// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the match step to that traversal.
/// </summary>
public static GraphTraversal<object, IDictionary<string, E2>> Match<E2>(params ITraversal[] matchTraversals)
@@ -779,6 +723,14 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the math step to that traversal.
+ /// </summary>
+ public static GraphTraversal<object, double> Math(string expression)
+ {
+ return new GraphTraversal<object, double>().Math(expression);
+ }
+
+ /// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the max step to that traversal.
/// </summary>
public static GraphTraversal<object, E2> Max<E2>()
@@ -975,7 +927,7 @@ namespace Gremlin.Net.Process.Traversal
/// </summary>
public static GraphTraversal<object, E2> Range<E2>(long low, long high)
{
- return new GraphTraversal<object, E2>().Range(low, high);
+ return new GraphTraversal<object, E2>().Range<E2>(low, high);
}
/// <summary>
@@ -1003,14 +955,6 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
- /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the sack step to that traversal.
- /// </summary>
- public static GraphTraversal<object, object> Sack(object sackOperator, string elementPropertyKey)
- {
- return new GraphTraversal<object, object>().Sack(sackOperator, elementPropertyKey);
- }
-
- /// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the sample step to that traversal.
/// </summary>
public static GraphTraversal<object, object> Sample(Scope scope, int amountToSample)
@@ -1095,6 +1039,22 @@ namespace Gremlin.Net.Process.Traversal
}
/// <summary>
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the skip step to that traversal.
+ /// </summary>
+ public static GraphTraversal<object, E2> Skip<E2>(Scope scope, long skip)
+ {
+ return new GraphTraversal<object, E2>().Skip<E2>(scope, skip);
+ }
+
+ /// <summary>
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the skip step to that traversal.
+ /// </summary>
+ public static GraphTraversal<object, E2> Skip<E2>(long skip)
+ {
+ return new GraphTraversal<object, E2>().Skip<E2>(skip);
+ }
+
+ /// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the store step to that traversal.
/// </summary>
public static GraphTraversal<object, object> Store(string sideEffectKey)
@@ -1131,7 +1091,7 @@ namespace Gremlin.Net.Process.Traversal
/// </summary>
public static GraphTraversal<object, E2> Tail<E2>()
{
- return new GraphTraversal<object, E2>().Tail();
+ return new GraphTraversal<object, E2>().Tail<E2>();
}
/// <summary>
@@ -1155,7 +1115,7 @@ namespace Gremlin.Net.Process.Traversal
/// </summary>
public static GraphTraversal<object, E2> Tail<E2>(long limit)
{
- return new GraphTraversal<object, E2>().Tail(limit);
+ return new GraphTraversal<object, E2>().Tail<E2>(limit);
}
/// <summary>
@@ -1263,21 +1223,21 @@ namespace Gremlin.Net.Process.Traversal
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the valueMap step to that traversal.
/// </summary>
- public static GraphTraversal<object, IDictionary<string, E2>> ValueMap<E2>(params string[] propertyKeys)
+ public static GraphTraversal<object, IDictionary<TKey, TValue>> ValueMap<TKey, TValue>(params string[] propertyKeys)
{
return propertyKeys.Length == 0
- ? new GraphTraversal<object, IDictionary<string, E2>>().ValueMap<E2>()
- : new GraphTraversal<object, IDictionary<string, E2>>().ValueMap<E2>(propertyKeys);
+ ? new GraphTraversal<object, IDictionary<TKey, TValue>>().ValueMap<TKey, TValue>()
+ : new GraphTraversal<object, IDictionary<TKey, TValue>>().ValueMap<TKey, TValue>(propertyKeys);
}
/// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the valueMap step to that traversal.
/// </summary>
- public static GraphTraversal<object, IDictionary<string, E2>> ValueMap<E2>(bool includeTokens, params string[] propertyKeys)
+ public static GraphTraversal<object, IDictionary<TKey, TValue>> ValueMap<TKey, TValue>(bool includeTokens, params string[] propertyKeys)
{
return propertyKeys.Length == 0
- ? new GraphTraversal<object, IDictionary<string, E2>>().ValueMap<E2>(includeTokens)
- : new GraphTraversal<object, IDictionary<string, E2>>().ValueMap<E2>(includeTokens, propertyKeys);
+ ? new GraphTraversal<object, IDictionary<TKey, TValue>>().ValueMap<TKey, TValue>(includeTokens)
+ : new GraphTraversal<object, IDictionary<TKey, TValue>>().ValueMap<TKey, TValue>(includeTokens, propertyKeys);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ab2fd2ca/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
index cdeecbf..406bbb6 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
@@ -135,7 +135,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
var g = graph.Traversal().WithRemote(connection);
var shortestPath =
- g.V(5).Repeat(__.Both().SimplePath()).Until(__.HasId(6)).Limit(1).Path().Next();
+ g.V(5).Repeat(__.Both().SimplePath()).Until(__.HasId(6)).Limit<Vertex>(1).Path().Next();
Assert.Equal(4, shortestPath.Count);
Assert.Equal(new Vertex((long) 6), shortestPath[3]);
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ab2fd2ca/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/BytecodeGraphSONSerializerTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/BytecodeGraphSONSerializerTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/BytecodeGraphSONSerializerTests.cs
index 8b87df6..ab7be13 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/BytecodeGraphSONSerializerTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/BytecodeGraphSONSerializerTests.cs
@@ -129,7 +129,7 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
public void ShouldSerializeBytecodeWithSourcesStep(int version)
{
var bytecode = new Bytecode();
- bytecode.AddSource("withSideEffect", "a", new List<string> {"josh", "peter"});
+ bytecode.AddSource("withSideEffect", "a", "josh");
bytecode.AddStep("V", 1);
bytecode.AddStep("values", "name");
bytecode.AddStep("where", new TraversalPredicate("within", "a"));
@@ -138,7 +138,7 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
var graphSON = graphsonWriter.WriteObject(bytecode);
var expectedGraphSon =
- "{\"@type\":\"g:Bytecode\",\"@value\":{\"source\":[[\"withSideEffect\",\"a\",[\"josh\",\"peter\"]]],\"step\":[[\"V\",{\"@type\":\"g:Int32\",\"@value\":1}],[\"values\",\"name\"],[\"where\",{\"@type\":\"g:P\",\"@value\":{\"predicate\":\"within\",\"value\":\"a\"}}]]}}";
+ "{\"@type\":\"g:Bytecode\",\"@value\":{\"source\":[[\"withSideEffect\",\"a\",\"josh\"]],\"step\":[[\"V\",{\"@type\":\"g:Int32\",\"@value\":1}],[\"values\",\"name\"],[\"where\",{\"@type\":\"g:P\",\"@value\":{\"predicate\":\"within\",\"value\":\"a\"}}]]}}";
Assert.Equal(expectedGraphSon, graphSON);
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ab2fd2ca/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 e620ea8..ca38555 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
@@ -372,10 +372,10 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
Assert.Equal(expected, graphSON);
}
- [Fact]
- public void ShouldSerializeTypeToItsObject()
+ [Theory, MemberData(nameof(Versions))]
+ public void ShouldSerializeTypeToItsObject(int version)
{
- var writer = CreateStandardGraphSONWriter();
+ var writer = CreateGraphSONWriter(version);
var type = typeof(SubgraphStrategy);
var graphSon = writer.WriteObject(type);