TINKERPOP-1865 Use lambda to retrieve edges for gherkin scenarios
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7b9488d9 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7b9488d9 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7b9488d9 Branch: refs/heads/TINKERPOP-1865 Commit: 7b9488d981593066b3be454bec6ee34de9e6cf36 Parents: bf84eed Author: Jorge Bay Gondra <[email protected]> Authored: Tue Mar 20 09:34:12 2018 +0100 Committer: Jorge Bay Gondra <[email protected]> Committed: Tue Mar 20 09:37:28 2018 +0100 ---------------------------------------------------------------------- .../Gherkin/ScenarioData.cs | 24 ++++++-------------- 1 file changed, 7 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7b9488d9/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs index 5aa6a12..02ee132 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs @@ -30,7 +30,6 @@ using Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection; using Gremlin.Net.Process.Remote; using Gremlin.Net.Process.Traversal; using Gremlin.Net.Structure; -using static Gremlin.Net.Process.Traversal.__; namespace Gremlin.Net.IntegrationTest.Gherkin { @@ -119,12 +118,13 @@ namespace Gremlin.Net.IntegrationTest.Gherkin { try { - var edgeByEdgeRepr = new Dictionary<string, Edge>(); - foreach (var edge in g.E().ToList()) - { - edgeByEdgeRepr[GetEdgeKey(g, edge)] = edge; - } - return edgeByEdgeRepr; + IFunction lambda = Lambda.Groovy( + "it.outVertex().value('name') + '-' + it.label() + '->' + it.inVertex().value('name')"); + + return g.E().Group<string, Edge>() + .By(lambda) + .By(__.Tail<object>()) + .Next(); } catch (ResponseException) { @@ -132,16 +132,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin return EmptyEdges; } } - - private static string GetEdgeKey(GraphTraversalSource g, Edge edge) - { - var edgeRepr = g.E(edge.Id).Project<string>("o", "l", "i") - .By(OutV().Values<string>("name")) - .By(Label()) - .By(InV().Values<string>("name")) - .Next(); - return edgeRepr["o"] + "-" + edgeRepr["l"] + "->" + edgeRepr["i"]; - } } internal class ScenarioDataPerGraph
