2015-06-15 34 views
0

我目前正在使用neo4j。我試圖通過neo4j研究圖形數據庫。對於我的學習,我需要執行一些查詢。而且我有這一個問題:對neo4j我有這種錯誤:預期的路徑,但是收集<Path>?

Match path = (a:Node)-[:Rel1|Rel2*7..8]-(b:Node), (c:Node) 

Where (a:Node)-[:Rel1|Rel2*7..8]-(b:Node) and (a:Node)-[:Rel1|Rel2*7..8]-(c:Node) and (b:Node)-[:Rel1|Rel2*7..8]-(c:Node) 

With a as aa, b as bb, c as cc, (a:Node)-[:Rel1|Rel2*7..8]-(b:Node) as path1, 
(a:Node)-[:Rel1|Rel2*7..8]-(c:Node) as path2, (c:Node)-[:Rel1|Rel2*7..8]-(b:Node) as path3 

Limit 1 

With a as aa, b as bb, c as cc, 
path1 as path1, path2 as path2, path3 as path3, Extract(rel in relationships(path1) | rel.id) as relIDs1, Extract(rel in relationships(path2) | rel.id) as relIDs2, Extract(rel in relationships(path3) | rel.id) as relIDs3 

Return path1, path2, path3 

我有第二個用,Neo4j的做回一個路徑的問題(我只需要1路「限制1」)時,我的評論這條線,但是當我試圖做預期的路徑,但在提取物上的集合。我怎麼能處理這個問題,我試着看看我不知道的文檔。

非常感謝!

回答

0

Neo4j的行爲是將數據作爲集合返回,即使只有一個項目。如果返回類型不一致,會更令人困惑,所以這真是一件好事。只需從集合中獲取第一個元素,將其存儲在Path類型變量中,然後繼續前進。

相關問題