SQL 喜欢 Apache TinkerPop 的查询语言
SQL like query language for Apache TinkerPop
背景:我一直在使用NEO4J and its Cypher Query till now and am looking to move to Apache TinkerPop来支持多个Graph DB。
在Cypher Query Language我要找我的朋友我会写这个Query。
MATCH (you {name:"You"})-[:FRIEND]->(yourFriends)
RETURN you, yourFriends
现在我正在寻找一种查询语言,它与我的代码中已经编码的查询语言相似,可以与 Gremlin 一起使用
据我所知,Gremlin 有一个类似“g.v(12).outE('knows').inV”的脚本,但这是与我正在寻找的 SQL 语法不相似。
Note: I am NOT looking for SQL connectivity, I am just looking for a
SQL LIKE Script
TLDR;
对您问题的简短回答是,对于 Tinkerpop-enabled 数据库,您需要在 Gremlin 中编写查询,目前没有 SQL-Like 语言。
详情
Gremlin 在多个方面不同于 SQL 和 Cypher,但重要的是 Gremlin 是一种声明性语言,而 SQL/Cypher 是命令式语言。在 Gremlin 中,您可以定义要如何遍历图形,在 SQL/Cypher 中,您可以定义所需的内容,引擎会为您优化遍历。
例如,上面的 Cypher 查询将在 Gremlin 中编写为:
g.V().has('name', 'You')
.as('you').out('friend')
.as('yourFriends')
.select ('you', 'yourFriends')
目前,您需要将 Cypher 查询转换为 Gremlin,以处理任意数量的 TP 数据库,包括 JanusGraph、CosmosDB、DSE Graph、AWS Neptune...。所有当前提供程序都可以在这里找到:Tinkerpop Providers
Daniel Kuppitz 写了一篇文章,教您如何从编写 SQL 查询迁移到编写 gremlin 查询,可在此处获取:SQL2Gremlin
背景:我一直在使用NEO4J and its Cypher Query till now and am looking to move to Apache TinkerPop来支持多个Graph DB。
在Cypher Query Language我要找我的朋友我会写这个Query。
MATCH (you {name:"You"})-[:FRIEND]->(yourFriends)
RETURN you, yourFriends
现在我正在寻找一种查询语言,它与我的代码中已经编码的查询语言相似,可以与 Gremlin 一起使用
据我所知,Gremlin 有一个类似“g.v(12).outE('knows').inV”的脚本,但这是与我正在寻找的 SQL 语法不相似。
Note: I am NOT looking for SQL connectivity, I am just looking for a SQL LIKE Script
TLDR;
对您问题的简短回答是,对于 Tinkerpop-enabled 数据库,您需要在 Gremlin 中编写查询,目前没有 SQL-Like 语言。
详情
Gremlin 在多个方面不同于 SQL 和 Cypher,但重要的是 Gremlin 是一种声明性语言,而 SQL/Cypher 是命令式语言。在 Gremlin 中,您可以定义要如何遍历图形,在 SQL/Cypher 中,您可以定义所需的内容,引擎会为您优化遍历。
例如,上面的 Cypher 查询将在 Gremlin 中编写为:
g.V().has('name', 'You')
.as('you').out('friend')
.as('yourFriends')
.select ('you', 'yourFriends')
目前,您需要将 Cypher 查询转换为 Gremlin,以处理任意数量的 TP 数据库,包括 JanusGraph、CosmosDB、DSE Graph、AWS Neptune...。所有当前提供程序都可以在这里找到:Tinkerpop Providers
Daniel Kuppitz 写了一篇文章,教您如何从编写 SQL 查询迁移到编写 gremlin 查询,可在此处获取:SQL2Gremlin