【问题标题】:Gremlin.Net System.InvalidOperationException: 'Deserializer for "janusgraph:RelationIdentifier" not found' exceptionGremlin.Net System.InvalidOperationException:“未找到“janusgraph:RelationIdentifier”的反序列化程序”异常
【发布时间】:2018-06-22 16:23:28
【问题描述】:

我是 janusgraph 和 tinkerpop 的新手。我正在使用 Gremlin.Net 3.2.7 连接到 janusgraph,所有返回顶点的请求对我来说都可以正常工作,但是当我运行任何返回边的操作时,例如 "gV(61464).outE('father')。 toList()" 库中的异常:

System.InvalidOperationException: '反序列化器 “janusgraph:RelationIdentifier”未找到'

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

序列化器:

 - { 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 开发一个 .NET 库,该库扩展 Gremlin.Net 以支持 JanusGraph 特定类型。初始版本目前正在审核中,如果您或社区中的任何其他人对改进 JanusGraph .NET 支持感兴趣,那么您可以帮助对其进行审核:github.com/JanusGraph/janusgraph-dotnet/pull/1

标签: c# gremlin janusgraph gremlin-server


【解决方案1】:

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

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

或者,如果您想更改 Gremlin 遍历,例如,您可以只返回边缘属性:

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

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

【讨论】:

  • 它为边缘工作谢谢,但你说我不能在同一个查询中返回边缘和顶点,对吗?如果我愿意,我必须实现它的序列化。我对 Gremlin.Net 库有一些疑问,但我会将它们放入一个新问题中,以便其他开发人员可以轻松访问。
  • 通常你可以在同一个查询中返回边和顶点。这只是来自 JanusGraph 的边的反序列化问题。除此之外,您可以在 Gremlin 中的相同查询中返回顶点和边:g.V(1).as('v').outE().limit(1).as('e').select('v','e')。在 GremlinBin:gremlinbin.com/bin/view/5a5a276f2422b
  • @janusgraph - 我面临着类似的问题。在这里需要您的支持帮助stackoverflow.com/questions/60263542/…
猜你喜欢
  • 2014-06-04
  • 1970-01-01
  • 2020-08-15
  • 1970-01-01
  • 2020-09-18
  • 2012-10-05
  • 1970-01-01
  • 2017-07-09
相关资源
最近更新 更多