如何使用Cypher返回节点的所有属性? [英] How can I return all properties for a node using Cypher?

查看:1177
本文介绍了如何使用Cypher返回节点的所有属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道可以使用通配符(*)来返回Cypher查询中的所有引用,例如:

I understand it is possible to use the wildcard (*) symbol to return all references in a Cypher query, such as:

MATCH p:Product WHERE p.price='1950' RETURN *;

  ==> +----------------------------------------------------------------+
  ==> | p                                                              |
  ==> +----------------------------------------------------------------+
  ==> | Node[686]{title:"Giorgio Armani Briefcase",price:"1950",...    |
  ==> +----------------------------------------------------------------+

然而,结果是一行具有名为p的单个节点列,从中可以访问属性。但是,我希望结果集行的属性名称为列。例如:

However, the result is a row with a single node 'column' named "p", from which the properties can be accessed. However, I'd like the result-set 'rows' to have the property names as 'columns'. Something like:

MATCH p:Product WHERE p.price='1950' RETURN p.*;

  ==> +-------------------------------------------+
  ==> | title | price | ...                       |
  ==> +-------------------------------------------+
  ==> | "Giorgio Armani Briefcase" | "1950" | ... |
  ==> +-------------------------------------------+

该特定查询无效,但有没有一种方法可以实现相同的结果(缺少显式列出所有属性,如p.title,p.price,p ...)?

That particular query isn't valid, but is there a way to achieve the same result (short of listing all the properties explicitly, as in p.title,p.price,p... )?

推荐答案

您无法在Cypher中执行此操作然而。我认为这将是一个很好的功能,如果你想要它。

You can't do this in Cypher yet. I think it would be a nice feature though, if you want to request it.

编辑(感谢评论指出):
您现在可以从2.2开始:

Edit (thanks for comment pointing it out): You can now do this as of 2.2:

MATCH (p:Product) WHERE p.price='1950' RETURN keys(p);

这篇关于如何使用Cypher返回节点的所有属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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