我必須在A和B之間找到所有具有附加屬性的最短路徑。查詢以查找附加條件的所有最短路徑都不會返回
該查詢返回我只有一個路由(這是真的,只有一個具有3個部分路線):
MATCH (darjeeling { name: 'Darjeeling' }),(sandakphu { name: 'Sandakphu' }),
paths = allShortestPaths((darjeeling)-[*]-(sandakphu))
RETURN paths
結果:
{"start":{"identity":1,"labels":["town"],"properties":{"name":"Darjeeling"}},"end":{"identity":3,"labels":["peak"],"properties":{"altitude":"12400 ft","name":"Sandakphu"}},"segments":[{"start":{"identity":1,"labels":["town"],"properties":{"name":"Darjeeling"}},"relationship":{"identity":2,"start":1,"end":0,"type":"trek","properties":{"distance":15,"name":"Darjeeling-Rimbik","winter":"true","summer":"true"}},"end":{"identity":0,"labels":["town"],"properties":{"name":"Rimbik"}}},{"start":{"identity":0,"labels":["town"],"properties":{"name":"Rimbik"}},"relationship":{"identity":3,"start":0,"end":2,"type":"trek","properties":{"distance":18,"name":"Rimbik-BhikeBhanja","winter":"true","summer":"true"}},"end":{"identity":2,"labels":["village"],"properties":{"name":"BhikeBhanja"}}},{"start":{"identity":2,"labels":["village"],"properties":{"name":"BhikeBhanja"}},"relationship":{"identity":4,"start":2,"end":3,"type":"trek","properties":{"distance":4,"name":"BhikeBhanja-Sandakphu","winter":"true","summer":"true"}},"end":{"identity":3,"labels":["peak"],"properties":{"altitude":"12400 ft","name":"Sandakphu"}}}],"length":3}
這條路線的所有部分都有屬性冬季設置爲true,但是如果我想將這樣的條件添加到我的查詢中,我沒有結果:
MATCH (darjeeling { name: 'Darjeeling' }),(sandakphu { name: 'Sandakphu' }),
paths = allShortestPaths((darjeeling)-[*]-(sandakphu))
WHERE ALL (p IN relationships(paths) WHERE p.winter = true)
RETURN paths
我的問題是,即使A和B之間存在路由,爲什麼第二個查詢不會返回結果,這是最短的路由,並且此路由上的所有路徑都將屬性winter設置爲true?
是'冬天'布爾屬性或字符串屬性?如果條件是WHERE p.winter =「true」',你會得到結果嗎? – InverseFalcon
確實這是一個字符串屬性!它適用於「」...... – TheOpti