gpt4 book ai didi

python - 通过 python 中的 goblin 将数字传递给 gremlin

转载 作者:太空宇宙 更新时间:2023-11-04 03:02:43 25 4
gpt4 key购买 nike

我想在 gremlin 中重复一些遍历,如下所示:

g.V(1).repeat(out()).times(1)

使用 python 的 goblin 包和默认的 titan11 安装(我认为是 titan+casssandra+gremlin+elasticsearch 但是,嗯,这东西是令人困惑)。

在 python 中,在做了一些特殊的导入之后,我写了或多或少与上面完全相同的东西:

from gremlin_python import statics
from gremlin_python.process.graph_traversal import __
statics.load_statics(globals())

# ... lots of other badass async python stuff and some networkx stuff etc

sg = g.V(seed_id).repeat(out()).times(1)

(如果您认为可能有帮助,请参阅 https://github.com/mikedewar/graphLearning/blob/master/conditional_traversal.py#L107 了解所有其他细节)

当我使用 goblin 遍历 sg 遍历时,我从 gremlin 得到了一个 Java 错误:

goblin.exception.GremlinServerError: 597: No signature of method: org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal.times() is applicable for argument types: (java.lang.Long) values: [1]
Possible solutions: toSet(), size(), min(), take(int), sleep(long), is(java.lang.Object)

所以我想它可能不喜欢我传递给它的整数。

求助!我希望能够在 gremlin 中重复内容。

最佳答案

这是 Goblin 提供的旧 Groovy 转换器实现中的一个错误,目的是提供与 GraphSON 版本 1 的向后兼容性。它导致所有整数都被序列化为 long。因为 times 方法签名需要一个整数,所以这会导致错误。我用这个 commit 修复了它.此修复程序将包含在下一版本中。现在,请从 Github 安装:

pip install git+https://github.com/ZEROFAIL/goblin.git

我知道您不确定这个问题的根源,但也许将来 Github 问题会是一个更好的起点。

关于python - 通过 python 中的 goblin 将数字传递给 gremlin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40459566/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com