Add Gremlin-CSharp and Gremlin-DotNet This adds Gremlin-CSharp (a C# GLV), together with a .NET driver. The driver is based on Gremlin.Net (https://github.com/FlorianHockmann/Gremlin.Net) with added support for GLVs and Gremlin-CSharp is auto generated, very similar to Gremlin-Python. This should fix TINKERPOP-1552.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/37a24719 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/37a24719 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/37a24719 Branch: refs/heads/tp32 Commit: 37a2471932229ae6a4c1f5e5f3f2d3d25bbf7fd4 Parents: 9160a8a Author: Florian Hockmann <[email protected]> Authored: Thu Apr 6 19:02:23 2017 +0200 Committer: Stephen Mallette <[email protected]> Committed: Wed Jun 28 15:13:11 2017 -0400 ---------------------------------------------------------------------- .gitignore | 9 + .travis.yml | 5 + docker/Dockerfile | 6 +- .../developer/development-environment.asciidoc | 18 + docs/src/reference/gremlin-variants.asciidoc | 196 ++++++ gremlin-csharp-generator/pom.xml | 60 ++ .../csharp/AnonymousTraversalGenerator.groovy | 71 +++ .../gremlin/csharp/CommonContentHelper.groovy | 49 ++ .../gremlin/csharp/EnumGenerator.groovy | 62 ++ .../gremlin/csharp/GenerateGremlinCSharp.groovy | 32 + .../csharp/GraphTraversalGenerator.groovy | 77 +++ .../csharp/GraphTraversalSourceGenerator.groovy | 140 +++++ .../gremlin/csharp/PredicateGenerator.groovy | 66 ++ .../gremlin/csharp/SymbolHelper.groovy | 31 + gremlin-dotnet/Gremlin.Net.sln | 80 +++ gremlin-dotnet/pom.xml | 39 ++ .../src/Gremlin.CSharp/Gremlin.CSharp.csproj | 21 + .../src/Gremlin.CSharp/Process/Barrier.cs | 30 + .../src/Gremlin.CSharp/Process/Cardinality.cs | 32 + .../src/Gremlin.CSharp/Process/Column.cs | 31 + .../src/Gremlin.CSharp/Process/Direction.cs | 32 + .../Gremlin.CSharp/Process/GraphTraversal.cs | 630 +++++++++++++++++++ .../Process/GraphTraversalSource.cs | 143 +++++ .../src/Gremlin.CSharp/Process/Operator.cs | 40 ++ .../src/Gremlin.CSharp/Process/Order.cs | 36 ++ gremlin-dotnet/src/Gremlin.CSharp/Process/P.cs | 108 ++++ .../src/Gremlin.CSharp/Process/Pick.cs | 31 + .../src/Gremlin.CSharp/Process/Pop.cs | 32 + .../src/Gremlin.CSharp/Process/Scope.cs | 31 + gremlin-dotnet/src/Gremlin.CSharp/Process/T.cs | 33 + gremlin-dotnet/src/Gremlin.CSharp/Process/__.cs | 488 ++++++++++++++ .../src/Gremlin.CSharp/Structure/Graph.cs | 35 ++ .../Gremlin.Net.Process.csproj | 24 + .../Remote/IRemoteConnection.cs | 42 ++ .../Remote/RemoteStrategy.cs | 61 ++ .../Gremlin.Net.Process/Traversal/Binding.cs | 80 +++ .../Gremlin.Net.Process/Traversal/Bindings.cs | 42 ++ .../Gremlin.Net.Process/Traversal/Bytecode.cs | 85 +++ .../Traversal/DefaultTraversal.cs | 195 ++++++ .../Gremlin.Net.Process/Traversal/ITraversal.cs | 96 +++ .../Traversal/ITraversalSideEffects.cs | 52 ++ .../Traversal/ITraversalStrategy.cs | 46 ++ .../Traversal/Instruction.cs | 52 ++ .../Strategy/AbstractTraversalStrategy.cs | 86 +++ .../Strategy/Decoration/ConnectiveStrategy.cs | 33 + .../Strategy/Decoration/ElementIdStrategy.cs | 32 + .../Decoration/HaltedTraverserStrategy.cs | 34 + .../Strategy/Decoration/PartitionStrategy.cs | 56 ++ .../Strategy/Decoration/SubgraphStrategy.cs | 48 ++ .../Decoration/VertexProgramStrategy.cs | 50 ++ .../Finalization/MatchAlgorithmStrategy.cs | 34 + .../Optimization/AdjacentToIncidentStrategy.cs | 32 + .../Optimization/FilterRankingStrategy.cs | 32 + .../Optimization/GraphFilterStrategy.cs | 29 + .../Optimization/IdentityRemovalStrategy.cs | 32 + .../Optimization/IncidentToAdjacentStrategy.cs | 33 + .../Optimization/InlineFilterStrategy.cs | 32 + .../Optimization/LazyBarrierStrategy.cs | 33 + .../Optimization/MatchPredicateStrategy.cs | 32 + .../Strategy/Optimization/OrderLimitStrategy.cs | 29 + .../Optimization/PathProcessorStrategy.cs | 32 + .../Optimization/PathRetractionStrategy.cs | 29 + .../Optimization/RangeByIsCountStrategy.cs | 32 + .../Optimization/RepeatUnrollStrategy.cs | 29 + .../Verification/LambdaRestrictionStrategy.cs | 32 + .../Strategy/Verification/ReadOnlyStrategy.cs | 32 + .../Traversal/TraversalPredicate.cs | 85 +++ .../Gremlin.Net.Process/Traversal/Traverser.cs | 75 +++ .../src/Gremlin.Net/Driver/Connection.cs | 133 ++++ .../src/Gremlin.Net/Driver/ConnectionFactory.cs | 47 ++ .../src/Gremlin.Net/Driver/ConnectionPool.cs | 114 ++++ .../Driver/Exceptions/ResponseException.cs | 37 ++ .../src/Gremlin.Net/Driver/GremlinClient.cs | 95 +++ .../Driver/GremlinClientExtensions.cs | 140 +++++ .../src/Gremlin.Net/Driver/GremlinServer.cs | 56 ++ .../src/Gremlin.Net/Driver/IConnection.cs | 35 ++ .../src/Gremlin.Net/Driver/IGremlinClient.cs | 48 ++ .../Gremlin.Net/Driver/JsonMessageSerializer.cs | 49 ++ .../Driver/Messages/RequestMessage.cs | 143 +++++ .../Driver/Messages/ResponseMessage.cs | 40 ++ .../Driver/Messages/ResponseResult.cs | 37 ++ .../Driver/Messages/ResponseStatus.cs | 50 ++ .../Driver/Messages/ResponseStatusCode.cs | 67 ++ .../src/Gremlin.Net/Driver/ProxyConnection.cs | 52 ++ .../Driver/Remote/DriverRemoteConnection.cs | 80 +++ .../Driver/Remote/DriverRemoteTraversal.cs | 39 ++ .../Remote/DriverRemoteTraversalSideEffects.cs | 126 ++++ .../ResultsAggregation/AggregatorFactory.cs | 44 ++ .../ResultsAggregation/DefaultAggregator.cs | 42 ++ .../ResultsAggregation/DictionaryAggregator.cs | 44 ++ .../Driver/ResultsAggregation/IAggregator.cs | 31 + .../ResultsAggregation/TraverserAggregator.cs | 44 ++ gremlin-dotnet/src/Gremlin.Net/Driver/Tokens.cs | 114 ++++ .../Gremlin.Net/Driver/WebSocketConnection.cs | 96 +++ .../src/Gremlin.Net/Gremlin.Net.csproj | 43 ++ .../src/Gremlin.Net/Properties/AssemblyInfo.cs | 44 ++ .../src/Gremlin.Net/Structure/Edge.cs | 61 ++ .../src/Gremlin.Net/Structure/Element.cs | 77 +++ .../Structure/IO/GraphSON/BindingSerializer.cs | 42 ++ .../Structure/IO/GraphSON/BytecodeSerializer.cs | 58 ++ .../Structure/IO/GraphSON/DateDeserializer.cs | 43 ++ .../Structure/IO/GraphSON/DateSerializer.cs | 43 ++ .../Structure/IO/GraphSON/DoubleConverter.cs | 33 + .../Structure/IO/GraphSON/EdgeDeserializer.cs | 43 ++ .../Structure/IO/GraphSON/EdgeSerializer.cs | 45 ++ .../Structure/IO/GraphSON/EnumSerializer.cs | 37 ++ .../Structure/IO/GraphSON/FloatConverter.cs | 33 + .../Structure/IO/GraphSON/GraphSONReader.cs | 123 ++++ .../Structure/IO/GraphSON/GraphSONTokens.cs | 32 + .../Structure/IO/GraphSON/GraphSONUtil.cs | 62 ++ .../Structure/IO/GraphSON/GraphSONWriter.cs | 146 +++++ .../IO/GraphSON/IGraphSONDeserializer.cs | 41 ++ .../IO/GraphSON/IGraphSONSerializer.cs | 41 ++ .../Structure/IO/GraphSON/Int32Converter.cs | 33 + .../Structure/IO/GraphSON/Int64Converter.cs | 33 + .../Structure/IO/GraphSON/NumberConverter.cs | 45 ++ .../Structure/IO/GraphSON/PathDeserializer.cs | 41 ++ .../IO/GraphSON/PropertyDeserializer.cs | 38 ++ .../Structure/IO/GraphSON/PropertySerializer.cs | 64 ++ .../IO/GraphSON/RequestMessageSerializer.cs | 43 ++ .../IO/GraphSON/TraversalPredicateSerializer.cs | 45 ++ .../IO/GraphSON/TraversalSerializer.cs | 38 ++ .../IO/GraphSON/TraversalStrategySerializer.cs | 37 ++ .../Structure/IO/GraphSON/TraverserReader.cs | 38 ++ .../Structure/IO/GraphSON/UuidDeserializer.cs | 36 ++ .../Structure/IO/GraphSON/UuidSerializer.cs | 37 ++ .../Structure/IO/GraphSON/VertexDeserializer.cs | 37 ++ .../IO/GraphSON/VertexPropertyDeserializer.cs | 41 ++ .../IO/GraphSON/VertexPropertySerializer.cs | 43 ++ .../Structure/IO/GraphSON/VertexSerializer.cs | 41 ++ .../src/Gremlin.Net/Structure/Path.cs | 193 ++++++ .../src/Gremlin.Net/Structure/Property.cs | 96 +++ .../src/Gremlin.Net/Structure/Vertex.cs | 52 ++ .../src/Gremlin.Net/Structure/VertexProperty.cs | 66 ++ gremlin-dotnet/src/pom.xml | 55 ++ .../BytecodeGenerationTests.cs | 76 +++ .../BytecodeGeneration/StrategiesTests.cs | 170 +++++ .../ConfigProvider.cs | 47 ++ .../DriverRemoteConnection/EnumTests.cs | 59 ++ .../GraphTraversalSourceTests.cs | 55 ++ .../GraphTraversalTests.cs | 171 +++++ .../DriverRemoteConnection/PredicateTests.cs | 58 ++ .../RemoteConnectionFactory.cs | 41 ++ .../DriverRemoteConnection/SideEffectTests.cs | 221 +++++++ .../DriverRemoteConnection/StrategiesTests.cs | 193 ++++++ .../GraphSONWriterTests.cs | 50 ++ .../Gremlin.CSharp.IntegrationTest.csproj | 38 ++ .../Properties/AssemblyInfo.cs | 44 ++ .../appsettings.json | 4 + .../GraphTraversalSourceTests.cs | 68 ++ .../Gremlin.CSharp.UnitTest.csproj | 21 + .../Gremlin.CSharp.UnitTest/PredicateTests.cs | 50 ++ .../ConfigProvider.cs | 47 ++ .../Driver/ConnectionPoolTests.cs | 90 +++ .../Driver/GremlinClientTests.cs | 212 +++++++ .../Driver/MessagesTests.cs | 147 +++++ .../Gremlin.Net.IntegrationTest.csproj | 41 ++ .../Process/Remote/RemoteStrategyTests.cs | 85 +++ .../Properties/AssemblyInfo.cs | 44 ++ .../Util/RequestMessageProvider.cs | 54 ++ .../appsettings.json | 4 + .../Gremlin.Net.Process.UnitTest.csproj | 22 + .../Traversal/BytecodeTests.cs | 44 ++ .../Traversal/Strategy/StrategyTests.cs | 109 ++++ .../Traversal/TestTraversal.cs | 51 ++ .../Traversal/TestTraversalStrategy.cs | 50 ++ .../Traversal/TraversalTests.cs | 177 ++++++ .../Traversal/TraverserTests.cs | 75 +++ .../Driver/DriverRemoteConnectionTests.cs | 51 ++ .../Driver/GremlinServerTests.cs | 66 ++ .../Driver/RequestMessageBuilderTests.cs | 41 ++ .../Gremlin.Net.UnitTest.csproj | 35 ++ .../Properties/AssemblyInfo.cs | 44 ++ .../Gremlin.Net.UnitTest/Structure/EdgeTests.cs | 57 ++ .../GraphSON/BytecodeGraphSONSerializerTests.cs | 153 +++++ .../IO/GraphSON/GraphSONReaderTests.cs | 308 +++++++++ .../IO/GraphSON/GraphSONWriterTests.cs | 329 ++++++++++ .../IO/GraphSON/StrategyWriterTests.cs | 66 ++ .../Structure/IO/GraphSON/TestClass.cs | 30 + .../Structure/IO/GraphSON/TestUtils.cs | 36 ++ .../Gremlin.Net.UnitTest/Structure/PathTests.cs | 416 ++++++++++++ .../Structure/PropertyTests.cs | 165 +++++ .../Structure/VertexPropertyTests.cs | 69 ++ .../Structure/VertexTests.cs | 80 +++ gremlin-dotnet/test/pom.xml | 179 ++++++ pom.xml | 9 + 186 files changed, 13224 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index ca3160b..fe469b0 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,12 @@ __pycache__/ __version__.py .glv settings.xml +tools/ +[Dd]ebug/ +[Rr]elease/ +[Oo]bj/ +*.suo +*.user +.vscode/ +.vs/ +*nupkg http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/.travis.yml ---------------------------------------------------------------------- diff --git a/.travis.yml b/.travis.yml index f2513e6..31a98a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,11 @@ addons: apt: packages: - oracle-java8-installer +before_install: + - sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' + - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893 + - sudo apt-get update + - sudo apt-get install dotnet-dev-1.0.1 script: - "mvn clean install -Dci" #notifications: http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/docker/Dockerfile ---------------------------------------------------------------------- diff --git a/docker/Dockerfile b/docker/Dockerfile index 87e8b07..932536c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,11 +20,13 @@ FROM ubuntu:trusty MAINTAINER Daniel Kuppitz <[email protected]> RUN apt-get update \ - && apt-get -y install software-properties-common python-software-properties \ + && apt-get -y install software-properties-common python-software-properties apt-transport-https \ && echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections \ && add-apt-repository -y ppa:webupd8team/java \ + && sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' \ + && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893 \ && apt-get update \ - && apt-get install -y oracle-java8-installer curl gawk git maven openssh-server \ + && apt-get install -y oracle-java8-installer curl gawk git maven openssh-server dotnet-dev-1.0.1 \ && rm -rf /var/lib/apt/lists/* /var/cache/oracle-jdk8-installer RUN sed -i 's@PermitRootLogin without-password@PermitRootLogin yes@' /etc/ssh/sshd_config http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/docs/src/dev/developer/development-environment.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/dev/developer/development-environment.asciidoc b/docs/src/dev/developer/development-environment.asciidoc index 2dff247..3d27605 100644 --- a/docs/src/dev/developer/development-environment.asciidoc +++ b/docs/src/dev/developer/development-environment.asciidoc @@ -101,6 +101,24 @@ integration tests and therefore must be actively switched on with `-DskipIntegra [source,text] mvn clean install -pl gremlin-console -DskipIntegrationTests=false +[[dotnet-environment]] +.NET Environment +~~~~~~~~~~~~~~~~ + +The build optionally requires link:https://www.microsoft.com/net/core[.NET Core SDK] (>=1.1.0) to work with the +gremlin-dotnet module. If .NET Core SDK is not installed, TinkerPop will still build with Maven, but .NET projects +will be skipped. + +`gremlin-dotnet` which also includes Gremlin-Csharp can be build and tested from the command line with: + +[source,text] +mvn clean install -Pgremlin-dotnet + +which enables the âgremlin-dotnetâ Maven profile or in a more automated fashion simply add a `.glv` file to the `src` +and `test` directories of the `gremlin-dotnet` module  which will signify to Maven that the environment is .NET-ready. +The `.glv` file need not have any contents and is ignored by Git. A standard `mvn clean install` will then build +`gremlin-dotnet` in full. + [[release-environment]] Release Environment ~~~~~~~~~~~~~~~~~~~ http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/docs/src/reference/gremlin-variants.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc index 39b5558..01df632 100644 --- a/docs/src/reference/gremlin-variants.asciidoc +++ b/docs/src/reference/gremlin-variants.asciidoc @@ -354,4 +354,200 @@ graphson_writer = GraphSONWriter({MyType: MyType}) connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g', graphson_reader=graphson_reader, graphson_writer=graphson_writer) +---- + +[[gremlin-csharp]] +Gremlin-CSharp +-------------- +Apache TinkerPop's Gremlin-CSharp implements Gremlin within the C# language. It targets .NET Standard and can +therefore be used on different operating systems and with different .NET frameworks, such as .NET Framework +and link:https://www.microsoft.com/net/core[.NET Core]. Since the C# syntax is very similar to that of Java, it should be very easy to switch between +Gremlin-Java and Gremlin-CSharp. The only major syntactical difference is that all method names in Gremlin-CSharp +use PascalCase as opposed to camelCase in Gremlin-Java in order to comply with .NET conventions. + +[source,powershell] +nuget install Gremlin.CSharp + +In Gremlin-CSharp there exists `GraphTraversalSource`, `GraphTraversal`, and `__` which mirror the respective classes +in Gremlin-Java. The `GraphTraversalSource` requires a driver in order to communicate with <<gremlin-server,GremlinServer>> (or any +RemoteConnection-enabled server). + +Gremlin-CSharp and Gremlin-DotNet +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Gremlin-CSharp is the C# language variant of Gremlin, but it needs a driver to communicate with a remote +Gremlin Server. Such a driver is provided as part of Apache TinkerPopâs Gremlin-DotNet that also includes other +useful functionality to work with Gremlin in .NET. +Gremlin-DotNet is currently distributed in two NuGet packages: + +* `Gremlin.Net.Process` contains core functionality for Gremlin language variants and defines interfaces for drivers. +Gremlin-CSharp depends on this package. So it will be installed automatically when you install Gremlin-CSharp. +* `Gremlin.Net` contains a driver that allows Gremlin-CSharp to be used with a remote server and GraphSON serializers and deserializers. + +IMPORTANT: For developers wishing to provide another driver implementation, be sure to implement `IRemoteConnection` in +`Gremlin.Net.Process.Remote` so it can then be used by Gremlin-CSharpâs `GraphTraversal`. + +When Gremlin Server is running, Gremlin-CSharp can communicate with Gremlin Server by sending traversals serialized as `Bytecode`. + +IMPORTANT: Gremlin-CSharp is compatible with GraphSON 2.0 only, so this serializer must be configured in Gremlin Server. + +A traversal source can be spawned with `RemoteStrategy` from an empty `Graph`. + +[source,csharp] +---- +var graph = new Graph(); +var g = graph.Traversal().WithRemote(new DriverRemoteConnection(new GremlinClient(new GremlinServer("localhost", 8182)))); +---- + +When a traversal from the `GraphTraversalSource` is iterated, the traversalâs `Bytecode` is sent over the wire via the registered +`IRemoteConnection`. The bytecode is used to construct the equivalent traversal at the remote traversal source. +Since Gremlin-CSharp currently doesn't support lambda expressions, all traversals can be translated to Gremlin-Java on the remote +location (e.g. Gremlin Server). + +IMPORTANT: Gremlin-DotNetâs `ITraversal` interface supports the standard Gremlin methods such as `Next()`, `NextTraverser()`, `ToSet()`, +`ToList()`, etc. Such "terminal" methods trigger the evaluation of the traversal. + +RemoteConnection Submission +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Very similar to Gremlin-Python and Gremlin-Java, there are various ways to submit a traversal to a `IRemoteConnection` using +terminal/action methods off of `ITraversal`. + +* `ITraversal.Next()` +* `ITraversal.NextTraverser()` +* `ITraversal.ToList()` +* `ITraversal.ToSet()` +* `ITraversal.Iterate()` + +Static Enums and Methods +~~~~~~~~~~~~~~~~~~~~~~~~ + +Gremlin has various tokens (e.g. `T`, `P`, `Order`, `Operator`, etc.) that are represented in Gremlin-CSharp as Enums. + +These can be used analogously to how they are used in Gremlin-Java. + +[source,csharp] +g.V().HasLabel("person").Has("age",P.Gt(30)).Order().By("age",Order.decr).ToList() + +Moreover, the class prefixes can be ommitted with a `using static`. + +[source,csharp] +---- +using static Gremlin.CSharp.Process.P; +using static Gremlin.CSharp.Process.Order; +---- + +Then it is possible to represent the above traversal as below. + +[source,csharp] +g.V().HasLabel("person").Has("age",Gt(30)).Order().By("age",decr).ToList() + +Finally, with using static `__`, anonymous traversals like `__.Out()` can be expressed as below. That is, without the `__.`-prefix. + +[source,csharp] +g.V().Repeat(Out()).Times(2).Values("name").Fold().ToList() + +Bindings +~~~~~~~~ + +When a traversal bytecode is sent over a `IRemoteConnection` (e.g. Gremlin Server), it will be translated, compiled, +and then executed. If the same traversal is sent again, translation and compilation can be skipped as the previously +compiled version should be cached. Many traversals are unique up to some parameterization. For instance, +`g.V(1).Out("created").Values("name")` is considered different from `g.V(4).Out('created').Values("Name")` +as they have different script "string" representations. However, `g.V(x).Out("created").Values("name")` with bindings of +`{x : 1}` and `{x : 4}` are considered the same. If a traversal is going to be executed repeatedly, but with different +parameters, then bindings should be used. In Gremlin-CSharp, bindings are objects that can be created as follows. + +[source,csharp] +---- +var b = new Bindings(); +g.V(b.Of("id", 1)).Out("created").Values("name").toList() +g.V(b.Of("id", 4)).Out("created").Values("name").toList() +---- + +Traversal Strategies +~~~~~~~~~~~~~~~~~~~~ + +In order to add and remove traversal strategies from a traversal source, Gremlin-DotNet has an `AbstractTraversalStrategy` +class along with a collection of subclasses that mirror the standard Gremlin-Java strategies. + +[source,csharp] +---- +g = g.WithStrategies(new SubgraphStrategy(vertexCriterion: HasLabel("person"), + edgeCriterion: Has("weight", Gt(0.5)))); +var names = g.V().Values("name").ToList(); // names: [marko, vadas, josh, peter] + +g = g.WithoutStrategies(new SubgraphStrategy()); +names = g.V().Values("name").ToList(); // names: [marko, vadas, lop, josh, ripple, peter] + +var edgeValueMaps = g.V().OutE().ValueMap(true).ToList(); +// edgeValueMaps: [[label:created, id:9, weight:0.4], [label:knows, id:7, weight:0.5], [label:knows, id:8, weight:1.0], +// [label:created, id:10, weight:1.0], [label:created, id:11, weight:0.4], [label:created, id:12, weight:0.2]] + +g = g.WithComputer(workers: 2, vertices: Has("name", "marko")); +names = g.V().Values("name").ToList(); // names: [marko] + +edgeValueMaps = g.V().OutE().ValueMap(true).ToList(); +// edgeValueMaps: [[label:created, id:9, weight:0.4], [label:knows, id:7, weight:0.5], [label:knows, id:8, weight:1.0]] +---- + +NOTE: Many of the TraversalStrategy classes in Gremlin-DotNet are proxies to the respective strategy on Apache TinkerPopâs +JVM-based Gremlin traversal machine. As such, their `Apply(ITraversal)` method does nothing. However, the strategy is +encoded in the Gremlin-DotNet bytecode and transmitted to the Gremlin traversal machine for re-construction machine-side. + +Custom Serialization +~~~~~~~~~~~~~~~~~~~~ + +Gremlin-DotNet provides a GraphSON 2.0 serialization package with the standard Apache TinkerPop `g`-types registered +(see link:http://tinkerpop.apache.org/docs/x.y.z/dev/io/#graphson-2d0[GraphSON 2.0]). It is possible for users to add new +types by creating serializers and deserializers in C# (or any other .NET language) and registering them with the `GremlinClient`. + +[source,csharp] +---- +internal class MyType +{ + public static string GraphsonPrefix = "providerx"; + public static string GraphsonBaseType = "MyType"; + public static string GraphsonType = GraphSONUtil.FormatTypeName(GraphsonPrefix, GraphsonBaseType); + + public MyType(int x, int y) + { + X = x; + Y = y; + } + + public int X { get; } + public int Y { get; } +} + +internal class MyClassWriter : IGraphSONSerializer +{ + public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) + { + MyType myType = objectData; + var valueDict = new Dictionary<string, object> + { + {"x", myType.X}, + {"y", myType.Y} + }; + return GraphSONUtil.ToTypedValue(nameof(TestClass), valueDict, MyType.GraphsonPrefix); + } +} + +internal class MyTypeReader : IGraphSONDeserializer +{ + public dynamic Objectify(JToken graphsonObject, GraphSONReader reader) + { + var x = reader.ToObject(graphsonObject["x"]); + var y = reader.ToObject(graphsonObject["y"]); + return new MyType(x, y); + } +} + +var graphsonReader = new GraphSONReader( + new Dictionary<string, IGraphSONDeserializer> {{MyType.GraphsonType, new MyTypeReader()}}); +var graphsonWriter = new GraphSONWriter( + new Dictionary<Type, IGraphSONSerializer> {{typeof(MyType), new MyClassWriter()}}); + +var gremlinClient = new GremlinClient(new GremlinServer("localhost", 8182), graphsonReader, graphsonWriter); ---- \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-csharp-generator/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-csharp-generator/pom.xml b/gremlin-csharp-generator/pom.xml new file mode 100644 index 0000000..f488f02 --- /dev/null +++ b/gremlin-csharp-generator/pom.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>tinkerpop</artifactId> + <version>3.2.5-SNAPSHOT</version> + </parent> + <artifactId>gremlin-csharp-generator</artifactId> + <name>Apache TinkerPop :: Gremlin-CSharp Generator</name> + <dependencies> + <dependency> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>gremlin-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy</artifactId> + <version>${groovy.version}</version> + <classifier>indy</classifier> + </dependency> + </dependencies> + <build> + <directory>${basedir}/target</directory> + <finalName>${project.artifactId}-${project.version}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <id>generate-csharp</id> + <phase>generate-test-resources</phase> + <goals> + <goal>java</goal> + </goals> + <configuration> + <mainClass>org.apache.tinkerpop.gremlin.csharp.GenerateGremlinCSharp</mainClass> + <arguments> + <argument>${project.parent.basedir}/gremlin-dotnet/src/Gremlin.CSharp</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.gmavenplus</groupId> + <artifactId>gmavenplus-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/AnonymousTraversalGenerator.groovy ---------------------------------------------------------------------- diff --git a/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/AnonymousTraversalGenerator.groovy b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/AnonymousTraversalGenerator.groovy new file mode 100644 index 0000000..6e2e191 --- /dev/null +++ b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/AnonymousTraversalGenerator.groovy @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tinkerpop.gremlin.csharp + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__ + +import java.lang.reflect.Modifier + +class AnonymousTraversalGenerator { + + public static void create(final String anonymousTraversalFile) { + + final StringBuilder csharpClass = new StringBuilder() + + csharpClass.append(CommonContentHelper.getLicense()) + + csharpClass.append( +""" +namespace Gremlin.CSharp.Process +{ + public static class __ + { + public static GraphTraversal Start() + { + return new GraphTraversal(); + } +""") + __.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) + + csharpClass.append( +""" + public static GraphTraversal ${sharpMethodName}(params object[] args) + { + return new GraphTraversal().${sharpMethodName}(args); + } +""") + } + csharpClass.append("\t}\n") + csharpClass.append("}") + + final File file = new File(anonymousTraversalFile); + file.delete() + csharpClass.eachLine { file.append(it + "\n") } + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/CommonContentHelper.groovy ---------------------------------------------------------------------- diff --git a/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/CommonContentHelper.groovy b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/CommonContentHelper.groovy new file mode 100644 index 0000000..c44bcfa --- /dev/null +++ b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/CommonContentHelper.groovy @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tinkerpop.gremlin.csharp + +public final class CommonContentHelper { + + public static String getLicense() { + return """#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 +""" + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/EnumGenerator.groovy ---------------------------------------------------------------------- diff --git a/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/EnumGenerator.groovy b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/EnumGenerator.groovy new file mode 100644 index 0000000..a389f9b --- /dev/null +++ b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/EnumGenerator.groovy @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tinkerpop.gremlin.csharp + +import org.apache.tinkerpop.gremlin.util.CoreImports + +class EnumGenerator { + + public static void create(final String enumDirectory) { + + for (final Class<? extends Enum> enumClass : CoreImports.getClassImports() + .findAll { Enum.class.isAssignableFrom(it) } + .sort { a, b -> a.getSimpleName() <=> b.getSimpleName() } + .collect()) { + createEnum(enumDirectory, enumClass) + } + } + + private static void createEnum(final String enumDirectory, final Class<? extends Enum> enumClass){ + final StringBuilder csharpEnum = new StringBuilder() + + csharpEnum.append(CommonContentHelper.getLicense()) + + csharpEnum.append( + """ +namespace Gremlin.CSharp.Process +{ + public enum ${enumClass.getSimpleName()} + { +""") + enumClass.getEnumConstants() + .sort { a, b -> a.name() <=> b.name() } + .each { value -> csharpEnum.append(" ${value.name()},\n"); } + csharpEnum.deleteCharAt(csharpEnum.length() - 2) + + csharpEnum.append(" }\n") + csharpEnum.append("}") + + final String enumFileName = "${enumDirectory}/${enumClass.getSimpleName()}.cs" + final File file = new File(enumFileName); + file.delete() + csharpEnum.eachLine { file.append(it + "\n") } + } +} + http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GenerateGremlinCSharp.groovy ---------------------------------------------------------------------- diff --git a/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GenerateGremlinCSharp.groovy b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GenerateGremlinCSharp.groovy new file mode 100644 index 0000000..7b03e5a --- /dev/null +++ b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GenerateGremlinCSharp.groovy @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tinkerpop.gremlin.csharp + +public class GenerateGremlinCSharp { + + public static void main(String[] args) { + final String csharpDirectory = args[0] + GraphTraversalSourceGenerator.create(csharpDirectory + "/Process/" + "GraphTraversalSource.cs") + GraphTraversalGenerator.create(csharpDirectory + "/Process/" + "GraphTraversal.cs") + AnonymousTraversalGenerator.create(csharpDirectory + "/Process/" + "__.cs") + EnumGenerator.create(csharpDirectory + "/Process/") + PredicateGenerator.create(csharpDirectory + "/Process/" + "P.cs") + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GraphTraversalGenerator.groovy ---------------------------------------------------------------------- diff --git a/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GraphTraversalGenerator.groovy b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GraphTraversalGenerator.groovy new file mode 100644 index 0000000..54183a3 --- /dev/null +++ b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GraphTraversalGenerator.groovy @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tinkerpop.gremlin.csharp + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal + +class GraphTraversalGenerator { + + public static void create(final String graphTraversalFile) { + + final StringBuilder csharpClass = new StringBuilder() + + csharpClass.append(CommonContentHelper.getLicense()) + + csharpClass.append( +""" +using System.Collections.Generic; +using Gremlin.Net.Process.Traversal; + +namespace Gremlin.CSharp.Process +{ + public class GraphTraversal : DefaultTraversal + { + public GraphTraversal() + : this(new List<ITraversalStrategy>(), new Bytecode()) + { + } + + public GraphTraversal(ICollection<ITraversalStrategy> traversalStrategies, Bytecode bytecode) + { + TraversalStrategies = traversalStrategies; + Bytecode = 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) + + csharpClass.append( + """ + public GraphTraversal ${sharpMethodName}(params object[] args) + { + Bytecode.AddStep("${javaMethodName}", args); + return this; + } +""") + } + csharpClass.append("\t}\n") + csharpClass.append("}") + + final File file = new File(graphTraversalFile); + file.delete() + csharpClass.eachLine { file.append(it + "\n") } + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GraphTraversalSourceGenerator.groovy ---------------------------------------------------------------------- diff --git a/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GraphTraversalSourceGenerator.groovy b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GraphTraversalSourceGenerator.groovy new file mode 100644 index 0000000..aaa35fb --- /dev/null +++ b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/GraphTraversalSourceGenerator.groovy @@ -0,0 +1,140 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tinkerpop.gremlin.csharp + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource + + +class GraphTraversalSourceGenerator { + + public static void create(final String graphTraversalSourceFile) { + + final StringBuilder csharpClass = new StringBuilder() + + csharpClass.append(CommonContentHelper.getLicense()) + + csharpClass.append( +""" +using System.Collections.Generic; +using Gremlin.Net.Process.Remote; +using Gremlin.Net.Process.Traversal; +using Gremlin.Net.Process.Traversal.Strategy.Decoration; + +namespace Gremlin.CSharp.Process +{ + public class GraphTraversalSource + { + public ICollection<ITraversalStrategy> TraversalStrategies { get; set; } + public Bytecode Bytecode { get; set; } + + public GraphTraversalSource() + : this(new List<ITraversalStrategy>(), new Bytecode()) + { + } + + public GraphTraversalSource(ICollection<ITraversalStrategy> traversalStrategies, Bytecode bytecode) + { + TraversalStrategies = traversalStrategies; + Bytecode = bytecode; + } +""" + ) + + // 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 { + !it.name.equals("clone") && + // replace by TraversalSource.Symbols.XXX + !it.name.equals("withBindings") && + !it.name.equals("withRemote") && + !it.name.equals("withComputer") + }. + collect { it.name }. + unique(). + sort { a, b -> a <=> b }. + forEach { javaMethodName -> + String sharpMethodName = SymbolHelper.toCSharp(javaMethodName) + + csharpClass.append( +""" + public GraphTraversalSource ${sharpMethodName}(params object[] args) + { + var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), + new Bytecode(Bytecode)); + source.Bytecode.AddSource("${javaMethodName}\", args); + return source; + } +""") + } + + csharpClass.append( + """ + public GraphTraversalSource WithBindings(object bindings) + { + return this; + } + + public GraphTraversalSource WithRemote(IRemoteConnection remoteConnection) + { + var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), + new Bytecode(Bytecode)); + source.TraversalStrategies.Add(new RemoteStrategy(remoteConnection)); + return source; + } + + public GraphTraversalSource WithComputer(string graphComputer = null, int? workers = null, string persist = null, + string result = null, ITraversal vertices = null, ITraversal edges = null, + Dictionary<string, dynamic> configuration = null) + { + return WithStrategies(new VertexProgramStrategy(graphComputer, workers, persist, result, vertices, edges, configuration)); + } +""") + + GraphTraversalSource.getMethods(). // SPAWN STEPS + findAll { GraphTraversal.class.equals(it.returnType) }. + collect { it.name }. + unique(). + sort { a, b -> a <=> b }. + forEach { javaMethodName -> + String sharpMethodName = SymbolHelper.toCSharp(javaMethodName) + + csharpClass.append( + """ + public GraphTraversal ${sharpMethodName}(params object[] args) + { + var traversal = new GraphTraversal(TraversalStrategies, new Bytecode(Bytecode)); + traversal.Bytecode.AddStep("${javaMethodName}\", args); + return traversal; + } +""") + } + + csharpClass.append("\t}\n") + csharpClass.append("}") + + final File file = new File(graphTraversalSourceFile); + file.delete() + csharpClass.eachLine { file.append(it + "\n") } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/PredicateGenerator.groovy ---------------------------------------------------------------------- diff --git a/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/PredicateGenerator.groovy b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/PredicateGenerator.groovy new file mode 100644 index 0000000..72e3dba --- /dev/null +++ b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/PredicateGenerator.groovy @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tinkerpop.gremlin.csharp + +import org.apache.tinkerpop.gremlin.process.traversal.P + +import java.lang.reflect.Modifier + +class PredicateGenerator { + + public static void create(final String predicateFile) { + + final StringBuilder csharpClass = new StringBuilder() + + csharpClass.append(CommonContentHelper.getLicense()) + + csharpClass.append( +""" +using Gremlin.Net.Process.Traversal; + +namespace Gremlin.CSharp.Process +{ + public class P + {""") + P.class.getMethods(). + findAll { Modifier.isStatic(it.getModifiers()) }. + findAll { P.class.isAssignableFrom(it.returnType) }. + collect { it.name }. + unique(). + sort { a, b -> a <=> b }. + each { javaMethodName -> + String sharpMethodName = SymbolHelper.toCSharp(javaMethodName) + csharpClass.append( +""" + public static TraversalPredicate ${sharpMethodName}(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("${javaMethodName}", value); + } +""") + } + csharpClass.append("\t}\n") + csharpClass.append("}") + + final File file = new File(predicateFile) + file.delete() + csharpClass.eachLine { file.append(it + "\n") } + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/SymbolHelper.groovy ---------------------------------------------------------------------- diff --git a/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/SymbolHelper.groovy b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/SymbolHelper.groovy new file mode 100644 index 0000000..10591d7 --- /dev/null +++ b/gremlin-csharp-generator/src/main/groovy/org/apache/tinkerpop/gremlin/csharp/SymbolHelper.groovy @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tinkerpop.gremlin.csharp + +public final class SymbolHelper { + + public static String toCSharp(final String symbol) { + return (String) Character.toUpperCase(symbol.charAt(0)) + symbol.substring(1) + } + + public static String toJava(final String symbol) { + return (String) Character.toLowerCase(symbol.charAt(0)) + symbol.substring(1) + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/Gremlin.Net.sln ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/Gremlin.Net.sln b/gremlin-dotnet/Gremlin.Net.sln new file mode 100644 index 0000000..bfd565f --- /dev/null +++ b/gremlin-dotnet/Gremlin.Net.sln @@ -0,0 +1,80 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26228.4 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{584F838B-DAE2-44F5-868C-1F532949C827}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D4B935A4-93F9-4A58-BC34-E5BFE1D2E2F7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{1B54FAC2-5411-4BB6-B450-FE2FFD8C4782}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gremlin.Net", "src\Gremlin.Net\Gremlin.Net.csproj", "{6C1DD34D-E30F-4E37-AACC-BEB8AD2320D8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gremlin.Net.UnitTest", "test\Gremlin.Net.UnitTest\Gremlin.Net.UnitTest.csproj", "{1FAB781B-B857-4AD2-BEC8-E20C214D9E21}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gremlin.Net.IntegrationTest", "test\Gremlin.Net.IntegrationTest\Gremlin.Net.IntegrationTest.csproj", "{CC54ABE3-13D2-491C-81E2-4D0355ABFA93}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gremlin.CSharp", "src\Gremlin.CSharp\Gremlin.CSharp.csproj", "{709D235A-CA13-434F-9AF9-8C8C009B11D7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gremlin.CSharp.IntegrationTest", "test\Gremlin.CSharp.IntegrationTest\Gremlin.CSharp.IntegrationTest.csproj", "{232F0F2B-178E-4214-99C7-CC4DC6710F44}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gremlin.Net.Process", "src\Gremlin.Net.Process\Gremlin.Net.Process.csproj", "{4949181B-C97D-4BB4-A312-9C1506EC7DA7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gremlin.Net.Process.UnitTest", "test\Gremlin.Net.Process.UnitTest\Gremlin.Net.Process.UnitTest.csproj", "{D97CA283-AC86-4EC9-9E1D-5F9A97977687}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gremlin.CSharp.UnitTest", "test\Gremlin.CSharp.UnitTest\Gremlin.CSharp.UnitTest.csproj", "{F2D976C2-D5EC-4BE5-9F6F-FCFAA9F59858}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6C1DD34D-E30F-4E37-AACC-BEB8AD2320D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C1DD34D-E30F-4E37-AACC-BEB8AD2320D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C1DD34D-E30F-4E37-AACC-BEB8AD2320D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C1DD34D-E30F-4E37-AACC-BEB8AD2320D8}.Release|Any CPU.Build.0 = Release|Any CPU + {1FAB781B-B857-4AD2-BEC8-E20C214D9E21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FAB781B-B857-4AD2-BEC8-E20C214D9E21}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FAB781B-B857-4AD2-BEC8-E20C214D9E21}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FAB781B-B857-4AD2-BEC8-E20C214D9E21}.Release|Any CPU.Build.0 = Release|Any CPU + {CC54ABE3-13D2-491C-81E2-4D0355ABFA93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC54ABE3-13D2-491C-81E2-4D0355ABFA93}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC54ABE3-13D2-491C-81E2-4D0355ABFA93}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC54ABE3-13D2-491C-81E2-4D0355ABFA93}.Release|Any CPU.Build.0 = Release|Any CPU + {709D235A-CA13-434F-9AF9-8C8C009B11D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {709D235A-CA13-434F-9AF9-8C8C009B11D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {709D235A-CA13-434F-9AF9-8C8C009B11D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {709D235A-CA13-434F-9AF9-8C8C009B11D7}.Release|Any CPU.Build.0 = Release|Any CPU + {232F0F2B-178E-4214-99C7-CC4DC6710F44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {232F0F2B-178E-4214-99C7-CC4DC6710F44}.Debug|Any CPU.Build.0 = Debug|Any CPU + {232F0F2B-178E-4214-99C7-CC4DC6710F44}.Release|Any CPU.ActiveCfg = Release|Any CPU + {232F0F2B-178E-4214-99C7-CC4DC6710F44}.Release|Any CPU.Build.0 = Release|Any CPU + {4949181B-C97D-4BB4-A312-9C1506EC7DA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4949181B-C97D-4BB4-A312-9C1506EC7DA7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4949181B-C97D-4BB4-A312-9C1506EC7DA7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4949181B-C97D-4BB4-A312-9C1506EC7DA7}.Release|Any CPU.Build.0 = Release|Any CPU + {D97CA283-AC86-4EC9-9E1D-5F9A97977687}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D97CA283-AC86-4EC9-9E1D-5F9A97977687}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D97CA283-AC86-4EC9-9E1D-5F9A97977687}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D97CA283-AC86-4EC9-9E1D-5F9A97977687}.Release|Any CPU.Build.0 = Release|Any CPU + {F2D976C2-D5EC-4BE5-9F6F-FCFAA9F59858}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2D976C2-D5EC-4BE5-9F6F-FCFAA9F59858}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2D976C2-D5EC-4BE5-9F6F-FCFAA9F59858}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2D976C2-D5EC-4BE5-9F6F-FCFAA9F59858}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {6C1DD34D-E30F-4E37-AACC-BEB8AD2320D8} = {584F838B-DAE2-44F5-868C-1F532949C827} + {1FAB781B-B857-4AD2-BEC8-E20C214D9E21} = {1B54FAC2-5411-4BB6-B450-FE2FFD8C4782} + {CC54ABE3-13D2-491C-81E2-4D0355ABFA93} = {1B54FAC2-5411-4BB6-B450-FE2FFD8C4782} + {709D235A-CA13-434F-9AF9-8C8C009B11D7} = {584F838B-DAE2-44F5-868C-1F532949C827} + {232F0F2B-178E-4214-99C7-CC4DC6710F44} = {1B54FAC2-5411-4BB6-B450-FE2FFD8C4782} + {4949181B-C97D-4BB4-A312-9C1506EC7DA7} = {584F838B-DAE2-44F5-868C-1F532949C827} + {D97CA283-AC86-4EC9-9E1D-5F9A97977687} = {1B54FAC2-5411-4BB6-B450-FE2FFD8C4782} + {F2D976C2-D5EC-4BE5-9F6F-FCFAA9F59858} = {1B54FAC2-5411-4BB6-B450-FE2FFD8C4782} + EndGlobalSection +EndGlobal http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/pom.xml b/gremlin-dotnet/pom.xml new file mode 100644 index 0000000..0472324 --- /dev/null +++ b/gremlin-dotnet/pom.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>tinkerpop</artifactId> + <version>3.2.5-SNAPSHOT</version> + </parent> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>gremlin-dotnet</artifactId> + <name>Apache TinkerPop :: Gremlin-DotNet</name> + <packaging>pom</packaging> + + <modules> + <module>test</module> + <module>src</module> + </modules> + + <build> + <plugins> + <plugin> + <groupId>org.eobjects.build</groupId> + <artifactId>dotnet-maven-plugin</artifactId> + <extensions>true</extensions> + <version>0.14</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.gmavenplus</groupId> + <artifactId>gmavenplus-plugin</artifactId> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Gremlin.CSharp.csproj ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Gremlin.CSharp.csproj b/gremlin-dotnet/src/Gremlin.CSharp/Gremlin.CSharp.csproj new file mode 100644 index 0000000..82291fc --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Gremlin.CSharp.csproj @@ -0,0 +1,21 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <Version>3.2.5-SNAPSHOT</Version> + <TargetFramework>netstandard1.3</TargetFramework> + <AssemblyName>Gremlin.CSharp</AssemblyName> + <PackageId>Gremlin.CSharp</PackageId> + <GeneratePackageOnBuild>False</GeneratePackageOnBuild> + <PackageProjectUrl>http://tinkerpop.apache.org</PackageProjectUrl> + <PackageLicenseUrl>https://github.com/apache/tinkerpop/blob/master/LICENSE</PackageLicenseUrl> + <RepositoryUrl>https://github.com/apache/tinkerpop</RepositoryUrl> + <Description>Apache TinkerPopâs Gremlin-CSharp implements Gremlin within C# and can be used on any platform.</Description> + <PackageTags>gremlin-csharp;gremlin;tinkerpop</PackageTags> + <Authors>Apache TinkerPop</Authors> + </PropertyGroup> + + <ItemGroup> + <ProjectReference Include="..\Gremlin.Net.Process\Gremlin.Net.Process.csproj" /> + </ItemGroup> + +</Project> http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/Barrier.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/Barrier.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/Barrier.cs new file mode 100644 index 0000000..a74b47a --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/Barrier.cs @@ -0,0 +1,30 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +namespace Gremlin.CSharp.Process +{ + public enum Barrier + { + normSack + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/Cardinality.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/Cardinality.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/Cardinality.cs new file mode 100644 index 0000000..4b9fae8 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/Cardinality.cs @@ -0,0 +1,32 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +namespace Gremlin.CSharp.Process +{ + public enum Cardinality + { + list, + set, + single + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/Column.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/Column.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/Column.cs new file mode 100644 index 0000000..c397b69 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/Column.cs @@ -0,0 +1,31 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +namespace Gremlin.CSharp.Process +{ + public enum Column + { + keys, + values + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/Direction.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/Direction.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/Direction.cs new file mode 100644 index 0000000..abdf7a2 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/Direction.cs @@ -0,0 +1,32 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +namespace Gremlin.CSharp.Process +{ + public enum Direction + { + BOTH, + IN, + OUT + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/GraphTraversal.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/GraphTraversal.cs new file mode 100644 index 0000000..4397838 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/GraphTraversal.cs @@ -0,0 +1,630 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +using System.Collections.Generic; +using Gremlin.Net.Process.Traversal; + +namespace Gremlin.CSharp.Process +{ + public class GraphTraversal : DefaultTraversal + { + public GraphTraversal() + : this(new List<ITraversalStrategy>(), new Bytecode()) + { + } + + public GraphTraversal(ICollection<ITraversalStrategy> traversalStrategies, Bytecode bytecode) + { + TraversalStrategies = traversalStrategies; + Bytecode = bytecode; + } + + public GraphTraversal V(params object[] args) + { + Bytecode.AddStep("V", args); + return this; + } + + public GraphTraversal AddE(params object[] args) + { + Bytecode.AddStep("addE", args); + return this; + } + + public GraphTraversal AddInE(params object[] args) + { + Bytecode.AddStep("addInE", args); + return this; + } + + public GraphTraversal AddOutE(params object[] args) + { + Bytecode.AddStep("addOutE", args); + return this; + } + + public GraphTraversal AddV(params object[] args) + { + Bytecode.AddStep("addV", args); + return this; + } + + public GraphTraversal Aggregate(params object[] args) + { + Bytecode.AddStep("aggregate", args); + return this; + } + + public GraphTraversal And(params object[] args) + { + Bytecode.AddStep("and", args); + return this; + } + + public GraphTraversal As(params object[] args) + { + Bytecode.AddStep("as", args); + return this; + } + + public GraphTraversal Barrier(params object[] args) + { + Bytecode.AddStep("barrier", args); + return this; + } + + public GraphTraversal Both(params object[] args) + { + Bytecode.AddStep("both", args); + return this; + } + + public GraphTraversal BothE(params object[] args) + { + Bytecode.AddStep("bothE", args); + return this; + } + + public GraphTraversal BothV(params object[] args) + { + Bytecode.AddStep("bothV", args); + return this; + } + + public GraphTraversal Branch(params object[] args) + { + Bytecode.AddStep("branch", args); + return this; + } + + public GraphTraversal By(params object[] args) + { + Bytecode.AddStep("by", args); + return this; + } + + public GraphTraversal Cap(params object[] args) + { + Bytecode.AddStep("cap", args); + return this; + } + + public GraphTraversal Choose(params object[] args) + { + Bytecode.AddStep("choose", args); + return this; + } + + public GraphTraversal Coalesce(params object[] args) + { + Bytecode.AddStep("coalesce", args); + return this; + } + + public GraphTraversal Coin(params object[] args) + { + Bytecode.AddStep("coin", args); + return this; + } + + public GraphTraversal Constant(params object[] args) + { + Bytecode.AddStep("constant", args); + return this; + } + + public GraphTraversal Count(params object[] args) + { + Bytecode.AddStep("count", args); + return this; + } + + public GraphTraversal CyclicPath(params object[] args) + { + Bytecode.AddStep("cyclicPath", args); + return this; + } + + public GraphTraversal Dedup(params object[] args) + { + Bytecode.AddStep("dedup", args); + return this; + } + + public GraphTraversal Drop(params object[] args) + { + Bytecode.AddStep("drop", args); + return this; + } + + public GraphTraversal Emit(params object[] args) + { + Bytecode.AddStep("emit", args); + return this; + } + + public GraphTraversal Filter(params object[] args) + { + Bytecode.AddStep("filter", args); + return this; + } + + public GraphTraversal FlatMap(params object[] args) + { + Bytecode.AddStep("flatMap", args); + return this; + } + + public GraphTraversal Fold(params object[] args) + { + Bytecode.AddStep("fold", args); + return this; + } + + public GraphTraversal From(params object[] args) + { + Bytecode.AddStep("from", args); + return this; + } + + public GraphTraversal Group(params object[] args) + { + Bytecode.AddStep("group", args); + return this; + } + + public GraphTraversal GroupCount(params object[] args) + { + Bytecode.AddStep("groupCount", args); + return this; + } + + public GraphTraversal GroupV3d0(params object[] args) + { + Bytecode.AddStep("groupV3d0", args); + return this; + } + + public GraphTraversal Has(params object[] args) + { + Bytecode.AddStep("has", args); + return this; + } + + public GraphTraversal HasId(params object[] args) + { + Bytecode.AddStep("hasId", args); + return this; + } + + public GraphTraversal HasKey(params object[] args) + { + Bytecode.AddStep("hasKey", args); + return this; + } + + public GraphTraversal HasLabel(params object[] args) + { + Bytecode.AddStep("hasLabel", args); + return this; + } + + public GraphTraversal HasNot(params object[] args) + { + Bytecode.AddStep("hasNot", args); + return this; + } + + public GraphTraversal HasValue(params object[] args) + { + Bytecode.AddStep("hasValue", args); + return this; + } + + public GraphTraversal Id(params object[] args) + { + Bytecode.AddStep("id", args); + return this; + } + + public GraphTraversal Identity(params object[] args) + { + Bytecode.AddStep("identity", args); + return this; + } + + public GraphTraversal In(params object[] args) + { + Bytecode.AddStep("in", args); + return this; + } + + public GraphTraversal InE(params object[] args) + { + Bytecode.AddStep("inE", args); + return this; + } + + public GraphTraversal InV(params object[] args) + { + Bytecode.AddStep("inV", args); + return this; + } + + public GraphTraversal Inject(params object[] args) + { + Bytecode.AddStep("inject", args); + return this; + } + + public GraphTraversal Is(params object[] args) + { + Bytecode.AddStep("is", args); + return this; + } + + public GraphTraversal Key(params object[] args) + { + Bytecode.AddStep("key", args); + return this; + } + + public GraphTraversal Label(params object[] args) + { + Bytecode.AddStep("label", args); + return this; + } + + public GraphTraversal Limit(params object[] args) + { + Bytecode.AddStep("limit", args); + return this; + } + + public GraphTraversal Local(params object[] args) + { + Bytecode.AddStep("local", args); + return this; + } + + public GraphTraversal Loops(params object[] args) + { + Bytecode.AddStep("loops", args); + return this; + } + + public GraphTraversal Map(params object[] args) + { + Bytecode.AddStep("map", args); + return this; + } + + public GraphTraversal MapKeys(params object[] args) + { + Bytecode.AddStep("mapKeys", args); + return this; + } + + public GraphTraversal MapValues(params object[] args) + { + Bytecode.AddStep("mapValues", args); + return this; + } + + public GraphTraversal Match(params object[] args) + { + Bytecode.AddStep("match", args); + return this; + } + + public GraphTraversal Max(params object[] args) + { + Bytecode.AddStep("max", args); + return this; + } + + public GraphTraversal Mean(params object[] args) + { + Bytecode.AddStep("mean", args); + return this; + } + + public GraphTraversal Min(params object[] args) + { + Bytecode.AddStep("min", args); + return this; + } + + public GraphTraversal Not(params object[] args) + { + Bytecode.AddStep("not", args); + return this; + } + + public GraphTraversal Option(params object[] args) + { + Bytecode.AddStep("option", args); + return this; + } + + public GraphTraversal Optional(params object[] args) + { + Bytecode.AddStep("optional", args); + return this; + } + + public GraphTraversal Or(params object[] args) + { + Bytecode.AddStep("or", args); + return this; + } + + public GraphTraversal Order(params object[] args) + { + Bytecode.AddStep("order", args); + return this; + } + + public GraphTraversal OtherV(params object[] args) + { + Bytecode.AddStep("otherV", args); + return this; + } + + public GraphTraversal Out(params object[] args) + { + Bytecode.AddStep("out", args); + return this; + } + + public GraphTraversal OutE(params object[] args) + { + Bytecode.AddStep("outE", args); + return this; + } + + public GraphTraversal OutV(params object[] args) + { + Bytecode.AddStep("outV", args); + return this; + } + + public GraphTraversal PageRank(params object[] args) + { + Bytecode.AddStep("pageRank", args); + return this; + } + + public GraphTraversal Path(params object[] args) + { + Bytecode.AddStep("path", args); + return this; + } + + public GraphTraversal PeerPressure(params object[] args) + { + Bytecode.AddStep("peerPressure", args); + return this; + } + + public GraphTraversal Profile(params object[] args) + { + Bytecode.AddStep("profile", args); + return this; + } + + public GraphTraversal Program(params object[] args) + { + Bytecode.AddStep("program", args); + return this; + } + + public GraphTraversal Project(params object[] args) + { + Bytecode.AddStep("project", args); + return this; + } + + public GraphTraversal Properties(params object[] args) + { + Bytecode.AddStep("properties", args); + return this; + } + + public GraphTraversal Property(params object[] args) + { + Bytecode.AddStep("property", args); + return this; + } + + public GraphTraversal PropertyMap(params object[] args) + { + Bytecode.AddStep("propertyMap", args); + return this; + } + + public GraphTraversal Range(params object[] args) + { + Bytecode.AddStep("range", args); + return this; + } + + public GraphTraversal Repeat(params object[] args) + { + Bytecode.AddStep("repeat", args); + return this; + } + + public GraphTraversal Sack(params object[] args) + { + Bytecode.AddStep("sack", args); + return this; + } + + public GraphTraversal Sample(params object[] args) + { + Bytecode.AddStep("sample", args); + return this; + } + + public GraphTraversal Select(params object[] args) + { + Bytecode.AddStep("select", args); + return this; + } + + public GraphTraversal SideEffect(params object[] args) + { + Bytecode.AddStep("sideEffect", args); + return this; + } + + public GraphTraversal SimplePath(params object[] args) + { + Bytecode.AddStep("simplePath", args); + return this; + } + + public GraphTraversal Store(params object[] args) + { + Bytecode.AddStep("store", args); + return this; + } + + public GraphTraversal Subgraph(params object[] args) + { + Bytecode.AddStep("subgraph", args); + return this; + } + + public GraphTraversal Sum(params object[] args) + { + Bytecode.AddStep("sum", args); + return this; + } + + public GraphTraversal Tail(params object[] args) + { + Bytecode.AddStep("tail", args); + return this; + } + + public GraphTraversal TimeLimit(params object[] args) + { + Bytecode.AddStep("timeLimit", args); + return this; + } + + public GraphTraversal Times(params object[] args) + { + Bytecode.AddStep("times", args); + return this; + } + + public GraphTraversal To(params object[] args) + { + Bytecode.AddStep("to", args); + return this; + } + + public GraphTraversal ToE(params object[] args) + { + Bytecode.AddStep("toE", args); + return this; + } + + public GraphTraversal ToV(params object[] args) + { + Bytecode.AddStep("toV", args); + return this; + } + + public GraphTraversal Tree(params object[] args) + { + Bytecode.AddStep("tree", args); + return this; + } + + public GraphTraversal Unfold(params object[] args) + { + Bytecode.AddStep("unfold", args); + return this; + } + + public GraphTraversal Union(params object[] args) + { + Bytecode.AddStep("union", args); + return this; + } + + public GraphTraversal Until(params object[] args) + { + Bytecode.AddStep("until", args); + return this; + } + + public GraphTraversal Value(params object[] args) + { + Bytecode.AddStep("value", args); + return this; + } + + public GraphTraversal ValueMap(params object[] args) + { + Bytecode.AddStep("valueMap", args); + return this; + } + + public GraphTraversal Values(params object[] args) + { + Bytecode.AddStep("values", args); + return this; + } + + public GraphTraversal Where(params object[] args) + { + Bytecode.AddStep("where", args); + return this; + } + } +}
