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

北慕城南 提交于 2019-12-24 17:12:54

问题


I am new in janusgraph and tinkerpop. I am using Gremlin.Net 3.2.7 to connect to janusgraph and all the request that return vertexes work fine for me but when I run any operation that return edges like "g.V(61464).outE('father').toList()" an exception in the library:

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

the server didn't throw any exception, the serializes configuration are the default:

serializers:

 - { 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] }}

but its working fine in the gremlin-client console. do you have any suggestion plz?


回答1:


It looks like JanusGraph serializes edges in its own format as RelationIdentifiers which aren't part of TinkerPop. So Gremlin.Net has no deserializer for this type. This means that you either have to implement your own GraphSON deserializer for this type or you change your Gremlin query to not return edges directly.

The TinkerPop docs contain an example on how to write a deserializer for Gremlin.Net. (Note that you only have to implement an IGraphSONDeserializer, not IGraphSONSerializer as that's only used for writing.)

Or, if you instead want to change your Gremlin traversal, than you can for example just return the edge properties:

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

BTW: It looks like you are sending your Gremlin traversals in the form of Gremlin-Groovy strings to the JanusGraph server. You can instead also write Gremlin traversals directly in C# with Gremlin.Net. This makes it not only easier to write the traversal, but the execution is also more efficient on the server-side.



来源:https://stackoverflow.com/questions/48239255/gremlin-net-system-invalidoperationexception-deserializer-for-janusgraphrela

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!