Neo4j - Cypher 与 Gremlin 查询语言 [英] Neo4j - Cypher vs Gremlin query language

查看:25
本文介绍了Neo4j - Cypher 与 Gremlin 查询语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用 REST API 使用 Neo4j 进行开发.我看到有两种执行复杂查询的选项 - Cypher(Neo4j 的查询语言)和 Gremlin(通用图形查询/遍历语言).

I'm starting to develop with Neo4j using the REST API. I saw that there are two options for performing complex queries - Cypher (Neo4j's query language) and Gremlin (the general purpose graph query/traversal language).

这是我想知道的 - 是否有任何查询或操作可以使用 Gremlin 完成而无法使用 Cypher 完成?反之亦然?

Here's what I want to know - is there any query or operation that can be done by using Gremlin and can't be done with Cypher? or vice versa?

Cypher 对我来说似乎比 Gremlin 清楚得多,而且总的来说,Neo4j 中的人似乎都在使用 Cypher.但是 - 如果 Cypher 与 Gremlin 相比是有限的 - 我真的很想提前知道这一点.

Cypher seems much more clear to me than Gremlin, and in general it seems that the guys in Neo4j are going with Cypher. But - if Cypher is limited compared to Gremlin - I would really like to know that in advance.

推荐答案

对于一般查询,Cypher 就足够了,而且速度可能更快.Gremlin 相对于 Cypher 的优势在于当您进入高级遍历时.在 Gremlin 中,您可以更好地定义确切的遍历模式(或您自己的算法),而在 Cypher 中,引擎会尝试自行寻找最佳遍历解决方案.

For general querying, Cypher is enough and is probably faster. The advantage of Gremlin over Cypher is when you get into high level traversing. In Gremlin, you can better define the exact traversal pattern (or your own algorithms) whereas in Cypher the engine tries to find the best traversing solution itself.

我个人使用 Cypher,因为它很简单,到目前为止,我还没有遇到过必须使用 Gremlin 的情况(除了使用 Gremlin graphML 导入/导出函数).但是,我希望即使我需要使用 Gremlin,我也会针对我在网上找到的特定查询执行此操作,并且再也不会回来了.

I personally use Cypher because of its simplicity and, to date, I have not had any situations where I had to use Gremlin (except working with Gremlin graphML import/export functions). I expect, however, that even if i would need to use Gremlin, I would do so for a specific query I would find on the net and never come back to again.

您总是可以非常快速地(以天为单位)学习 Cypher,然后继续学习(长期)一般 Gremlin.

You can always learn Cypher really fast (in days) and then continue with the (longer-run) general Gremlin.

这篇关于Neo4j - Cypher 与 Gremlin 查询语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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