如何获取 Gremlin 查询的实时流更新?

How can I get realtime streaming updates to a Gremlin query?

当我使用 Firebase、RethinkDB 和类似工具时,我爱上了查询的实时流式更新。现在我正在通过 Gremlin 使用图形数据库,我想知道如何获得这种行为。

作为一个简单的例子,如果我指定了一个像这样的 gremlin 查询:

g.V().values('name')

我希望在添加新顶点并命名 属性 或更改现有顶点的名称时收到更新。

我开始使用 Janusgraph,所以理想的解决方案在那里工作 -- 但这是一个如此杀手级的功能,我可能会受到影响 other Gremlin-friendly graph databases

谢谢!

您可以使用 EventStrategy with any Tinkerpop compatible graph database. Once you create the event strategy, you add it to your traversal g = graph.traversal().withStrategies(strategy). You'll need to implement the MutationListener 界面对这些事件做任何您想做的事情。

OrientDB 有 LiveQuery,虽然我不知道它与 Gremlin 集成 - https://orientdb.com/docs/2.1/Live-Query.html - 这是我所知道的在任何支持 TinkerPop 的图形数据库中最接近这种功能的东西