Error when trying to read ElementMap from Edge in Gremlin.Net: The given key 'janusgraph.RelationIdentifier' was not present in the dictionary #gremlin-dotnet


tormodhau@...
 

Hi!

When I try to read the ElementMap of an edge in Gremlin.Net:

        var edgeValues = g.E()
            .Has("Mrid", "..guid..")
            .ElementMap<object>()
            .Next();            // <---- Throws here

I get the following error:

       System.Collections.Generic.KeyNotFoundException : The given key 'janusgraph.RelationIdentifier' was not present in the dictionary.

Environment:

       JanusGraph, ElasticSearch, Cassandra (the official docker-compose running locally)
       Gremlin.Net 3.6.1
       Dotnet Core 6.4.0

Full example (unit test with xUnit):
       
    [Fact]
    public void AddingEdgeBetweenTwoVertexes()
    {
        // Start a Janusgraph + Cassandra + ElasticSearch environment with docker compose:
        // https://github.com/JanusGraph/janusgraph-docker/blob/master/docker-compose-cql-es.yml
        var gremlinServer = new GremlinServer("localhost", 8182);
        var gremlinClient = new GremlinClient(gremlinServer);
        var remoteConnection = new DriverRemoteConnection(gremlinClient, "g");
        var g = AnonymousTraversalSource.Traversal().WithRemote(remoteConnection);
        g.V().Drop().Iterate();
        g.E().Drop().Iterate();
 
        var firstMrid = Guid.NewGuid();
        g.AddV("V1")
            .Property("Mrid", firstMrid)
            .Iterate();
 
        var secondMrid = Guid.NewGuid();
        g.AddV("V2")
            .Property("Mrid", secondMrid)
            .Iterate();
 
        var edgeMrid = Guid.NewGuid();
        g.AddE("E1")
            .Property("Mrid", edgeMrid)
            .Property("Name", "Hello Edge")
            .From(__.V().Has("Mrid", firstMrid))
            .To(__.V().Has("Mrid", secondMrid))
            .Iterate();
 
        // Verify that two vertices and one edge is added
        Assert.Equal(1, g.E().Count().Next());
        Assert.Equal(2, g.V().Count().Next());
 
        var edgeValues = g.E()
            .Has("Mrid", edgeMrid)
            .ElementMap<object>()
            .Next();            // <---- Throws here
 
        Assert.Equal("Hello Edge", edgeValues["Name"]);
    }

Full error:


     [xUnit.net 00:00:02.06]     tests.Graph.GremlinExplorationTest.AddingEdgeBetweenTwoVertexes_ [FAIL]
  Failed tests.Graph.GremlinExplorationTest.AddingEdgeBetweenTwoVertexes_ [465 ms]
  Error Message:
   System.Collections.Generic.KeyNotFoundException : The given key 'janusgraph.RelationIdentifier' was not present in the dictionary.
  Stack Trace:
     at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Gremlin.Net.Structure.IO.GraphBinary.TypeSerializerRegistry.GetSerializerForCustomType(String typeName)
   at Gremlin.Net.Structure.IO.GraphBinary.GraphBinaryReader.ReadAsync(Stream stream)
   at Gremlin.Net.Structure.IO.GraphBinary.Types.MapSerializer`2.ReadValueAsync(Stream stream, GraphBinaryReader reader)
   at Gremlin.Net.Structure.IO.GraphBinary.Types.SimpleTypeSerializer`1.ReadValueAsync(Stream stream, GraphBinaryReader reader, Boolean nullable)
   at Gremlin.Net.Structure.IO.GraphBinary.Types.SimpleTypeSerializer`1.ReadAsync(Stream stream, GraphBinaryReader reader)
   at Gremlin.Net.Structure.IO.GraphBinary.GraphBinaryReader.ReadAsync(Stream stream)
   at Gremlin.Net.Structure.IO.GraphBinary.Types.TraverserSerializer.ReadValueAsync(Stream stream, GraphBinaryReader reader)
   at Gremlin.Net.Structure.IO.GraphBinary.Types.SimpleTypeSerializer`1.ReadValueAsync(Stream stream, GraphBinaryReader reader, Boolean nullable)
   at Gremlin.Net.Structure.IO.GraphBinary.Types.SimpleTypeSerializer`1.ReadAsync(Stream stream, GraphBinaryReader reader)
   at Gremlin.Net.Structure.IO.GraphBinary.GraphBinaryReader.ReadAsync(Stream stream)
   at Gremlin.Net.Structure.IO.GraphBinary.Types.ListSerializer`1.ReadValueAsync(Stream stream, GraphBinaryReader reader)
   at Gremlin.Net.Structure.IO.GraphBinary.Types.SimpleTypeSerializer`1.ReadValueAsync(Stream stream, GraphBinaryReader reader, Boolean nullable)
   at Gremlin.Net.Structure.IO.GraphBinary.Types.SimpleTypeSerializer`1.ReadAsync(Stream stream, GraphBinaryReader reader)
   at Gremlin.Net.Structure.IO.GraphBinary.GraphBinaryReader.ReadAsync(Stream stream)
   at Gremlin.Net.Structure.IO.GraphBinary.ResponseMessageSerializer.ReadValueAsync(MemoryStream stream, GraphBinaryReader reader)
   at Gremlin.Net.Structure.IO.GraphBinary.GraphBinaryMessageSerializer.DeserializeMessageAsync(Byte[] message)
   at Gremlin.Net.Driver.Connection.HandleReceivedAsync(Byte[] received)
   at Gremlin.Net.Driver.Connection.ReceiveMessagesAsync()
   at Gremlin.Net.Driver.ProxyConnection.SubmitAsync[T](RequestMessage requestMessage)
   at Gremlin.Net.Driver.GremlinClient.SubmitAsync[T](RequestMessage requestMessage)
   at Gremlin.Net.Driver.Remote.DriverRemoteConnection.SubmitBytecodeAsync(Guid requestid, Bytecode bytecode)
   at Gremlin.Net.Driver.Remote.DriverRemoteConnection.SubmitAsync[S,E](Bytecode bytecode)
   at Gremlin.Net.Process.Remote.RemoteStrategy.ApplyAsync[S,E](ITraversal`2 traversal)
   at Gremlin.Net.Process.Utils.WaitUnwrap(Task task)
   at Gremlin.Net.Process.Remote.RemoteStrategy.Apply[S,E](ITraversal`2 traversal)
   at Gremlin.Net.Process.Traversal.DefaultTraversal`2.ApplyStrategies()
   at Gremlin.Net.Process.Traversal.DefaultTraversal`2.GetTraverserEnumerator()
   at Gremlin.Net.Process.Traversal.DefaultTraversal`2.get_TraverserEnumerator()
   at Gremlin.Net.Process.Traversal.DefaultTraversal`2.MoveNextInternal()
   at Gremlin.Net.Process.Traversal.DefaultTraversal`2.MoveNext()
   at Gremlin.Net.Process.Traversal.DefaultTraversal`2.Next()
   at tests.Graph.GremlinExplorationTest.AddingEdgeBetweenTwoVertexes_() in /Users/tormodhaugene/customers/volue/spark-grid/tests/Graph/GremlinExplorationTest.cs:line 130
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)


Does anyone know what this error means or how to avoid it? I am at a loss on how to debug it.

- Tormod

Join {janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.