2017-04-17 17 views
0
MATCH p =(o:Order)-[r:seeks*2..8]->(o:Order) 
WHERE o.Name={orderID} AND ALL(x IN tail(nodes(p)) WHERE 
SINGLE(y IN tail(nodes(p)) WHERE x=y)) 
WITH p, o, r, extract(u IN nodes(p)| u.UserName) AS UserName 
WHERE size(UserName) - 1 = size(apoc.coll.toSet(tail(UserName))) 
RETURN extract(n IN nodes(p)| n.Name) AS OrderID, UserName, length(p) as 
Participants, endNode(r[0]) as AvailableOffers, ***reduce(s = 0, x IN 
extract(b IN nodes(p)| coalesce(b.userReputation, 0)) | s + x) AS UserRep*** 
ORDER BY length(p)""" 

The Screenshot of my query resultパス(Neo4j)のノードプロパティの合計値を取得する方法は?

私は機能を減らす使用してノードのプロパティの値の合計を取得することはできません...

答えて

0

私はあなたのクエリを再現することはできませんが、私は、私はあなたの問題を使用していたと思います両方とも減少し、抽出する。試してみてください

MATCH p =(o:Order)-[r:seeks*2..8]->(o:Order) 
WHERE o.Name={orderID} AND ALL(x IN tail(nodes(p)) WHERE 
SINGLE(y IN tail(nodes(p)) WHERE x=y)) 
WITH p, o, r, extract(u IN nodes(p)| u.UserName) AS UserName 
WHERE size(UserName) - 1 = size(apoc.coll.toSet(tail(UserName))) 
RETURN extract(n IN nodes(p)| n.Name) AS OrderID, UserName, length(p) as 
Participants, endNode(r[0]) as AvailableOffers, ***reduce(s = 0, x IN 
nodes(p)| s + coalesce(x.userReputation, 0)) AS UserRep*** 
ORDER BY length(p)""" 
関連する問題