Gremlin-TypeError:GraphTraversal类型的对象不可JSON序列化

时间:2019-07-19 15:03:00

标签: gremlin janusgraph gremlin-server

下面这段gremlin代码在gremlin控制台中运行良好(它找到了一个k步自我网络的唯一起点和终点,以及到该端点的最小距离):

g.V(42062000).as("from")
    .repeat(both().as("to")).emit().times(3).path()
    .count(local).as("pathlen")
    .select("from", "to", "pathlen")
    .dedup("from", "to").toList()

并给出与以下类似的输出,这是预期的:

==>{from=v[42062000], to=v[83607800], plen=2}
==>{from=v[42062000], to=v[23683248], plen=3}
==>{from=v[42062000], to=v[41762840], plen=3}
==>{from=v[42062000], to=v[42062000], plen=3}
==>{from=v[42062000], to=v[83599456], plen=3}

但是,在转换代码以使其符合 gremlinpython 包装器时 (即用as代替as_之后),即使是相同的查询,我也收到错误消息TypeError: Object of type GraphTraversal is not JSON serializable

有人遇到过类似的问题吗?

我正在使用 gremlinpython 3.4.2,但最初使用的是3.3.3。我的 Python 版本是3.7.3。

0 个答案:

没有答案
相关问题