C# GLV: Generics and enum generation
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e2453a18 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e2453a18 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e2453a18 Branch: refs/heads/tp32 Commit: e2453a1802b3f0f91933e44d7ec5aa7b9a963c4b Parents: 852ff1f Author: Jorge Bay Gondra <[email protected]> Authored: Wed May 31 17:19:55 2017 +0200 Committer: Stephen Mallette <[email protected]> Committed: Wed Jun 28 15:13:11 2017 -0400 ---------------------------------------------------------------------- .../dotnet/AnonymousTraversalGenerator.groovy | 53 ++- .../gremlin/dotnet/EnumGenerator.groovy | 60 ++- .../dotnet/GraphTraversalGenerator.groovy | 40 +- .../dotnet/GraphTraversalSourceGenerator.groovy | 33 +- .../gremlin/dotnet/PredicateGenerator.groovy | 3 +- .../gremlin/dotnet/SymbolHelper.groovy | 58 +++ .../Driver/Remote/DriverRemoteConnection.cs | 4 +- .../Driver/Remote/DriverRemoteTraversal.cs | 2 +- .../Process/Remote/IRemoteConnection.cs | 2 +- .../Process/Remote/RemoteStrategy.cs | 6 +- .../Gremlin.Net/Process/Traversal/Barrier.cs | 2 +- .../Process/Traversal/Cardinality.cs | 6 +- .../src/Gremlin.Net/Process/Traversal/Column.cs | 4 +- .../Process/Traversal/DefaultTraversal.cs | 23 +- .../Gremlin.Net/Process/Traversal/Direction.cs | 6 +- .../Process/Traversal/GraphTraversal.cs | 408 ++++++++++--------- .../Process/Traversal/GraphTraversalSource.cs | 22 +- .../Gremlin.Net/Process/Traversal/ITraversal.cs | 27 +- .../Process/Traversal/ITraversalStrategy.cs | 4 +- .../Process/Traversal/NamingConversions.cs | 86 ++++ .../Gremlin.Net/Process/Traversal/Operator.cs | 22 +- .../src/Gremlin.Net/Process/Traversal/Order.cs | 14 +- .../src/Gremlin.Net/Process/Traversal/P.cs | 2 +- .../src/Gremlin.Net/Process/Traversal/Pick.cs | 4 +- .../src/Gremlin.Net/Process/Traversal/Pop.cs | 6 +- .../src/Gremlin.Net/Process/Traversal/Scope.cs | 4 +- .../Strategy/AbstractTraversalStrategy.cs | 4 +- .../src/Gremlin.Net/Process/Traversal/T.cs | 8 +- .../src/Gremlin.Net/Process/Traversal/__.cs | 373 ++++++++--------- .../Structure/IO/GraphSON/EnumSerializer.cs | 5 +- .../Process/Remote/RemoteStrategyTests.cs | 6 +- .../BytecodeGeneration/StrategiesTests.cs | 6 +- .../DriverRemoteConnection/EnumTests.cs | 6 +- .../GraphTraversalSourceTests.cs | 4 +- .../GraphTraversalTests.cs | 13 +- .../DriverRemoteConnection/SideEffectTests.cs | 4 +- .../DriverRemoteConnection/StrategiesTests.cs | 6 +- .../Process/Traversal/TestTraversal.cs | 4 +- .../Process/Traversal/TestTraversalStrategy.cs | 6 +- .../GraphSON/BytecodeGraphSONSerializerTests.cs | 4 +- .../IO/GraphSON/GraphSONWriterTests.cs | 9 +- 41 files changed, 808 insertions(+), 551 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/AnonymousTraversalGenerator.groovy ---------------------------------------------------------------------- diff --git a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/AnonymousTraversalGenerator.groovy b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/AnonymousTraversalGenerator.groovy index ca5fadb..b65b2b0 100644 --- a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/AnonymousTraversalGenerator.groovy +++ b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/AnonymousTraversalGenerator.groovy @@ -26,43 +26,70 @@ import java.lang.reflect.Modifier class AnonymousTraversalGenerator { + private static final Map<String, String[]> METHODS_WITH_SPECIFIC_TYPES = new HashMap<>(); + + static { + String[] useE2 = ["E2", "E2"]; + METHODS_WITH_SPECIFIC_TYPES.put("constant", useE2); + METHODS_WITH_SPECIFIC_TYPES.put("limit", useE2); + METHODS_WITH_SPECIFIC_TYPES.put("mean", useE2); + METHODS_WITH_SPECIFIC_TYPES.put("optional", useE2); + METHODS_WITH_SPECIFIC_TYPES.put("range", useE2); + METHODS_WITH_SPECIFIC_TYPES.put("select", ["IDictionary<string, E2>", "E2"] as String[]); + METHODS_WITH_SPECIFIC_TYPES.put("sum", useE2); + METHODS_WITH_SPECIFIC_TYPES.put("tail", useE2); + METHODS_WITH_SPECIFIC_TYPES.put("tree", ["object"] as String[]); + METHODS_WITH_SPECIFIC_TYPES.put("unfold", useE2); + } + public static void create(final String anonymousTraversalFile) { + final StringBuilder csharpClass = new StringBuilder() csharpClass.append(CommonContentHelper.getLicense()) csharpClass.append( """ +using System.Collections.Generic; +using Gremlin.Net.Structure; + namespace Gremlin.Net.Process.Traversal { public static class __ { - public static GraphTraversal Start() + public static GraphTraversal<object, object> Start() { - return new GraphTraversal(); + return new GraphTraversal<object, object>(); } """) __.getMethods(). findAll { GraphTraversal.class.equals(it.returnType) }. findAll { Modifier.isStatic(it.getModifiers()) }. - collect { it.name }. - findAll { !it.equals("__") && !it.equals("start") }. - unique(). - sort { a, b -> a <=> b }. - forEach { javaMethodName -> - String sharpMethodName = SymbolHelper.toCSharp(javaMethodName) - + findAll { !it.name.equals("__") && !it.name.equals("start") }. + groupBy { it.name }. + // Select unique by name, with the most amount of parameters + collect { it.value.sort { a, b -> b.parameterCount <=> a.parameterCount }.first() }. + sort { it.name }. + forEach { javaMethod -> + String sharpMethodName = SymbolHelper.toCSharp(javaMethod.name); + String[] typeNames = SymbolHelper.getJavaParameterTypeNames(javaMethod); + def t2 = SymbolHelper.toCSharpType(typeNames[1]); + def tParam = SymbolHelper.getCSharpGenericTypeParam(t2); + def specificTypes = METHODS_WITH_SPECIFIC_TYPES.get(javaMethod.name); + if (specificTypes) { + t2 = specificTypes[0]; + tParam = specificTypes.length > 1 ? "<" + specificTypes[1] + ">" : ""; + } csharpClass.append( """ - public static GraphTraversal ${sharpMethodName}(params object[] args) + public static GraphTraversal<object, $t2> $sharpMethodName$tParam(params object[] args) { - return new GraphTraversal().${sharpMethodName}(args); + return new GraphTraversal<object, object>().$sharpMethodName$tParam(args); } """) } - csharpClass.append("\t}\n") - csharpClass.append("}") + csharpClass.append(" }\n}") final File file = new File(anonymousTraversalFile); file.delete() http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/EnumGenerator.groovy ---------------------------------------------------------------------- diff --git a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/EnumGenerator.groovy b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/EnumGenerator.groovy index 799e001..840b604 100644 --- a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/EnumGenerator.groovy +++ b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/EnumGenerator.groovy @@ -20,20 +20,66 @@ package org.apache.tinkerpop.gremlin.dotnet import org.apache.tinkerpop.gremlin.util.CoreImports +import org.apache.tinkerpop.gremlin.structure.Direction class EnumGenerator { public static void create(final String enumDirectory) { + Map<String, String> enumCSharpToJavaNames = new HashMap<String, String>(); for (final Class<? extends Enum> enumClass : CoreImports.getClassImports() .findAll { Enum.class.isAssignableFrom(it) } .sort { a, b -> a.getSimpleName() <=> b.getSimpleName() } .collect()) { - createEnum(enumDirectory, enumClass) + createEnum(enumDirectory, enumClass, enumCSharpToJavaNames) } + + // Write a file containing the equivalence in names between Java and C# + final String enumCSharpToJavaFile = "$enumDirectory/NamingConversions.cs" + final File file = new File(enumCSharpToJavaFile); + file.delete(); + file.append(CommonContentHelper.getLicense()); + file.append(""" +using System.Collections.Generic; + +namespace Gremlin.Net.Process.Traversal +{ + internal static class NamingConversions + { + /// <summary> + /// Gets the Java name equivalent for a given enum value + /// </summary> + internal static string GetEnumJavaName(string typeName, string value) + { + var key = \$"{typeName}.{value}"; + string javaName; + if (!CSharpToJavaEnums.TryGetValue(key, out javaName)) + { + throw new KeyNotFoundException(\$"Java name for {key} not found"); + } + return javaName; + } + + internal static readonly IDictionary<string, string> CSharpToJavaEnums = new Dictionary<string, string> + { +""" ); + def lastIndex = (enumCSharpToJavaNames.size() - 1); + enumCSharpToJavaNames.eachWithIndex{ node, i -> + file.append(""" {"$node.key", "$node.value"}${i == lastIndex ? "" : ","}\n""") + } + file.append(" };\n }\n}"); + + } + + public static String toCSharpName(final Class<? extends Enum> enumClass, String itemName) { + if (enumClass.equals(Direction.class)) { + itemName = itemName.toLowerCase(); + } + return itemName.substring(0, 1).toUpperCase() + itemName.substring(1); } - private static void createEnum(final String enumDirectory, final Class<? extends Enum> enumClass){ + private static void createEnum(final String enumDirectory, final Class<? extends Enum> enumClass, + final Map<String, String> csharpToJava) { final StringBuilder csharpEnum = new StringBuilder() csharpEnum.append(CommonContentHelper.getLicense()) @@ -45,9 +91,13 @@ namespace Gremlin.Net.Process.Traversal public enum ${enumClass.getSimpleName()} { """) - enumClass.getEnumConstants() - .sort { a, b -> a.name() <=> b.name() } - .each { value -> csharpEnum.append(" ${value.name()},\n"); } + enumClass.getEnumConstants(). + sort { a, b -> a.name() <=> b.name() }. + each { value -> + def csharpName = toCSharpName(enumClass, value.name()); + csharpEnum.append(" $csharpName,\n"); + csharpToJava.put(enumClass.simpleName + "." + csharpName, value.name()); + } csharpEnum.deleteCharAt(csharpEnum.length() - 2) csharpEnum.append(" }\n") http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/GraphTraversalGenerator.groovy ---------------------------------------------------------------------- diff --git a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/GraphTraversalGenerator.groovy b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/GraphTraversalGenerator.groovy index 58a3991..d3bade5 100644 --- a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/GraphTraversalGenerator.groovy +++ b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/GraphTraversalGenerator.groovy @@ -32,10 +32,11 @@ class GraphTraversalGenerator { csharpClass.append( """ using System.Collections.Generic; +using Gremlin.Net.Structure; namespace Gremlin.Net.Process.Traversal { - public class GraphTraversal : DefaultTraversal + public class GraphTraversal<S, E> : DefaultTraversal<S, E> { public GraphTraversal() : this(new List<ITraversalStrategy>(), new Bytecode()) @@ -47,27 +48,40 @@ namespace Gremlin.Net.Process.Traversal TraversalStrategies = traversalStrategies; Bytecode = bytecode; } + + private static GraphTraversal<S2, E2> Wrap<S2, E2>(GraphTraversal<S, E> traversal) + { + if (typeof(S2) == typeof(S) && typeof(E2) == typeof(E)) + { + return traversal as GraphTraversal<S2, E2>; + } + // New wrapper + return new GraphTraversal<S2, E2>(traversal.TraversalStrategies, traversal.Bytecode); + } + """) 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 { javaMethodName -> - String sharpMethodName = SymbolHelper.toCSharp(javaMethodName) - + groupBy { it.name }. + // Select unique by name, with the most amount of parameters + collect { it.value.sort { a, b -> b.parameterCount <=> a.parameterCount }.first() }. + sort { it.name }. + forEach { javaMethod -> + String[] typeNames = SymbolHelper.getJavaParameterTypeNames(javaMethod); + def t1 = SymbolHelper.toCSharpType(typeNames[0]); + def t2 = SymbolHelper.toCSharpType(typeNames[1]); + def tParam = SymbolHelper.getCSharpGenericTypeParam(t2); csharpClass.append( - """ - public GraphTraversal ${sharpMethodName}(params object[] args) +""" + public GraphTraversal<$t1, $t2> ${SymbolHelper.toCSharp(javaMethod.name)}$tParam(params object[] args) { - Bytecode.AddStep("${javaMethodName}", args); - return this; + Bytecode.AddStep("$javaMethod.name", args); + return Wrap<$t1, $t2>(this); } """) } - csharpClass.append("\t}\n") - csharpClass.append("}") + csharpClass.append(" }\n}") final File file = new File(graphTraversalFile); file.delete() http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/GraphTraversalSourceGenerator.groovy ---------------------------------------------------------------------- diff --git a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/GraphTraversalSourceGenerator.groovy b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/GraphTraversalSourceGenerator.groovy index fce4b70..7cb41da 100644 --- a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/GraphTraversalSourceGenerator.groovy +++ b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/GraphTraversalSourceGenerator.groovy @@ -21,7 +21,7 @@ package org.apache.tinkerpop.gremlin.dotnet import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource - +import java.lang.reflect.* class GraphTraversalSourceGenerator { @@ -36,6 +36,7 @@ class GraphTraversalSourceGenerator { using System.Collections.Generic; using Gremlin.Net.Process.Remote; using Gremlin.Net.Process.Traversal.Strategy.Decoration; +using Gremlin.Net.Structure; namespace Gremlin.Net.Process.Traversal { @@ -57,9 +58,6 @@ namespace Gremlin.Net.Process.Traversal """ ) - // Hold the list of methods with their overloads, so we do not create duplicates - HashMap<String, ArrayList<String>> sharpMethods = new HashMap<String, ArrayList<String>>() - GraphTraversalSource.getMethods(). // SOURCE STEPS findAll { GraphTraversalSource.class.equals(it.returnType) }. findAll { @@ -110,27 +108,32 @@ namespace Gremlin.Net.Process.Traversal } """) - GraphTraversalSource.getMethods(). // SPAWN STEPS + GraphTraversalSource.getMethods(). findAll { GraphTraversal.class.equals(it.returnType) }. - collect { it.name }. - unique(). - sort { a, b -> a <=> b }. - forEach { javaMethodName -> - String sharpMethodName = SymbolHelper.toCSharp(javaMethodName) + unique{ a -> a.name }. + sort { a, b -> a.name <=> b.name }. + forEach { javaMethod -> + String sharpMethodName = SymbolHelper.toCSharp(javaMethod.name); + Type[] typeArguments = ((ParameterizedType)javaMethod.getGenericReturnType()).actualTypeArguments; + if (typeArguments.length != 2 || !(typeArguments[0] instanceof Class)) { + return; + } + def returnType = """GraphTraversal<${ + ((Class)typeArguments[0]).getSimpleName()}, ${((Class)typeArguments[1]).getSimpleName()}>"""; + csharpClass.append( """ - public GraphTraversal ${sharpMethodName}(params object[] args) + public ${returnType} ${sharpMethodName}(params object[] args) { - var traversal = new GraphTraversal(TraversalStrategies, new Bytecode(Bytecode)); - traversal.Bytecode.AddStep("${javaMethodName}\", args); + var traversal = new ${returnType}(TraversalStrategies, new Bytecode(Bytecode)); + traversal.Bytecode.AddStep("${javaMethod.name}\", args); return traversal; } """) } - csharpClass.append("\t}\n") - csharpClass.append("}") + csharpClass.append(" }\n}") final File file = new File(graphTraversalSourceFile); file.delete() http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/PredicateGenerator.groovy ---------------------------------------------------------------------- diff --git a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/PredicateGenerator.groovy b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/PredicateGenerator.groovy index 2633de6..c5c9c10 100644 --- a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/PredicateGenerator.groovy +++ b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/PredicateGenerator.groovy @@ -55,8 +55,7 @@ namespace Gremlin.Net.Process.Traversal } """) } - csharpClass.append("\t}\n") - csharpClass.append("}") + csharpClass.append(" }\n}") final File file = new File(predicateFile) file.delete() http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/SymbolHelper.groovy ---------------------------------------------------------------------- diff --git a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/SymbolHelper.groovy b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/SymbolHelper.groovy index 6c237e8..c041062 100644 --- a/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/SymbolHelper.groovy +++ b/gremlin-dotnet-generator/src/main/groovy/org/apache/tinkerpop/gremlin/dotnet/SymbolHelper.groovy @@ -19,8 +19,29 @@ package org.apache.tinkerpop.gremlin.dotnet +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; + public final class SymbolHelper { + private static final Map<String, String> TO_CSHARP_TYPE_MAP = new HashMap<>(); + + static { + TO_CSHARP_TYPE_MAP.put("Long", "long"); + TO_CSHARP_TYPE_MAP.put("Integer", "int"); + TO_CSHARP_TYPE_MAP.put("String", "string"); + TO_CSHARP_TYPE_MAP.put("Object", "object"); + TO_CSHARP_TYPE_MAP.put("java.util.Map<java.lang.String, E2>", "IDictionary<string, E2>"); + TO_CSHARP_TYPE_MAP.put("java.util.Map<java.lang.String, B>", "IDictionary<string, E2>") + TO_CSHARP_TYPE_MAP.put("java.util.List<E>", "IList<E>"); + TO_CSHARP_TYPE_MAP.put("java.util.List<A>", "IList<object>"); + TO_CSHARP_TYPE_MAP.put("java.util.Map<K, V>", "IDictionary<K, V>"); + TO_CSHARP_TYPE_MAP.put("java.util.Collection<E2>", "ICollection<E2>"); + TO_CSHARP_TYPE_MAP.put("java.util.Collection<B>", "ICollection<E2>") + TO_CSHARP_TYPE_MAP.put("java.util.Map<K, java.lang.Long>", "IDictionary<K, long>"); + TO_CSHARP_TYPE_MAP.put("TraversalMetrics", "E2"); + } + public static String toCSharp(final String symbol) { return (String) Character.toUpperCase(symbol.charAt(0)) + symbol.substring(1) } @@ -28,4 +49,41 @@ public final class SymbolHelper { public static String toJava(final String symbol) { return (String) Character.toLowerCase(symbol.charAt(0)) + symbol.substring(1) } + + public static String toCSharpType(final String name) { + String typeName = TO_CSHARP_TYPE_MAP.getOrDefault(name, name); + if (typeName.equals(name) && (typeName.contains("? extends") || typeName.equals("Tree"))) { + typeName = "E2"; + } + return typeName; + } + + public static String[] getJavaParameterTypeNames(final Method method) { + def typeArguments = ((ParameterizedType)method.genericReturnType).actualTypeArguments; + return typeArguments. + collect { (it instanceof Class) ? ((Class)it).simpleName : it.typeName }. + collect { name -> + if (name.equals("A")) { + name = "object"; + } + else if (name.equals("B")) { + name = "E2"; + } + name; + }; + } + + public static String getCSharpGenericTypeParam(String typeName) { + def tParam = ""; + if (typeName.contains("E2")) { + tParam = "<E2>"; + } + else if (typeName.contains("<K, V>")) { + tParam = "<K, V>"; + } + else if (typeName.contains("<K, ")) { + tParam = "<K>"; + } + return tParam; + } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteConnection.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteConnection.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteConnection.cs index 2ba5d6c..0a8b93f 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteConnection.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteConnection.cs @@ -52,11 +52,11 @@ namespace Gremlin.Net.Driver.Remote /// </summary> /// <param name="bytecode">The <see cref="Bytecode" /> to submit.</param> /// <returns>A <see cref="ITraversal" /> allowing to access the results and side-effects.</returns> - public async Task<ITraversal> SubmitAsync(Bytecode bytecode) + public async Task<ITraversal<S, E>> SubmitAsync<S, E>(Bytecode bytecode) { var requestId = Guid.NewGuid(); var resultSet = await SubmitBytecodeAsync(requestId, bytecode).ConfigureAwait(false); - return new DriverRemoteTraversal(_client, requestId, resultSet); + return new DriverRemoteTraversal<S, E>(_client, requestId, resultSet); } private async Task<IEnumerable<Traverser>> SubmitBytecodeAsync(Guid requestid, Bytecode bytecode) http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversal.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversal.cs index f3f26d1..5ce835f 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversal.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversal.cs @@ -27,7 +27,7 @@ using Gremlin.Net.Process.Traversal; namespace Gremlin.Net.Driver.Remote { - internal class DriverRemoteTraversal : DefaultTraversal + internal class DriverRemoteTraversal<S, E> : DefaultTraversal<S, E> { public DriverRemoteTraversal(IGremlinClient gremlinClient, Guid requestId, IEnumerable<Traverser> traversers) http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Remote/IRemoteConnection.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Remote/IRemoteConnection.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Remote/IRemoteConnection.cs index 8555cb3..5393bcb 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Remote/IRemoteConnection.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Remote/IRemoteConnection.cs @@ -37,6 +37,6 @@ namespace Gremlin.Net.Process.Remote /// </summary> /// <param name="bytecode">The <see cref="Bytecode" /> to send.</param> /// <returns>The <see cref="ITraversal" /> with the results and optional side-effects.</returns> - Task<ITraversal> SubmitAsync(Bytecode bytecode); + Task<ITraversal<S, E>> SubmitAsync<S, E>(Bytecode bytecode); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Remote/RemoteStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Remote/RemoteStrategy.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Remote/RemoteStrategy.cs index 4826113..b3f8c44 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Remote/RemoteStrategy.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Remote/RemoteStrategy.cs @@ -44,16 +44,16 @@ namespace Gremlin.Net.Process.Remote } /// <inheritdoc /> - public void Apply(ITraversal traversal) + public void Apply<S, E>(ITraversal<S, E> traversal) { ApplyAsync(traversal).Wait(); } /// <inheritdoc /> - public async Task ApplyAsync(ITraversal traversal) + public async Task ApplyAsync<S, E>(ITraversal<S, E> traversal) { if (traversal.Traversers != null) return; - var remoteTraversal = await _remoteConnection.SubmitAsync(traversal.Bytecode).ConfigureAwait(false); + var remoteTraversal = await _remoteConnection.SubmitAsync<S, E>(traversal.Bytecode).ConfigureAwait(false); traversal.SideEffects = remoteTraversal.SideEffects; traversal.Traversers = remoteTraversal.Traversers; } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs index 13d1796..6ef1d4f 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Barrier.cs @@ -25,6 +25,6 @@ namespace Gremlin.Net.Process.Traversal { public enum Barrier { - normSack + NormSack } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs index f2365c3..b158d09 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Cardinality.cs @@ -25,8 +25,8 @@ namespace Gremlin.Net.Process.Traversal { public enum Cardinality { - list, - set, - single + List, + Set, + Single } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs index ee591da..0f3556c 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Column.cs @@ -25,7 +25,7 @@ namespace Gremlin.Net.Process.Traversal { public enum Column { - keys, - values + Keys, + Values } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs index 86c636c..2652df3 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs @@ -22,6 +22,7 @@ #endregion using System; +using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; @@ -30,7 +31,7 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// A traversal represents a directed walk over a graph. /// </summary> - public abstract class DefaultTraversal : ITraversal + public abstract class DefaultTraversal<S, E> : ITraversal<S, E> { private IEnumerator<Traverser> _traverserEnumerator; @@ -85,7 +86,9 @@ namespace Gremlin.Net.Process.Traversal } /// <inheritdoc /> - public object Current => TraverserEnumerator.Current?.Object; + public E Current => (E)TraverserEnumerator.Current?.Object; + + object IEnumerator.Current => Current; private IEnumerator<Traverser> GetTraverserEnumerator() { @@ -110,7 +113,7 @@ namespace Gremlin.Net.Process.Traversal /// Gets the next result from the traversal. /// </summary> /// <returns>The result.</returns> - public object Next() + public E Next() { MoveNext(); return Current; @@ -121,7 +124,7 @@ namespace Gremlin.Net.Process.Traversal /// </summary> /// <param name="amount">The number of results to get.</param> /// <returns>The n-results.</returns> - public IEnumerable<object> Next(int amount) + public IEnumerable<E> Next(int amount) { for (var i = 0; i < amount; i++) yield return Next(); @@ -131,7 +134,7 @@ namespace Gremlin.Net.Process.Traversal /// Iterates all <see cref="Traverser" /> instances in the traversal. /// </summary> /// <returns>The fully drained traversal.</returns> - public ITraversal Iterate() + public ITraversal<S, E> Iterate() { while (MoveNext()) { @@ -153,9 +156,9 @@ namespace Gremlin.Net.Process.Traversal /// Puts all the results into a <see cref="List{T}" />. /// </summary> /// <returns>The results in a list.</returns> - public List<object> ToList() + public IList<E> ToList() { - var objs = new List<object>(); + var objs = new List<E>(); while (MoveNext()) objs.Add(Current); return objs; @@ -165,9 +168,9 @@ namespace Gremlin.Net.Process.Traversal /// Puts all the results into a <see cref="HashSet{T}" />. /// </summary> /// <returns>The results in a set.</returns> - public HashSet<object> ToSet() + public ISet<E> ToSet() { - var objs = new HashSet<object>(); + var objs = new HashSet<E>(); while (MoveNext()) objs.Add(Current); return objs; @@ -186,7 +189,7 @@ namespace Gremlin.Net.Process.Traversal /// <typeparam name="TReturn">The return type of the <paramref name="callback" />.</typeparam> /// <param name="callback">The function to execute on the current traversal.</param> /// <returns>The result of the executed <paramref name="callback" />.</returns> - public async Task<TReturn> Promise<TReturn>(Func<ITraversal, TReturn> callback) + public async Task<TReturn> Promise<TReturn>(Func<ITraversal<S, E>, TReturn> callback) { await ApplyStrategiesAsync().ConfigureAwait(false); return callback(this); http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs index 413e11f..100296c 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Direction.cs @@ -25,8 +25,8 @@ namespace Gremlin.Net.Process.Traversal { public enum Direction { - BOTH, - IN, - OUT + Both, + In, + Out } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/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 88e9261..0f3fbb7 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs @@ -22,10 +22,11 @@ #endregion using System.Collections.Generic; +using Gremlin.Net.Structure; namespace Gremlin.Net.Process.Traversal { - public class GraphTraversal : DefaultTraversal + public class GraphTraversal<S, E> : DefaultTraversal<S, E> { public GraphTraversal() : this(new List<ITraversalStrategy>(), new Bytecode()) @@ -38,592 +39,603 @@ namespace Gremlin.Net.Process.Traversal Bytecode = bytecode; } - public GraphTraversal V(params object[] args) + private static GraphTraversal<S2, E2> Wrap<S2, E2>(GraphTraversal<S, E> traversal) + { + if (typeof(S2) == typeof(S) && typeof(E2) == typeof(E)) + { + return traversal as GraphTraversal<S2, E2>; + } + // New wrapper + return new GraphTraversal<S2, E2>(traversal.TraversalStrategies, traversal.Bytecode); + } + + + public GraphTraversal<S, Vertex> V(params object[] args) { Bytecode.AddStep("V", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal AddE(params object[] args) + public GraphTraversal<S, Edge> AddE(params object[] args) { Bytecode.AddStep("addE", args); - return this; + return Wrap<S, Edge>(this); } - public GraphTraversal AddInE(params object[] args) + public GraphTraversal<S, Edge> AddInE(params object[] args) { Bytecode.AddStep("addInE", args); - return this; + return Wrap<S, Edge>(this); } - public GraphTraversal AddOutE(params object[] args) + public GraphTraversal<S, Edge> AddOutE(params object[] args) { Bytecode.AddStep("addOutE", args); - return this; + return Wrap<S, Edge>(this); } - public GraphTraversal AddV(params object[] args) + public GraphTraversal<S, Vertex> AddV(params object[] args) { Bytecode.AddStep("addV", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal Aggregate(params object[] args) + public GraphTraversal<S, E> Aggregate(params object[] args) { Bytecode.AddStep("aggregate", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal And(params object[] args) + public GraphTraversal<S, E> And(params object[] args) { Bytecode.AddStep("and", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal As(params object[] args) + public GraphTraversal<S, E> As(params object[] args) { Bytecode.AddStep("as", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Barrier(params object[] args) + public GraphTraversal<S, E> Barrier(params object[] args) { Bytecode.AddStep("barrier", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Both(params object[] args) + public GraphTraversal<S, Vertex> Both(params object[] args) { Bytecode.AddStep("both", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal BothE(params object[] args) + public GraphTraversal<S, Edge> BothE(params object[] args) { Bytecode.AddStep("bothE", args); - return this; + return Wrap<S, Edge>(this); } - public GraphTraversal BothV(params object[] args) + public GraphTraversal<S, Vertex> BothV(params object[] args) { Bytecode.AddStep("bothV", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal Branch(params object[] args) + public GraphTraversal<S, E2> Branch<E2>(params object[] args) { Bytecode.AddStep("branch", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal By(params object[] args) + public GraphTraversal<S, E> By(params object[] args) { Bytecode.AddStep("by", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Cap(params object[] args) + public GraphTraversal<S, E2> Cap<E2>(params object[] args) { Bytecode.AddStep("cap", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Choose(params object[] args) + public GraphTraversal<S, E2> Choose<E2>(params object[] args) { Bytecode.AddStep("choose", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Coalesce(params object[] args) + public GraphTraversal<S, E2> Coalesce<E2>(params object[] args) { Bytecode.AddStep("coalesce", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Coin(params object[] args) + public GraphTraversal<S, E> Coin(params object[] args) { Bytecode.AddStep("coin", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Constant(params object[] args) + public GraphTraversal<S, E2> Constant<E2>(params object[] args) { Bytecode.AddStep("constant", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Count(params object[] args) + public GraphTraversal<S, long> Count(params object[] args) { Bytecode.AddStep("count", args); - return this; + return Wrap<S, long>(this); } - public GraphTraversal CyclicPath(params object[] args) + public GraphTraversal<S, E> CyclicPath(params object[] args) { Bytecode.AddStep("cyclicPath", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Dedup(params object[] args) + public GraphTraversal<S, E> Dedup(params object[] args) { Bytecode.AddStep("dedup", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Drop(params object[] args) + public GraphTraversal<S, E> Drop(params object[] args) { Bytecode.AddStep("drop", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Emit(params object[] args) + public GraphTraversal<S, E> Emit(params object[] args) { Bytecode.AddStep("emit", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Filter(params object[] args) + public GraphTraversal<S, E> Filter(params object[] args) { Bytecode.AddStep("filter", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal FlatMap(params object[] args) + public GraphTraversal<S, E2> FlatMap<E2>(params object[] args) { Bytecode.AddStep("flatMap", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Fold(params object[] args) + public GraphTraversal<S, E2> Fold<E2>(params object[] args) { Bytecode.AddStep("fold", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal From(params object[] args) + public GraphTraversal<S, E> From(params object[] args) { Bytecode.AddStep("from", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Group(params object[] args) + public GraphTraversal<S, E> Group(params object[] args) { Bytecode.AddStep("group", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal GroupCount(params object[] args) + public GraphTraversal<S, E> GroupCount(params object[] args) { Bytecode.AddStep("groupCount", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal GroupV3d0(params object[] args) + public GraphTraversal<S, E> GroupV3d0(params object[] args) { Bytecode.AddStep("groupV3d0", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Has(params object[] args) + public GraphTraversal<S, E> Has(params object[] args) { Bytecode.AddStep("has", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal HasId(params object[] args) + public GraphTraversal<S, E> HasId(params object[] args) { Bytecode.AddStep("hasId", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal HasKey(params object[] args) + public GraphTraversal<S, E> HasKey(params object[] args) { Bytecode.AddStep("hasKey", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal HasLabel(params object[] args) + public GraphTraversal<S, E> HasLabel(params object[] args) { Bytecode.AddStep("hasLabel", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal HasNot(params object[] args) + public GraphTraversal<S, E> HasNot(params object[] args) { Bytecode.AddStep("hasNot", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal HasValue(params object[] args) + public GraphTraversal<S, E> HasValue(params object[] args) { Bytecode.AddStep("hasValue", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Id(params object[] args) + public GraphTraversal<S, object> Id(params object[] args) { Bytecode.AddStep("id", args); - return this; + return Wrap<S, object>(this); } - public GraphTraversal Identity(params object[] args) + public GraphTraversal<S, E> Identity(params object[] args) { Bytecode.AddStep("identity", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal In(params object[] args) + public GraphTraversal<S, Vertex> In(params object[] args) { Bytecode.AddStep("in", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal InE(params object[] args) + public GraphTraversal<S, Edge> InE(params object[] args) { Bytecode.AddStep("inE", args); - return this; + return Wrap<S, Edge>(this); } - public GraphTraversal InV(params object[] args) + public GraphTraversal<S, Vertex> InV(params object[] args) { Bytecode.AddStep("inV", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal Inject(params object[] args) + public GraphTraversal<S, E> Inject(params object[] args) { Bytecode.AddStep("inject", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Is(params object[] args) + public GraphTraversal<S, E> Is(params object[] args) { Bytecode.AddStep("is", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Key(params object[] args) + public GraphTraversal<S, string> Key(params object[] args) { Bytecode.AddStep("key", args); - return this; + return Wrap<S, string>(this); } - public GraphTraversal Label(params object[] args) + public GraphTraversal<S, string> Label(params object[] args) { Bytecode.AddStep("label", args); - return this; + return Wrap<S, string>(this); } - public GraphTraversal Limit(params object[] args) + public GraphTraversal<S, E2> Limit<E2>(params object[] args) { Bytecode.AddStep("limit", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Local(params object[] args) + public GraphTraversal<S, E2> Local<E2>(params object[] args) { Bytecode.AddStep("local", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Loops(params object[] args) + public GraphTraversal<S, int> Loops(params object[] args) { Bytecode.AddStep("loops", args); - return this; + return Wrap<S, int>(this); } - public GraphTraversal Map(params object[] args) + public GraphTraversal<S, E2> Map<E2>(params object[] args) { Bytecode.AddStep("map", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal MapKeys(params object[] args) + public GraphTraversal<S, E2> MapKeys<E2>(params object[] args) { Bytecode.AddStep("mapKeys", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal MapValues(params object[] args) + public GraphTraversal<S, E2> MapValues<E2>(params object[] args) { Bytecode.AddStep("mapValues", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Match(params object[] args) + public GraphTraversal<S, IDictionary<string, E2>> Match<E2>(params object[] args) { Bytecode.AddStep("match", args); - return this; + return Wrap<S, IDictionary<string, E2>>(this); } - public GraphTraversal Max(params object[] args) + public GraphTraversal<S, E2> Max<E2>(params object[] args) { Bytecode.AddStep("max", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Mean(params object[] args) + public GraphTraversal<S, E2> Mean<E2>(params object[] args) { Bytecode.AddStep("mean", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Min(params object[] args) + public GraphTraversal<S, E2> Min<E2>(params object[] args) { Bytecode.AddStep("min", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Not(params object[] args) + public GraphTraversal<S, E> Not(params object[] args) { Bytecode.AddStep("not", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Option(params object[] args) + public GraphTraversal<S, E> Option(params object[] args) { Bytecode.AddStep("option", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Optional(params object[] args) + public GraphTraversal<S, E2> Optional<E2>(params object[] args) { Bytecode.AddStep("optional", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Or(params object[] args) + public GraphTraversal<S, E> Or(params object[] args) { Bytecode.AddStep("or", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Order(params object[] args) + public GraphTraversal<S, E> Order(params object[] args) { Bytecode.AddStep("order", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal OtherV(params object[] args) + public GraphTraversal<S, Vertex> OtherV(params object[] args) { Bytecode.AddStep("otherV", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal Out(params object[] args) + public GraphTraversal<S, Vertex> Out(params object[] args) { Bytecode.AddStep("out", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal OutE(params object[] args) + public GraphTraversal<S, Edge> OutE(params object[] args) { Bytecode.AddStep("outE", args); - return this; + return Wrap<S, Edge>(this); } - public GraphTraversal OutV(params object[] args) + public GraphTraversal<S, Vertex> OutV(params object[] args) { Bytecode.AddStep("outV", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal PageRank(params object[] args) + public GraphTraversal<S, E> PageRank(params object[] args) { Bytecode.AddStep("pageRank", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Path(params object[] args) + public GraphTraversal<S, Path> Path(params object[] args) { Bytecode.AddStep("path", args); - return this; + return Wrap<S, Path>(this); } - public GraphTraversal PeerPressure(params object[] args) + public GraphTraversal<S, E> PeerPressure(params object[] args) { Bytecode.AddStep("peerPressure", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Profile(params object[] args) + public GraphTraversal<S, E> Profile(params object[] args) { Bytecode.AddStep("profile", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Program(params object[] args) + public GraphTraversal<S, E> Program(params object[] args) { Bytecode.AddStep("program", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Project(params object[] args) + public GraphTraversal<S, IDictionary<string, E2>> Project<E2>(params object[] args) { Bytecode.AddStep("project", args); - return this; + return Wrap<S, IDictionary<string, E2>>(this); } - public GraphTraversal Properties(params object[] args) + public GraphTraversal<S, E2> Properties<E2>(params object[] args) { Bytecode.AddStep("properties", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Property(params object[] args) + public GraphTraversal<S, E> Property(params object[] args) { Bytecode.AddStep("property", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal PropertyMap(params object[] args) + public GraphTraversal<S, IDictionary<string, E2>> PropertyMap<E2>(params object[] args) { Bytecode.AddStep("propertyMap", args); - return this; + return Wrap<S, IDictionary<string, E2>>(this); } - public GraphTraversal Range(params object[] args) + public GraphTraversal<S, E2> Range<E2>(params object[] args) { Bytecode.AddStep("range", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Repeat(params object[] args) + public GraphTraversal<S, E> Repeat(params object[] args) { Bytecode.AddStep("repeat", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Sack(params object[] args) + public GraphTraversal<S, E> Sack(params object[] args) { Bytecode.AddStep("sack", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Sample(params object[] args) + public GraphTraversal<S, E> Sample(params object[] args) { Bytecode.AddStep("sample", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Select(params object[] args) + public GraphTraversal<S, IDictionary<string, E2>> Select<E2>(params object[] args) { Bytecode.AddStep("select", args); - return this; + return Wrap<S, IDictionary<string, E2>>(this); } - public GraphTraversal SideEffect(params object[] args) + public GraphTraversal<S, E> SideEffect(params object[] args) { Bytecode.AddStep("sideEffect", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal SimplePath(params object[] args) + public GraphTraversal<S, E> SimplePath(params object[] args) { Bytecode.AddStep("simplePath", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Store(params object[] args) + public GraphTraversal<S, E> Store(params object[] args) { Bytecode.AddStep("store", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Subgraph(params object[] args) + public GraphTraversal<S, Edge> Subgraph(params object[] args) { Bytecode.AddStep("subgraph", args); - return this; + return Wrap<S, Edge>(this); } - public GraphTraversal Sum(params object[] args) + public GraphTraversal<S, E2> Sum<E2>(params object[] args) { Bytecode.AddStep("sum", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Tail(params object[] args) + public GraphTraversal<S, E2> Tail<E2>(params object[] args) { Bytecode.AddStep("tail", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal TimeLimit(params object[] args) + public GraphTraversal<S, E> TimeLimit(params object[] args) { Bytecode.AddStep("timeLimit", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Times(params object[] args) + public GraphTraversal<S, E> Times(params object[] args) { Bytecode.AddStep("times", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal To(params object[] args) + public GraphTraversal<S, Vertex> To(params object[] args) { Bytecode.AddStep("to", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal ToE(params object[] args) + public GraphTraversal<S, Edge> ToE(params object[] args) { Bytecode.AddStep("toE", args); - return this; + return Wrap<S, Edge>(this); } - public GraphTraversal ToV(params object[] args) + public GraphTraversal<S, Vertex> ToV(params object[] args) { Bytecode.AddStep("toV", args); - return this; + return Wrap<S, Vertex>(this); } - public GraphTraversal Tree(params object[] args) + public GraphTraversal<S, E> Tree(params object[] args) { Bytecode.AddStep("tree", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Unfold(params object[] args) + public GraphTraversal<S, E2> Unfold<E2>(params object[] args) { Bytecode.AddStep("unfold", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Union(params object[] args) + public GraphTraversal<S, E2> Union<E2>(params object[] args) { Bytecode.AddStep("union", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Until(params object[] args) + public GraphTraversal<S, E> Until(params object[] args) { Bytecode.AddStep("until", args); - return this; + return Wrap<S, E>(this); } - public GraphTraversal Value(params object[] args) + public GraphTraversal<S, E2> Value<E2>(params object[] args) { Bytecode.AddStep("value", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal ValueMap(params object[] args) + public GraphTraversal<S, IDictionary<string, E2>> ValueMap<E2>(params object[] args) { Bytecode.AddStep("valueMap", args); - return this; + return Wrap<S, IDictionary<string, E2>>(this); } - public GraphTraversal Values(params object[] args) + public GraphTraversal<S, E2> Values<E2>(params object[] args) { Bytecode.AddStep("values", args); - return this; + return Wrap<S, E2>(this); } - public GraphTraversal Where(params object[] args) + public GraphTraversal<S, E> Where(params object[] args) { Bytecode.AddStep("where", args); - return this; + return Wrap<S, E>(this); } - } + } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/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 6382781..07d98fb 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs @@ -24,6 +24,7 @@ using System.Collections.Generic; using Gremlin.Net.Process.Remote; using Gremlin.Net.Process.Traversal.Strategy.Decoration; +using Gremlin.Net.Structure; namespace Gremlin.Net.Process.Traversal { @@ -111,32 +112,25 @@ namespace Gremlin.Net.Process.Traversal return WithStrategies(new VertexProgramStrategy(graphComputer, workers, persist, result, vertices, edges, configuration)); } - public GraphTraversal E(params object[] args) + public GraphTraversal<Edge, Edge> E(params object[] args) { - var traversal = new GraphTraversal(TraversalStrategies, new Bytecode(Bytecode)); + var traversal = new GraphTraversal<Edge, Edge>(TraversalStrategies, new Bytecode(Bytecode)); traversal.Bytecode.AddStep("E", args); return traversal; } - public GraphTraversal V(params object[] args) + public GraphTraversal<Vertex, Vertex> V(params object[] args) { - var traversal = new GraphTraversal(TraversalStrategies, new Bytecode(Bytecode)); + var traversal = new GraphTraversal<Vertex, Vertex>(TraversalStrategies, new Bytecode(Bytecode)); traversal.Bytecode.AddStep("V", args); return traversal; } - public GraphTraversal AddV(params object[] args) + public GraphTraversal<Vertex, Vertex> AddV(params object[] args) { - var traversal = new GraphTraversal(TraversalStrategies, new Bytecode(Bytecode)); + var traversal = new GraphTraversal<Vertex, Vertex>(TraversalStrategies, new Bytecode(Bytecode)); traversal.Bytecode.AddStep("addV", args); return traversal; } - - public GraphTraversal Inject(params object[] args) - { - var traversal = new GraphTraversal(TraversalStrategies, new Bytecode(Bytecode)); - traversal.Bytecode.AddStep("inject", args); - return traversal; - } - } + } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversal.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversal.cs index cb472b7..cb1c80e 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversal.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversal.cs @@ -29,9 +29,10 @@ using System.Threading.Tasks; namespace Gremlin.Net.Process.Traversal { /// <summary> - /// A traversal represents a directed walk over a graph. + /// Represents the basic information for a walk over a graph. /// </summary> - public interface ITraversal : IDisposable, IEnumerator + /// <seealso cref="ITraversal{SType, EType}"/> + public interface ITraversal { /// <summary> /// Gets the <see cref="Bytecode" /> representation of this traversal. @@ -47,25 +48,31 @@ namespace Gremlin.Net.Process.Traversal /// Gets or sets the <see cref="Traverser" />'s of this traversal that hold the results of the traversal. /// </summary> IEnumerable<Traverser> Traversers { get; set; } + } + /// <summary> + /// A traversal represents a directed walk over a graph. + /// </summary> + public interface ITraversal<S, E> : ITraversal, IEnumerator<E> + { /// <summary> /// Gets the next result from the traversal. /// </summary> /// <returns>The result.</returns> - object Next(); + E Next(); /// <summary> /// Gets the next n-number of results from the traversal. /// </summary> /// <param name="amount">The number of results to get.</param> /// <returns>The n-results.</returns> - IEnumerable<object> Next(int amount); + IEnumerable<E> Next(int amount); /// <summary> /// Iterates all <see cref="Traverser" /> instances in the traversal. /// </summary> /// <returns>The fully drained traversal.</returns> - ITraversal Iterate(); + ITraversal<S, E> Iterate(); /// <summary> /// Gets the next <see cref="Traverser" />. @@ -74,16 +81,16 @@ namespace Gremlin.Net.Process.Traversal Traverser NextTraverser(); /// <summary> - /// Puts all the results into a <see cref="List{T}" />. + /// Puts all the results into a <see cref="IList{T}" />. /// </summary> /// <returns>The results in a list.</returns> - List<object> ToList(); + IList<E> ToList(); /// <summary> - /// Puts all the results into a <see cref="HashSet{T}" />. + /// Puts all the results into a <see cref="ISet{T}" />. /// </summary> /// <returns>The results in a set.</returns> - HashSet<object> ToSet(); + ISet<E> ToSet(); /// <summary> /// Starts a promise to execute a function on the current traversal that will be completed in the future. @@ -91,6 +98,6 @@ namespace Gremlin.Net.Process.Traversal /// <typeparam name="TReturn">The return type of the <paramref name="callback" />.</typeparam> /// <param name="callback">The function to execute on the current traversal.</param> /// <returns>The result of the executed <paramref name="callback" />.</returns> - Task<TReturn> Promise<TReturn>(Func<ITraversal, TReturn> callback); + Task<TReturn> Promise<TReturn>(Func<ITraversal<S, E>, TReturn> callback); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversalStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversalStrategy.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversalStrategy.cs index 991a807..013d62a 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversalStrategy.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversalStrategy.cs @@ -35,12 +35,12 @@ namespace Gremlin.Net.Process.Traversal /// Applies the strategy to the given <see cref="ITraversal" />. /// </summary> /// <param name="traversal">The <see cref="ITraversal" /> the strategy should be applied to.</param> - void Apply(ITraversal traversal); + void Apply<S, E>(ITraversal<S, E> traversal); /// <summary> /// Applies the strategy to the given <see cref="ITraversal" /> asynchronously. /// </summary> /// <param name="traversal">The <see cref="ITraversal" /> the strategy should be applied to.</param> - Task ApplyAsync(ITraversal traversal); + Task ApplyAsync<S, E>(ITraversal<S, E> traversal); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/NamingConversions.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/NamingConversions.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/NamingConversions.cs new file mode 100644 index 0000000..6f5fec5 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/NamingConversions.cs @@ -0,0 +1,86 @@ +#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; + +namespace Gremlin.Net.Process.Traversal +{ + internal static class NamingConversions + { + /// <summary> + /// Gets the Java name equivalent for a given enum value + /// </summary> + internal static string GetEnumJavaName(string typeName, string value) + { + var key = $"{typeName}.{value}"; + string javaName; + if (!CSharpToJavaEnums.TryGetValue(key, out javaName)) + { + throw new KeyNotFoundException($"Java name for {key} not found"); + } + return javaName; + } + + internal static readonly IDictionary<string, string> CSharpToJavaEnums = new Dictionary<string, string> + { + {"T.Value", "value"}, + {"Order.Decr", "decr"}, + {"Order.KeyDecr", "keyDecr"}, + {"T.Key", "key"}, + {"Column.Values", "values"}, + {"Order.KeyIncr", "keyIncr"}, + {"Operator.Or", "or"}, + {"Order.ValueIncr", "valueIncr"}, + {"Cardinality.List", "list"}, + {"Order.Incr", "incr"}, + {"Pop.All", "all"}, + {"Operator.SumLong", "sumLong"}, + {"Pop.First", "first"}, + {"T.Label", "label"}, + {"Cardinality.Set", "set"}, + {"Order.Shuffle", "shuffle"}, + {"Direction.In", "IN"}, + {"Direction.Both", "BOTH"}, + {"Scope.Local", "local"}, + {"Operator.Max", "max"}, + {"Direction.Out", "OUT"}, + {"Scope.Global", "global"}, + {"Pick.Any", "any"}, + {"Order.ValueDecr", "valueDecr"}, + {"Column.Keys", "keys"}, + {"Operator.AddAll", "addAll"}, + {"Operator.Mult", "mult"}, + {"Pick.None", "none"}, + {"Pop.Last", "last"}, + {"Operator.And", "and"}, + {"T.Id", "id"}, + {"Operator.Min", "min"}, + {"Barrier.NormSack", "normSack"}, + {"Operator.Minus", "minus"}, + {"Cardinality.Single", "single"}, + {"Operator.Assign", "assign"}, + {"Operator.Div", "div"}, + {"Operator.Sum", "sum"} + }; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs index 563f091..17b44a4 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Operator.cs @@ -25,16 +25,16 @@ namespace Gremlin.Net.Process.Traversal { public enum Operator { - addAll, - and, - assign, - div, - max, - min, - minus, - mult, - or, - sum, - sumLong + AddAll, + And, + Assign, + Div, + Max, + Min, + Minus, + Mult, + Or, + Sum, + SumLong } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs index bbd0eab..179182b 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Order.cs @@ -25,12 +25,12 @@ namespace Gremlin.Net.Process.Traversal { public enum Order { - decr, - incr, - keyDecr, - keyIncr, - shuffle, - valueDecr, - valueIncr + Decr, + Incr, + KeyDecr, + KeyIncr, + Shuffle, + ValueDecr, + ValueIncr } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/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 0ecdccd..cf388bd 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs @@ -103,5 +103,5 @@ namespace Gremlin.Net.Process.Traversal var value = args.Length == 1 ? args[0] : args; return new TraversalPredicate("without", value); } - } + } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs index f16aa20..624f66e 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pick.cs @@ -25,7 +25,7 @@ namespace Gremlin.Net.Process.Traversal { public enum Pick { - any, - none + Any, + None } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs index e0cf62e..dcbe698 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Pop.cs @@ -25,8 +25,8 @@ namespace Gremlin.Net.Process.Traversal { public enum Pop { - all, - first, - last + All, + First, + Last } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs index c4af316..f27725e 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Scope.cs @@ -25,7 +25,7 @@ namespace Gremlin.Net.Process.Traversal { public enum Scope { - global, - local + Global, + Local } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Strategy/AbstractTraversalStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Strategy/AbstractTraversalStrategy.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Strategy/AbstractTraversalStrategy.cs index 8c9666c..e5d3dfe 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Strategy/AbstractTraversalStrategy.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Strategy/AbstractTraversalStrategy.cs @@ -52,12 +52,12 @@ namespace Gremlin.Net.Process.Traversal.Strategy } /// <inheritdoc /> - public virtual void Apply(ITraversal traversal) + public virtual void Apply<S, E>(ITraversal<S, E> traversal) { } /// <inheritdoc /> - public virtual Task ApplyAsync(ITraversal traversal) + public virtual Task ApplyAsync<S, E>(ITraversal<S, E> traversal) { return Task.CompletedTask; } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e2453a18/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs index 50c15d9..76ca40f 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/T.cs @@ -25,9 +25,9 @@ namespace Gremlin.Net.Process.Traversal { public enum T { - id, - key, - label, - value + Id, + Key, + Label, + Value } }
