Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
3.4.4
-
None
-
None
Description
It looks like dotnet version does not support selecting multiple vertices by aliases and following syntax always throws an exception
Select("key1", "key2").By(__.ValueMap(true))
System.InvalidCastException: 'Unable to cast object of type 'System.Collections.Generic.Dictionary`2[System.Object,System.Object]' to type 'Gremlin.Net.Structure.Vertex'.'
Steps to reproduce:
1. Create following test graph
graph = TinkerGraph.open();
g = graph.traversal();
g.addV().property("name", "B").
addV().property("name", "A");
2. Query from Gremlin console to verify that query syntax is OK
g.V().has("name", "A").as("a").out().has("name", "B").as("b").select("a", "b").by(valueMap(true))
3. Query from .net to get an exception
g.V().Has("name", "A").As("a").Out().Has("name", "B").as("b").Select<object>("a", "b").By(__.ValueMap<object, object>(true)).ToList()
Hack fix that works
My hacky fix was to create "ByDictionary" method similar to "By", but I could not figure out how to add a proper override to "By"
public GraphTraversal<S, Dictionary<object, object>> ByDictionary(ITraversal traversal)
{ Bytecode.AddStep("by", traversal); return Wrap<S, Dictionary<object, object>>(this); }