【问题标题】:How to write like queries using gremlin for Neptune as Neptune is not supporting the Lambda function如何使用 gremlin 为 Neptune 编写类似查询,因为 Neptune 不支持 Lambda 函数
【发布时间】:2018-07-02 09:53:08
【问题描述】:

有没有什么方法可以在不使用 lambda 函数的情况下在 gremlin 中编写类似于 '%match%' 的查询?

Neptune 不支持 Lambda 函数

【问题讨论】:

    标签: gremlin amazon-neptune


    【解决方案1】:

    通常有多种方法可以使用 Gremlin 步骤来表达 lambda。实际上,这样做通常会更好,因为图形提供程序无法优化包含 lambda 的查询部分(因为它只是任意代码)。

    通常,lambda 内容的性质决定了它是否可以用 Gremlin 步骤轻松表达。如果 lambda 使用第三方库(例如 JDBC 驱动程序)来抽象一堆复杂或自定义行为,那么仅使用 Gremlin 步骤通常无法表达这些概念。

    对于像%match%这样的字符串比较,TinkerPop 早就将这种支持留给了图形提供者(例如DSE Graph full text search API)。每个都有自己的文本搜索表达方式,您可以在应用程序中使用这些提供程序特定的 API。

    正如您所发现的,海王星目前没有这样的构造,因此几乎没有这种能力。如果您真的需要该功能,恐怕您必须对startsWith 类型的查询感到满意:

    gremlin> g = TinkerFactory.createModern().traversal()
    ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
    gremlin> g.V().has('name',between('m','mz'))
    ==>v[1]
    

    或选择不同的图形系统。请注意,社区中最近有 discussion 将基于文本的搜索作为 Gremlin 语言的一流功能,但目前尚未真正做出决定。

    【讨论】:

      猜你喜欢
      • 2022-01-17
      • 1970-01-01
      • 2018-06-03
      • 2021-10-15
      • 1970-01-01
      • 1970-01-01
      • 2021-06-05
      • 2021-03-20
      • 1970-01-01
      相关资源
      最近更新 更多