http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/GraphTraversalSource.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/GraphTraversalSource.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/GraphTraversalSource.cs new file mode 100644 index 0000000..e68fdee --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/GraphTraversalSource.cs @@ -0,0 +1,143 @@ +#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.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; + } + + public GraphTraversalSource WithBulk(params object[] args) + { + var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), + new Bytecode(Bytecode)); + source.Bytecode.AddSource("withBulk", args); + return source; + } + + public GraphTraversalSource WithPath(params object[] args) + { + var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), + new Bytecode(Bytecode)); + source.Bytecode.AddSource("withPath", args); + return source; + } + + public GraphTraversalSource WithSack(params object[] args) + { + var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), + new Bytecode(Bytecode)); + source.Bytecode.AddSource("withSack", args); + return source; + } + + public GraphTraversalSource WithSideEffect(params object[] args) + { + var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), + new Bytecode(Bytecode)); + source.Bytecode.AddSource("withSideEffect", args); + return source; + } + + public GraphTraversalSource WithStrategies(params object[] args) + { + var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), + new Bytecode(Bytecode)); + source.Bytecode.AddSource("withStrategies", args); + return source; + } + + public GraphTraversalSource WithoutStrategies(params object[] args) + { + var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), + new Bytecode(Bytecode)); + source.Bytecode.AddSource("withoutStrategies", args); + return source; + } + + 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)); + } + + public GraphTraversal E(params object[] args) + { + var traversal = new GraphTraversal(TraversalStrategies, new Bytecode(Bytecode)); + traversal.Bytecode.AddStep("E", args); + return traversal; + } + + public GraphTraversal V(params object[] args) + { + var traversal = new GraphTraversal(TraversalStrategies, new Bytecode(Bytecode)); + traversal.Bytecode.AddStep("V", args); + return traversal; + } + + public GraphTraversal AddV(params object[] args) + { + var traversal = new GraphTraversal(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/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/Operator.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/Operator.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/Operator.cs new file mode 100644 index 0000000..5a9f805 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/Operator.cs @@ -0,0 +1,40 @@ +#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 Operator + { + addAll, + and, + assign, + div, + max, + min, + minus, + mult, + or, + sum, + sumLong + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/Order.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/Order.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/Order.cs new file mode 100644 index 0000000..1a30c7d --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/Order.cs @@ -0,0 +1,36 @@ +#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 Order + { + decr, + incr, + keyDecr, + keyIncr, + shuffle, + valueDecr, + valueIncr + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/P.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/P.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/P.cs new file mode 100644 index 0000000..62282b7 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/P.cs @@ -0,0 +1,108 @@ +#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 Gremlin.Net.Process.Traversal; + +namespace Gremlin.CSharp.Process +{ + public class P + { + public static TraversalPredicate Between(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("between", value); + } + + public static TraversalPredicate Eq(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("eq", value); + } + + public static TraversalPredicate Gt(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("gt", value); + } + + public static TraversalPredicate Gte(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("gte", value); + } + + public static TraversalPredicate Inside(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("inside", value); + } + + public static TraversalPredicate Lt(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("lt", value); + } + + public static TraversalPredicate Lte(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("lte", value); + } + + public static TraversalPredicate Neq(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("neq", value); + } + + public static TraversalPredicate Not(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("not", value); + } + + public static TraversalPredicate Outside(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("outside", value); + } + + public static TraversalPredicate Test(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("test", value); + } + + public static TraversalPredicate Within(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("within", value); + } + + public static TraversalPredicate Without(params object[] args) + { + var value = args.Length == 1 ? args[0] : args; + return new TraversalPredicate("without", value); + } + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/Pick.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/Pick.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/Pick.cs new file mode 100644 index 0000000..17c27d7 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/Pick.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 Pick + { + any, + none + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/Pop.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/Pop.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/Pop.cs new file mode 100644 index 0000000..4e14d94 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/Pop.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 Pop + { + all, + first, + last + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/Scope.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/Scope.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/Scope.cs new file mode 100644 index 0000000..a9578ee --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/Scope.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 Scope + { + global, + local + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/T.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/T.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/T.cs new file mode 100644 index 0000000..4bf9062 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/T.cs @@ -0,0 +1,33 @@ +#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 T + { + id, + key, + label, + value + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Process/__.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Process/__.cs b/gremlin-dotnet/src/Gremlin.CSharp/Process/__.cs new file mode 100644 index 0000000..2db0082 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Process/__.cs @@ -0,0 +1,488 @@ +#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 static class __ + { + public static GraphTraversal Start() + { + return new GraphTraversal(); + } + + public static GraphTraversal V(params object[] args) + { + return new GraphTraversal().V(args); + } + + public static GraphTraversal AddE(params object[] args) + { + return new GraphTraversal().AddE(args); + } + + public static GraphTraversal AddInE(params object[] args) + { + return new GraphTraversal().AddInE(args); + } + + public static GraphTraversal AddOutE(params object[] args) + { + return new GraphTraversal().AddOutE(args); + } + + public static GraphTraversal AddV(params object[] args) + { + return new GraphTraversal().AddV(args); + } + + public static GraphTraversal Aggregate(params object[] args) + { + return new GraphTraversal().Aggregate(args); + } + + public static GraphTraversal And(params object[] args) + { + return new GraphTraversal().And(args); + } + + public static GraphTraversal As(params object[] args) + { + return new GraphTraversal().As(args); + } + + public static GraphTraversal Barrier(params object[] args) + { + return new GraphTraversal().Barrier(args); + } + + public static GraphTraversal Both(params object[] args) + { + return new GraphTraversal().Both(args); + } + + public static GraphTraversal BothE(params object[] args) + { + return new GraphTraversal().BothE(args); + } + + public static GraphTraversal BothV(params object[] args) + { + return new GraphTraversal().BothV(args); + } + + public static GraphTraversal Branch(params object[] args) + { + return new GraphTraversal().Branch(args); + } + + public static GraphTraversal Cap(params object[] args) + { + return new GraphTraversal().Cap(args); + } + + public static GraphTraversal Choose(params object[] args) + { + return new GraphTraversal().Choose(args); + } + + public static GraphTraversal Coalesce(params object[] args) + { + return new GraphTraversal().Coalesce(args); + } + + public static GraphTraversal Coin(params object[] args) + { + return new GraphTraversal().Coin(args); + } + + public static GraphTraversal Constant(params object[] args) + { + return new GraphTraversal().Constant(args); + } + + public static GraphTraversal Count(params object[] args) + { + return new GraphTraversal().Count(args); + } + + public static GraphTraversal CyclicPath(params object[] args) + { + return new GraphTraversal().CyclicPath(args); + } + + public static GraphTraversal Dedup(params object[] args) + { + return new GraphTraversal().Dedup(args); + } + + public static GraphTraversal Drop(params object[] args) + { + return new GraphTraversal().Drop(args); + } + + public static GraphTraversal Emit(params object[] args) + { + return new GraphTraversal().Emit(args); + } + + public static GraphTraversal Filter(params object[] args) + { + return new GraphTraversal().Filter(args); + } + + public static GraphTraversal FlatMap(params object[] args) + { + return new GraphTraversal().FlatMap(args); + } + + public static GraphTraversal Fold(params object[] args) + { + return new GraphTraversal().Fold(args); + } + + public static GraphTraversal Group(params object[] args) + { + return new GraphTraversal().Group(args); + } + + public static GraphTraversal GroupCount(params object[] args) + { + return new GraphTraversal().GroupCount(args); + } + + public static GraphTraversal GroupV3d0(params object[] args) + { + return new GraphTraversal().GroupV3d0(args); + } + + public static GraphTraversal Has(params object[] args) + { + return new GraphTraversal().Has(args); + } + + public static GraphTraversal HasId(params object[] args) + { + return new GraphTraversal().HasId(args); + } + + public static GraphTraversal HasKey(params object[] args) + { + return new GraphTraversal().HasKey(args); + } + + public static GraphTraversal HasLabel(params object[] args) + { + return new GraphTraversal().HasLabel(args); + } + + public static GraphTraversal HasNot(params object[] args) + { + return new GraphTraversal().HasNot(args); + } + + public static GraphTraversal HasValue(params object[] args) + { + return new GraphTraversal().HasValue(args); + } + + public static GraphTraversal Id(params object[] args) + { + return new GraphTraversal().Id(args); + } + + public static GraphTraversal Identity(params object[] args) + { + return new GraphTraversal().Identity(args); + } + + public static GraphTraversal In(params object[] args) + { + return new GraphTraversal().In(args); + } + + public static GraphTraversal InE(params object[] args) + { + return new GraphTraversal().InE(args); + } + + public static GraphTraversal InV(params object[] args) + { + return new GraphTraversal().InV(args); + } + + public static GraphTraversal Inject(params object[] args) + { + return new GraphTraversal().Inject(args); + } + + public static GraphTraversal Is(params object[] args) + { + return new GraphTraversal().Is(args); + } + + public static GraphTraversal Key(params object[] args) + { + return new GraphTraversal().Key(args); + } + + public static GraphTraversal Label(params object[] args) + { + return new GraphTraversal().Label(args); + } + + public static GraphTraversal Limit(params object[] args) + { + return new GraphTraversal().Limit(args); + } + + public static GraphTraversal Local(params object[] args) + { + return new GraphTraversal().Local(args); + } + + public static GraphTraversal Loops(params object[] args) + { + return new GraphTraversal().Loops(args); + } + + public static GraphTraversal Map(params object[] args) + { + return new GraphTraversal().Map(args); + } + + public static GraphTraversal MapKeys(params object[] args) + { + return new GraphTraversal().MapKeys(args); + } + + public static GraphTraversal MapValues(params object[] args) + { + return new GraphTraversal().MapValues(args); + } + + public static GraphTraversal Match(params object[] args) + { + return new GraphTraversal().Match(args); + } + + public static GraphTraversal Max(params object[] args) + { + return new GraphTraversal().Max(args); + } + + public static GraphTraversal Mean(params object[] args) + { + return new GraphTraversal().Mean(args); + } + + public static GraphTraversal Min(params object[] args) + { + return new GraphTraversal().Min(args); + } + + public static GraphTraversal Not(params object[] args) + { + return new GraphTraversal().Not(args); + } + + public static GraphTraversal Optional(params object[] args) + { + return new GraphTraversal().Optional(args); + } + + public static GraphTraversal Or(params object[] args) + { + return new GraphTraversal().Or(args); + } + + public static GraphTraversal Order(params object[] args) + { + return new GraphTraversal().Order(args); + } + + public static GraphTraversal OtherV(params object[] args) + { + return new GraphTraversal().OtherV(args); + } + + public static GraphTraversal Out(params object[] args) + { + return new GraphTraversal().Out(args); + } + + public static GraphTraversal OutE(params object[] args) + { + return new GraphTraversal().OutE(args); + } + + public static GraphTraversal OutV(params object[] args) + { + return new GraphTraversal().OutV(args); + } + + public static GraphTraversal Path(params object[] args) + { + return new GraphTraversal().Path(args); + } + + public static GraphTraversal Project(params object[] args) + { + return new GraphTraversal().Project(args); + } + + public static GraphTraversal Properties(params object[] args) + { + return new GraphTraversal().Properties(args); + } + + public static GraphTraversal Property(params object[] args) + { + return new GraphTraversal().Property(args); + } + + public static GraphTraversal PropertyMap(params object[] args) + { + return new GraphTraversal().PropertyMap(args); + } + + public static GraphTraversal Range(params object[] args) + { + return new GraphTraversal().Range(args); + } + + public static GraphTraversal Repeat(params object[] args) + { + return new GraphTraversal().Repeat(args); + } + + public static GraphTraversal Sack(params object[] args) + { + return new GraphTraversal().Sack(args); + } + + public static GraphTraversal Sample(params object[] args) + { + return new GraphTraversal().Sample(args); + } + + public static GraphTraversal Select(params object[] args) + { + return new GraphTraversal().Select(args); + } + + public static GraphTraversal SideEffect(params object[] args) + { + return new GraphTraversal().SideEffect(args); + } + + public static GraphTraversal SimplePath(params object[] args) + { + return new GraphTraversal().SimplePath(args); + } + + public static GraphTraversal Store(params object[] args) + { + return new GraphTraversal().Store(args); + } + + public static GraphTraversal Subgraph(params object[] args) + { + return new GraphTraversal().Subgraph(args); + } + + public static GraphTraversal Sum(params object[] args) + { + return new GraphTraversal().Sum(args); + } + + public static GraphTraversal Tail(params object[] args) + { + return new GraphTraversal().Tail(args); + } + + public static GraphTraversal TimeLimit(params object[] args) + { + return new GraphTraversal().TimeLimit(args); + } + + public static GraphTraversal Times(params object[] args) + { + return new GraphTraversal().Times(args); + } + + public static GraphTraversal To(params object[] args) + { + return new GraphTraversal().To(args); + } + + public static GraphTraversal ToE(params object[] args) + { + return new GraphTraversal().ToE(args); + } + + public static GraphTraversal ToV(params object[] args) + { + return new GraphTraversal().ToV(args); + } + + public static GraphTraversal Tree(params object[] args) + { + return new GraphTraversal().Tree(args); + } + + public static GraphTraversal Unfold(params object[] args) + { + return new GraphTraversal().Unfold(args); + } + + public static GraphTraversal Union(params object[] args) + { + return new GraphTraversal().Union(args); + } + + public static GraphTraversal Until(params object[] args) + { + return new GraphTraversal().Until(args); + } + + public static GraphTraversal Value(params object[] args) + { + return new GraphTraversal().Value(args); + } + + public static GraphTraversal ValueMap(params object[] args) + { + return new GraphTraversal().ValueMap(args); + } + + public static GraphTraversal Values(params object[] args) + { + return new GraphTraversal().Values(args); + } + + public static GraphTraversal Where(params object[] args) + { + return new GraphTraversal().Where(args); + } + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.CSharp/Structure/Graph.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.CSharp/Structure/Graph.cs b/gremlin-dotnet/src/Gremlin.CSharp/Structure/Graph.cs new file mode 100644 index 0000000..3ae5bef --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.CSharp/Structure/Graph.cs @@ -0,0 +1,35 @@ +#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 Gremlin.CSharp.Process; + +namespace Gremlin.CSharp.Structure +{ + public class Graph + { + public GraphTraversalSource Traversal() + { + return new GraphTraversalSource(); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Gremlin.Net.Process.csproj ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Gremlin.Net.Process.csproj b/gremlin-dotnet/src/Gremlin.Net.Process/Gremlin.Net.Process.csproj new file mode 100644 index 0000000..5e2d7fc --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Gremlin.Net.Process.csproj @@ -0,0 +1,24 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <Version>3.2.5-SNAPSHOT</Version> + <TargetFramework>netstandard1.3</TargetFramework> + <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> + <Authors>Apache TinkerPop</Authors> + <PackageTags>gremlin;tinkerpop;gremlin-dotnet</PackageTags> + <Description>This package provides implementations and interfaces for Gremlin language variants.</Description> + </PropertyGroup> + + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> + <DocumentationFile></DocumentationFile> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Microsoft.CSharp" Version="4.3.0" /> + <PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" /> + </ItemGroup> + +</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/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 new file mode 100644 index 0000000..8555cb3 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Remote/IRemoteConnection.cs @@ -0,0 +1,42 @@ +#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.Threading.Tasks; +using Gremlin.Net.Process.Traversal; + +namespace Gremlin.Net.Process.Remote +{ + /// <summary> + /// A simple abstraction of a "connection" to a "server". + /// </summary> + public interface IRemoteConnection + { + /// <summary> + /// Submits <see cref="ITraversal" /> <see cref="Bytecode" /> to a server and returns a + /// <see cref="ITraversal" />. + /// </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); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/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 new file mode 100644 index 0000000..4826113 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Remote/RemoteStrategy.cs @@ -0,0 +1,61 @@ +#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.Threading.Tasks; +using Gremlin.Net.Process.Traversal; + +namespace Gremlin.Net.Process.Remote +{ + /// <summary> + /// Reconstructs a <see cref="ITraversal" /> by submitting it to a remote server via an + /// <see cref="IRemoteConnection" /> instance. + /// </summary> + public class RemoteStrategy : ITraversalStrategy + { + private readonly IRemoteConnection _remoteConnection; + + /// <summary> + /// Initializes a new instance of the <see cref="RemoteStrategy" /> class. + /// </summary> + /// <param name="remoteConnection">The <see cref="IRemoteConnection" /> that should be used.</param> + public RemoteStrategy(IRemoteConnection remoteConnection) + { + _remoteConnection = remoteConnection; + } + + /// <inheritdoc /> + public void Apply(ITraversal traversal) + { + ApplyAsync(traversal).Wait(); + } + + /// <inheritdoc /> + public async Task ApplyAsync(ITraversal traversal) + { + if (traversal.Traversers != null) return; + var remoteTraversal = await _remoteConnection.SubmitAsync(traversal.Bytecode).ConfigureAwait(false); + traversal.SideEffects = remoteTraversal.SideEffects; + traversal.Traversers = remoteTraversal.Traversers; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Binding.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Binding.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Binding.cs new file mode 100644 index 0000000..80c8269 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Binding.cs @@ -0,0 +1,80 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +using System; + +namespace Gremlin.Net.Process.Traversal +{ + /// <summary> + /// Associates a variable with a value. + /// </summary> + public class Binding : IEquatable<Binding> + { + /// <summary> + /// Initializes a new instance of the <see cref="Binding" /> class. + /// </summary> + /// <param name="key">The key that identifies the <see cref="Binding" />.</param> + /// <param name="value">The value of the <see cref="Binding" />.</param> + public Binding(string key, object value) + { + Key = key; + Value = value; + } + + /// <summary> + /// Gets the key that identifies the <see cref="Binding" />. + /// </summary> + public string Key { get; } + + /// <summary> + /// Gets the value of the <see cref="Binding" />. + /// </summary> + public object Value { get; } + + /// <inheritdoc /> + public bool Equals(Binding other) + { + if (other == null) + return false; + return Key == other.Key && Value.Equals(other.Value); + } + + /// <inheritdoc /> + public override bool Equals(object other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + if (other.GetType() != GetType()) return false; + return Equals(other as Binding); + } + + /// <inheritdoc /> + public override int GetHashCode() + { + unchecked + { + return ((Key?.GetHashCode() ?? 0) * 397) ^ (Value?.GetHashCode() ?? 0); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Bindings.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Bindings.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Bindings.cs new file mode 100644 index 0000000..985369e --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Bindings.cs @@ -0,0 +1,42 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +namespace Gremlin.Net.Process.Traversal +{ + /// <summary> + /// Bindings are used to associate a variable with a value. + /// </summary> + public class Bindings + { + /// <summary> + /// Binds the variable to the specified value. + /// </summary> + /// <param name="variable">The variable to bind.</param> + /// <param name="value">The value to which the variable should be bound.</param> + /// <returns>The bound value.</returns> + public Binding Of(string variable, object value) + { + return new Binding(variable, value); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Bytecode.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Bytecode.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Bytecode.cs new file mode 100644 index 0000000..b35e8db --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Bytecode.cs @@ -0,0 +1,85 @@ +#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 +{ + /// <summary> + /// A language agnostic representation of <see cref="ITraversal" /> mutations. + /// </summary> + /// <remarks> + /// Bytecode is simply a list of ordered instructions. + /// Bytecode can be serialized between environments and machines by way of a GraphSON representation. + /// Thus, Gremlin-CSharp can create bytecode in C# and ship it to Gremlin-Java for evaluation in Java. + /// </remarks> + public class Bytecode + { + /// <summary> + /// Initializes a new instance of the <see cref="Bytecode" /> class. + /// </summary> + public Bytecode() + { + } + + /// <summary> + /// Initializes a new instance of the <see cref="Bytecode" /> class. + /// </summary> + /// <param name="byteCode">Already existing <see cref="Bytecode" /> that should be cloned.</param> + public Bytecode(Bytecode byteCode) + { + SourceInstructions = new List<Instruction>(byteCode.SourceInstructions); + StepInstructions = new List<Instruction>(byteCode.StepInstructions); + } + + /// <summary> + /// Gets the traversal source instructions. + /// </summary> + public List<Instruction> SourceInstructions { get; } = new List<Instruction>(); + + /// <summary> + /// Gets the <see cref="ITraversal" /> instructions. + /// </summary> + public List<Instruction> StepInstructions { get; } = new List<Instruction>(); + + /// <summary> + /// Add a traversal source instruction to the bytecode. + /// </summary> + /// <param name="sourceName">The traversal source method name (e.g. withSack()).</param> + /// <param name="args">The traversal source method arguments.</param> + public void AddSource(string sourceName, params object[] args) + { + SourceInstructions.Add(new Instruction(sourceName, args)); + } + + /// <summary> + /// Adds a <see cref="ITraversal" /> instruction to the bytecode. + /// </summary> + /// <param name="stepName">The traversal method name (e.g. out()).</param> + /// <param name="args">The traversal method arguments.</param> + public void AddStep(string stepName, params object[] args) + { + StepInstructions.Add(new Instruction(stepName, args)); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/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 new file mode 100644 index 0000000..86c636c --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/DefaultTraversal.cs @@ -0,0 +1,195 @@ +#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; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Gremlin.Net.Process.Traversal +{ + /// <summary> + /// A traversal represents a directed walk over a graph. + /// </summary> + public abstract class DefaultTraversal : ITraversal + { + private IEnumerator<Traverser> _traverserEnumerator; + + /// <summary> + /// Gets the <see cref="Bytecode" /> representation of this traversal. + /// </summary> + public Bytecode Bytecode { get; protected set; } + + /// <summary> + /// Gets or sets the <see cref="ITraversalSideEffects" /> of this traversal. + /// </summary> + public ITraversalSideEffects SideEffects { get; set; } + + /// <summary> + /// Gets or sets the <see cref="Traverser" />'s of this traversal that hold the results of the traversal. + /// </summary> + public IEnumerable<Traverser> Traversers { get; set; } + + /// <summary> + /// Gets or sets the <see cref="ITraversalStrategy" /> strategies of this traversal. + /// </summary> + protected ICollection<ITraversalStrategy> TraversalStrategies { get; set; } = new List<ITraversalStrategy>(); + + private IEnumerator<Traverser> TraverserEnumerator + => _traverserEnumerator ?? (_traverserEnumerator = GetTraverserEnumerator()); + + /// <inheritdoc /> + public void Dispose() + { + Dispose(true); + } + + /// <inheritdoc /> + public bool MoveNext() + { + var currentTraverser = TraverserEnumerator.Current; + if (currentTraverser?.Bulk > 1) + { + currentTraverser.Bulk--; + return true; + } + return TraverserEnumerator.MoveNext(); + } + + /// <summary> + /// Reset is not supported. + /// </summary> + /// <exception cref="NotSupportedException">Thrown always as this operation is not supported.</exception> + public void Reset() + { + throw new NotSupportedException(); + } + + /// <inheritdoc /> + public object Current => TraverserEnumerator.Current?.Object; + + private IEnumerator<Traverser> GetTraverserEnumerator() + { + if (Traversers == null) + ApplyStrategies(); + return Traversers.GetEnumerator(); + } + + private void ApplyStrategies() + { + foreach (var strategy in TraversalStrategies) + strategy.Apply(this); + } + + private async Task ApplyStrategiesAsync() + { + foreach (var strategy in TraversalStrategies) + await strategy.ApplyAsync(this).ConfigureAwait(false); + } + + /// <summary> + /// Gets the next result from the traversal. + /// </summary> + /// <returns>The result.</returns> + public object Next() + { + MoveNext(); + return Current; + } + + /// <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> + public IEnumerable<object> Next(int amount) + { + for (var i = 0; i < amount; i++) + yield return Next(); + } + + /// <summary> + /// Iterates all <see cref="Traverser" /> instances in the traversal. + /// </summary> + /// <returns>The fully drained traversal.</returns> + public ITraversal Iterate() + { + while (MoveNext()) + { + } + return this; + } + + /// <summary> + /// Gets the next <see cref="Traverser" />. + /// </summary> + /// <returns>The next <see cref="Traverser" />.</returns> + public Traverser NextTraverser() + { + TraverserEnumerator.MoveNext(); + return TraverserEnumerator.Current; + } + + /// <summary> + /// Puts all the results into a <see cref="List{T}" />. + /// </summary> + /// <returns>The results in a list.</returns> + public List<object> ToList() + { + var objs = new List<object>(); + while (MoveNext()) + objs.Add(Current); + return objs; + } + + /// <summary> + /// Puts all the results into a <see cref="HashSet{T}" />. + /// </summary> + /// <returns>The results in a set.</returns> + public HashSet<object> ToSet() + { + var objs = new HashSet<object>(); + while (MoveNext()) + objs.Add(Current); + return objs; + } + + /// <inheritdoc /> + protected virtual void Dispose(bool disposing) + { + if (disposing) + SideEffects?.Dispose(); + } + + /// <summary> + /// Starts a promise to execute a function on the current traversal that will be completed in the future. + /// </summary> + /// <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) + { + await ApplyStrategiesAsync().ConfigureAwait(false); + return callback(this); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/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 new file mode 100644 index 0000000..cb472b7 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/ITraversal.cs @@ -0,0 +1,96 @@ +#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; +using System.Collections; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Gremlin.Net.Process.Traversal +{ + /// <summary> + /// A traversal represents a directed walk over a graph. + /// </summary> + public interface ITraversal : IDisposable, IEnumerator + { + /// <summary> + /// Gets the <see cref="Bytecode" /> representation of this traversal. + /// </summary> + Bytecode Bytecode { get; } + + /// <summary> + /// Gets or sets the <see cref="ITraversalSideEffects" /> of this traversal. + /// </summary> + ITraversalSideEffects SideEffects { get; set; } + + /// <summary> + /// 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> + /// Gets the next result from the traversal. + /// </summary> + /// <returns>The result.</returns> + object 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); + + /// <summary> + /// Iterates all <see cref="Traverser" /> instances in the traversal. + /// </summary> + /// <returns>The fully drained traversal.</returns> + ITraversal Iterate(); + + /// <summary> + /// Gets the next <see cref="Traverser" />. + /// </summary> + /// <returns>The next <see cref="Traverser" />.</returns> + Traverser NextTraverser(); + + /// <summary> + /// Puts all the results into a <see cref="List{T}" />. + /// </summary> + /// <returns>The results in a list.</returns> + List<object> ToList(); + + /// <summary> + /// Puts all the results into a <see cref="HashSet{T}" />. + /// </summary> + /// <returns>The results in a set.</returns> + HashSet<object> ToSet(); + + /// <summary> + /// Starts a promise to execute a function on the current traversal that will be completed in the future. + /// </summary> + /// <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); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/ITraversalSideEffects.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/ITraversalSideEffects.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/ITraversalSideEffects.cs new file mode 100644 index 0000000..0378fe6 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/ITraversalSideEffects.cs @@ -0,0 +1,52 @@ +#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; +using System.Collections.Generic; + +namespace Gremlin.Net.Process.Traversal +{ + /// <summary> + /// A <see cref="ITraversal" /> can maintain global sideEffects. + /// </summary> + public interface ITraversalSideEffects : IDisposable + { + /// <summary> + /// Retrieves the keys of the side-effect that can be supplied to <see cref="Get" />. + /// </summary> + /// <returns>The keys of the side-effect.</returns> + IReadOnlyCollection<string> Keys(); + + /// <summary> + /// Gets the side-effect associated with the provided key. + /// </summary> + /// <param name="key">The key to get the value for.</param> + /// <returns>The value associated with key.</returns> + object Get(string key); + + /// <summary> + /// Invalidates the side effect cache for traversal. + /// </summary> + void Close(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/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 new file mode 100644 index 0000000..991a807 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/ITraversalStrategy.cs @@ -0,0 +1,46 @@ +#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.Threading.Tasks; + +namespace Gremlin.Net.Process.Traversal +{ + /// <summary> + /// A <see cref="ITraversalStrategy" /> defines a particular atomic operation for mutating a + /// <see cref="ITraversal" /> prior to its evaluation. + /// </summary> + public interface ITraversalStrategy + { + /// <summary> + /// 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); + + /// <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); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Instruction.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Instruction.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Instruction.cs new file mode 100644 index 0000000..195b7bf --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Instruction.cs @@ -0,0 +1,52 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +namespace Gremlin.Net.Process.Traversal +{ + /// <summary> + /// Represents a <see cref="Bytecode" /> instruction by an operator name and its arguments. + /// </summary> + public class Instruction + { + /// <summary> + /// Initializes a new instance of the <see cref="Instruction" /> class. + /// </summary> + /// <param name="operatorName">The name of the operator.</param> + /// <param name="arguments">The arguments.</param> + public Instruction(string operatorName, params dynamic[] arguments) + { + OperatorName = operatorName; + Arguments = arguments; + } + + /// <summary> + /// Gets the name of the operator. + /// </summary> + public string OperatorName { get; } + + /// <summary> + /// Gets the arguments. + /// </summary> + public dynamic[] Arguments { get; } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/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 new file mode 100644 index 0000000..8c9666c --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/AbstractTraversalStrategy.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; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Gremlin.Net.Process.Traversal.Strategy +{ + /// <summary> + /// Provides a common base class for strategies that are only included in <see cref="Bytecode" /> + /// to be applied remotely. + /// </summary> + public abstract class AbstractTraversalStrategy : ITraversalStrategy, IEquatable<AbstractTraversalStrategy> + { + /// <summary> + /// Gets the name of the strategy. + /// </summary> + public string StrategyName => GetType().Name; + + /// <summary> + /// Gets the configuration of the strategy. + /// </summary> + public Dictionary<string, dynamic> Configuration { get; } = new Dictionary<string, dynamic>(); + + /// <inheritdoc /> + public bool Equals(AbstractTraversalStrategy other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return StrategyName == other.StrategyName; + } + + /// <inheritdoc /> + public virtual void Apply(ITraversal traversal) + { + } + + /// <inheritdoc /> + public virtual Task ApplyAsync(ITraversal traversal) + { + return Task.CompletedTask; + } + + /// <inheritdoc /> + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != GetType()) return false; + return Equals((AbstractTraversalStrategy) obj); + } + + /// <inheritdoc /> + public override int GetHashCode() + { + return StrategyName.GetHashCode(); + } + + /// <inheritdoc /> + public override string ToString() + { + return StrategyName; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/ConnectiveStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/ConnectiveStrategy.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/ConnectiveStrategy.cs new file mode 100644 index 0000000..2bca7c2 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/ConnectiveStrategy.cs @@ -0,0 +1,33 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +namespace Gremlin.Net.Process.Traversal.Strategy.Decoration +{ + /// <summary> + /// ConnectiveStrategy rewrites the binary conjunction form of <c>a.and().b</c> into an AndStep of + /// <c>and(a, b)</c> (likewise for OrStep). + /// </summary> + public class ConnectiveStrategy : AbstractTraversalStrategy + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/ElementIdStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/ElementIdStrategy.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/ElementIdStrategy.cs new file mode 100644 index 0000000..6079f58 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/ElementIdStrategy.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.Net.Process.Traversal.Strategy.Decoration +{ + /// <summary> + /// Provides a degree of control over element identifier assignment as some graphs don't provide that feature. + /// </summary> + public class ElementIdStrategy : AbstractTraversalStrategy + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/HaltedTraverserStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/HaltedTraverserStrategy.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/HaltedTraverserStrategy.cs new file mode 100644 index 0000000..98f949c --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/HaltedTraverserStrategy.cs @@ -0,0 +1,34 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +namespace Gremlin.Net.Process.Traversal.Strategy.Decoration +{ + public class HaltedTraverserStrategy : AbstractTraversalStrategy + { + public HaltedTraverserStrategy(string haltedTraverserFactoryName = null) + { + if (haltedTraverserFactoryName != null) + Configuration["haltedTraverserFactory"] = haltedTraverserFactoryName; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/PartitionStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/PartitionStrategy.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/PartitionStrategy.cs new file mode 100644 index 0000000..f89037b --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/PartitionStrategy.cs @@ -0,0 +1,56 @@ +#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.Strategy.Decoration +{ + /// <summary> + /// Partitions the vertices, edges and vertex properties of a graph into String named partitions. + /// </summary> + public class PartitionStrategy : AbstractTraversalStrategy + { + /// <summary> + /// Initializes a new instance of the <see cref="PartitionStrategy" /> class. + /// </summary> + /// <param name="partitionKey">Specifies the partition key name.</param> + /// <param name="writePartition"> + /// Specifies the name of the partition to write when adding vertices, edges and vertex + /// properties. + /// </param> + /// <param name="readPartitions">Specifies the partition of the graph to read from.</param> + /// <param name="includeMetaProperties">Set to true if vertex properties should get assigned to partitions.</param> + public PartitionStrategy(string partitionKey = null, string writePartition = null, + IEnumerable<string> readPartitions = null, bool? includeMetaProperties = null) + { + if (partitionKey != null) + Configuration["partitionKey"] = partitionKey; + if (writePartition != null) + Configuration["writePartition"] = writePartition; + if (readPartitions != null) + Configuration["readPartitions"] = readPartitions; + if (includeMetaProperties != null) + Configuration["includeMetaProperties"] = includeMetaProperties.Value; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/SubgraphStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/SubgraphStrategy.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/SubgraphStrategy.cs new file mode 100644 index 0000000..2f0d23e --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/SubgraphStrategy.cs @@ -0,0 +1,48 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +namespace Gremlin.Net.Process.Traversal.Strategy.Decoration +{ + /// <summary> + /// Provides a way to limit the view of a <see cref="ITraversal" />. + /// </summary> + public class SubgraphStrategy : AbstractTraversalStrategy + { + /// <summary> + /// Initializes a new instance of the <see cref="SubgraphStrategy" /> class. + /// </summary> + /// <param name="vertexCriterion">Constrains vertices for the <see cref="ITraversal" />.</param> + /// <param name="edgeCriterion">Constrains edges for the <see cref="ITraversal" />.</param> + /// <param name="vertexPropertyCriterion">Constrains vertex properties for the <see cref="ITraversal" />.</param> + public SubgraphStrategy(ITraversal vertexCriterion = null, ITraversal edgeCriterion = null, + ITraversal vertexPropertyCriterion = null) + { + if (vertexCriterion != null) + Configuration["vertices"] = vertexCriterion; + if (edgeCriterion != null) + Configuration["edges"] = edgeCriterion; + if (vertexPropertyCriterion != null) + Configuration["vertexProperties"] = vertexPropertyCriterion; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/VertexProgramStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/VertexProgramStrategy.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/VertexProgramStrategy.cs new file mode 100644 index 0000000..1c5b5f2 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Decoration/VertexProgramStrategy.cs @@ -0,0 +1,50 @@ +#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 System.Linq; + +namespace Gremlin.Net.Process.Traversal.Strategy.Decoration +{ + public class VertexProgramStrategy : AbstractTraversalStrategy + { + public VertexProgramStrategy(string graphComputer = null, int? workers = null, string persist = null, + string result = null, ITraversal vertices = null, ITraversal edges = null, + Dictionary<string, dynamic> configuration = null) + { + if (graphComputer != null) + Configuration["graphComputer"] = graphComputer; + if (workers != null) + Configuration["workers"] = workers; + if (persist != null) + Configuration["persist"] = persist; + if (result != null) + Configuration["result"] = result; + if (vertices != null) + Configuration["vertices"] = vertices; + if (edges != null) + Configuration["edges"] = edges; + configuration?.ToList().ForEach(x => Configuration[x.Key] = x.Value); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Finalization/MatchAlgorithmStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Finalization/MatchAlgorithmStrategy.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Finalization/MatchAlgorithmStrategy.cs new file mode 100644 index 0000000..11a9e2c --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Finalization/MatchAlgorithmStrategy.cs @@ -0,0 +1,34 @@ +#region License + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#endregion + +namespace Gremlin.Net.Process.Traversal.Strategy.Finalization +{ + public class MatchAlgorithmStrategy : AbstractTraversalStrategy + { + public MatchAlgorithmStrategy(string matchAlgorithm = null) + { + if (matchAlgorithm != null) + Configuration["matchAlgorithm"] = matchAlgorithm; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/37a24719/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Optimization/AdjacentToIncidentStrategy.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Optimization/AdjacentToIncidentStrategy.cs b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Optimization/AdjacentToIncidentStrategy.cs new file mode 100644 index 0000000..bae85d7 --- /dev/null +++ b/gremlin-dotnet/src/Gremlin.Net.Process/Traversal/Strategy/Optimization/AdjacentToIncidentStrategy.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.Net.Process.Traversal.Strategy.Optimization +{ + /// <summary> + /// Optimizes vertex- and value-emitting steps. + /// </summary> + public class AdjacentToIncidentStrategy : AbstractTraversalStrategy + { + } +} \ No newline at end of file
