如何将 Neo4j 中的所有属性返回到不同的列中

nan*_*ana 5 neo4j cypher spring-data-neo4j neo4j-apoc

我知道,我们可以通过单击“就绪”按钮将 neo4j 数据库导出到 CSV 文件。在我们实现这个密码查询之后:

Match (n)
return n 
Run Code Online (Sandbox Code Playgroud)

但这个查询为我们提供了 1 行的所有属性。

我的问题是:在导出到 CSV 文件之前要实现哪个 Cypher 查询,以便为我们提供单独列中的所有属性,即使节点没有相同的属性,

例如:

node(0) has: name, age.
node(1) has: name, age.
node(2) has: name, address.
node(3) has: name, phone No.
node(4) has: name, age.
node(5) has: name, DoB.
Run Code Online (Sandbox Code Playgroud)

我需要的结果是:

name      age      address      phone No      DoB
Tom       22
Smith     18
Lee                 123abc
Perry                            01234
Sara      40
Tom                                          11/11/2000
Run Code Online (Sandbox Code Playgroud)

不如下:

n
Tom, 22
Smith, 18
Lee, 123abc
Perry, 01234
Sara, 40
Tom, 11/11/2000
Run Code Online (Sandbox Code Playgroud)

Baj*_*jal 0

一种方法是将apoc其导出为 CSV。

CALL apoc.export.csv.query("MATCH (n) return n", "/tmp/results.csv", {})

示例结果如下所示,您可以使用其他工具将其转换为您喜欢的结构,例如jq

在此输入图像描述