Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2331

Select(<multiple keys>).By(__ValueMap(true)) throws "Unable to cast" exception

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 3.4.4
    • Fix Version/s: None
    • Component/s: dotnet
    • Labels:
      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); }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tombrown Tom Brown
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: