2016-01-29 138 views
1

此查詢工作正常在我的Neo4j瀏覽器Neo4j的最短路徑查詢不返回圖

MATCH p=shortestPath((n1:FBDV)<-[:immediately_preceded_by*]-(n2:FBDV)) 
WHERE n1.label='embryonic stage 1' 
AND n2.label='embryonic stage 10' 
RETURN p 

的JSON返回包括最短路徑圖以及錶行的列表(在數據下)。

但是,當作爲休息API查詢運行時,返回的JSON僅包含表數據並且沒有圖。

我怎樣才能得到它返回最短路徑圖?

回答

1

使用transactional Cypher endpoint您可以指定你想在行和圖形格式接收的結果:

POST http://localhost:7474/db/data/transaction/commit

{ 
    "statements" : [ { 
    "statement" : "MATCH p=shortestPath((n1:FBDV)<-[:immediately_preceded_by*]-(n2:FBDV)) WHERE n1.label='embryonic stage 1' and n2.label='embryonic stage 10' return p", 
"resultDataContents" : [ "row", "graph" ] 
    } ] 
} 

This example顯示響應的格式。

+0

Thx。工作正常。正是我需要的。 – user3090491