gpt4 book ai didi

json - 密码查询JSON格式的结果

转载 作者:行者123 更新时间:2023-12-04 05:03:48 25 4
gpt4 key购买 nike

在Actor/Movie演示图上,cypher在单独的数组中返回列名。

MATCH (n:Person) RETURN n.name as Name, n.born as Born ORDER BY n.born LIMIT 5

结果:
{  "columns" : [ "Name", "Born" ],  "data" : [ [ "Max von Sydow", 1929 ], [ "Gene Hackman", 1930 ], [ "Richard Harris", 1930 ], [ "Clint Eastwood", 1930 ], [ "Mike Nichols", 1931 ] ]}

是否可以改为标记每个节点的属性?
{ "nodes" : [ ["Name": "Max von Sydow", "Born": 1929 ], ...] }

如果我返回节点而不是选择的属性,那么我会得到太多的属性。
MATCH (n:Person) RETURN n LIMIT 5

结果:
{  "columns" : [ "n" ],  "data" : [ [ {    "outgoing_relationships" : "http://localhost:7474/db/data/node/58/relationships/out",    "labels" : "http://localhost:7474/db/data/node/58/labels",    "data" : {      "born" : 1929,      "name" : "Max von Sydow"    },    "all_typed_relationships" : "http://localhost:7474/db/data/node/58/relationships/all/{-list|&|types}",    "traverse" : "http://localhost:7474/db/data/node/58/traverse/{returnType}",    "self" : "http://localhost:7474/db/data/node/58",    "property" : "http://localhost:7474/db/data/node/58/properties/{key}",    "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/58/relationships/out/{-list|&|types}",    "properties" : "http://localhost:7474/db/data/node/58/properties",    "incoming_relationships" : "http://localhost:7474/db/data/node/58/relationships/in",    "extensions" : {    },    "create_relationship" : "http://localhost:7474/db/data/node/58/relationships",    "paged_traverse" : "http://localhost:7474/db/data/node/58/paged/traverse/{returnType}{?pageSize,leaseTime}",    "all_relationships" : "http://localhost:7474/db/data/node/58/relationships/all",    "incoming_typed_relationships" : "http://localhost:7474/db/data/node/58/relationships/in/{-list|&|types}"  } ], ... ]}

最佳答案

您可以在Neo4j 2.0中使用新的文字映射语法,并执行以下操作:

MATCH (n:Person) 
RETURN { Name: n.name , Born: n.born } as Person
ORDER BY n.born
LIMIT 5

关于json - 密码查询JSON格式的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21219936/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com