社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Redis

如何返回redisgraph中的关系?

DLeonardi • 7 年前 • 1248 次点击  

使用redisgraph,我希望查询返回关系的类型。

示例查询:

MATCH (n1:Entity { id: "foo" }) MATCH (n2:Entity2 { id: "bar" }) CREATE (n1)-[r:areFriends]->(n2) RETURN *

不幸的是,返回的值只包括 n1 n2 ,但不是 r .

返回的记录包含以下内容:

Record { _header: [ 'n1.id', 'n1.name', 'n2.id', 'n2.name' ] 这符合我的模式,但是 R 那是众所周知的失踪。

我怎样才能得到回报来回报关系?

OpenCypher支持如下语法:

RETURN n1, n2, type(r) 但这在重拍中似乎不起作用。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/30840
文章 [ 2 ]  |  最新文章 7 年前
SWilly22
Reply   •   1 楼
SWilly22    7 年前

目前redisgraph不支持混合create和return子句,尽管这项工作正在进行中,应该在几天内可用。

SWilly22
Reply   •   2 楼
SWilly22    7 年前

pr刚合并到master

127.0.0.1:6379> GRAPH.QUERY G "create (:Entity {id:'foo'}), (:Entity {id:'bar'})"
1) (empty list or set)
2) 1) "Labels added: 1"
   2) "Nodes created: 2"
   3) "Properties set: 2"
   4) "Query internal execution time: 0.536000 milliseconds"

127.0.0.1:6379> GRAPH.QUERY G "MATCH (n1:Entity {id:'foo'}), (n2:Entity {id:'bar'}) CREATE (n1)-[r:areFriends]->(n2) RETURN n1,n2,TYPE(r)"
1) 1) 1) "n1.id"
      2) "n2.id"
      3) "TYPE(r)"
   2) 1) "foo"
      2) "bar"
      3) "areFriends"
2) 1) "Relationships created: 1"
   2) "Query internal execution time: 0.409000 milliseconds"

请注意,此更改将是1.0.12版的一部分

在该版本发布之前,您可以从源代码构建,也可以使用Docker Image Redisplates/Redisgraph:Edge