如何使用gremlin为Neptune编写类似查询的查询,因为Neptune不支持Lambda函数 [英] How to write like queries using gremlin for Neptune as Neptune is not supporting the Lambda function

查看:129
本文介绍了如何使用gremlin为Neptune编写类似查询的查询,因为Neptune不支持Lambda函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在不使用lambda函数的情况下在gremlin中编写类似%match%之类的查询?

Is there any way to write like queries Like '%match%' in gremlin without using the lambda functions?.

海王星不支持Lambda函数

Neptune does not support Lambda functions

推荐答案

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

There are usually ways to express lambdas with Gremlin steps. Indeed, it is often better to do so because graph providers can't optimize the portions of your queries that contain lambdas (as it is just arbitrary code).

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

Typically, the nature of the lambda contents determines whether or not it can be expressed easily with Gremlin steps. If the lambda uses a third-party library (e.g. a JDBC driver) that abstracts a bunch of complex or custom behavior then expressing such concepts are usually not possible with just Gremlin steps.

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

For string comparisons like %match% TinkerPop has long left that sort of support to the graph providers (e.g. DSE Graph full text search API). Each has its own way of expressing text searches and you would use those provider specific APIs in your applications.

您已经发现,海王星目前没有这样的构造,因此该功能几乎没有资源。如果您确实需要该功能,恐怕您必须对 startsWith 类型的查询感到满意:

As you have found, Neptune does not have such constructs at this time so there is little recourse for that capability. If you really need that feature, I'm afraid that you will have to be satisfied with a startsWith type of query:

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

或选择其他图形系统。请注意,最近有讨论在社区中使基于文本的搜索成为Gremlin语言的一流功能,但目前尚未真正决定。

or choose a different graph system. Note that there has been recent discussion in the community for making text based search a first-class feature of the Gremlin language, but no decision has really been made at this point.

这篇关于如何使用gremlin为Neptune编写类似查询的查询,因为Neptune不支持Lambda函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆