2014-01-19 3 views
4

액터/동영상 데모 그래프에서 cypher는 별도의 배열에 열 이름을 반환합니다.Cypher 쿼리 JSON 형식의 결과

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}" } ], ... ]} 

답변

13

당신은 Neo4j 2.0의 새로운 문자지도 구문을 사용하여 같은 일을 할 수 있습니다

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