Gremlin.Net System.InvalidOperationException: 'Deserializer for "janusgraph:RelationIdentifier" not found' 异常

Gremlin.Net System.InvalidOperationException: 'Deserializer for "janusgraph:RelationIdentifier" not found' exception

我是 janusgraph 和 tinkerpop 的新手。我正在使用 Gremlin.Net 3.2.7 连接到 janusgraph 并且所有 return 顶点的请求对我来说工作正常但是当我 运行 任何 return 边缘的操作时 "g.V(61464).outE('father').toList()"库异常:

System.InvalidOperationException: 'Deserializer for "janusgraph:RelationIdentifier" not found'

服务器没有抛出任何异常,序列化配置是默认的:

序列化程序:

 - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
 - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
 - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
 - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
 - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
 - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}

但它在 gremlin-client 控制台中工作正常。请问各位有什么建议吗?

看起来 JanusGraph 以自己的格式将边序列化为 RelationIdentifiers,这不是 TinkerPop 的一部分。所以 Gremlin.Net 没有这种类型的反序列化器。这意味着您要么必须为此类型实现自己的 GraphSON 反序列化器,要么将 Gremlin 查询更改为不直接 return 边缘。

TinkerPop 文档包含 example on how to write a deserializer for Gremlin.Net。 (请注意,您只需实现 IGraphSONDeserializer,而不是 IGraphSONSerializer,因为它仅用于写入。)

或者,如果你想改变你的 Gremlin 遍历,那么你可以 return 边缘属性:

g.V(61464).OutE("father").ValueMap<object>().ToList();

顺便说一句:看起来您正在以 Gremlin-Groovy 字符串的形式将您的 Gremlin 遍历发送到 JanusGraph 服务器。您也可以写 Gremlin traversals directly in C# with Gremlin.Net。这样不仅写遍历更容易,而且在服务器端执行也更高效。