在 Neo4j 3.2.15 和 cypher-3.1 中将来自 2 个节点的键加入单个 return 值

Join Keys from 2 nodes in a single return value in Neo4j 3.2.15 and cypher-3.1

我正在尝试获取 "Friend Recommendation" 查询。节点有下一个序列 (Node) - [FRIEND] - (Node) - [INFO] - (P_info) 其中每个节点与关联的 P_info 节点具有 INFO 关系。我可以获得一个节点的推荐朋友列表,但我需要将 P_info 键包含到推荐的朋友键中以 return 一起。

这是我目前的查询:

match (person:Account{_id:"185860469"})
match (person)-[:FRIEND]-()-[:FRIEND]-(potentialFriend)
where not (person)-[:FRIEND]-(potentialFriend)
match (potentialFriend)-[:INFO]-(information:P_info)
with person,potentialFriend, COUNT(*) AS friendsInCommon,information
where friendsInCommon > 5
return {user:person,recommend:collect(potentialFriend)},{info:information}

但是 "info" 的信息在响应中与 "potentialFriend" 没有关联。 我想做这样的事情: return {user:person,collect(potentialFriend,information)} 但我不知道这是否可能,cypher 说:

Too many parameters for function 'collect'

提前致谢。

我做到了,只是添加了一个额外的 WITH。我留下答案以防有人帮助

WITH person,{friend_id:potentialFriend._id,friend_name:information.name} AS Recommended_friend
RETURN person._id,collect(Recommended_friend)

这将 return 一个包含人员 ID 的唯一响应和一个包含所有为他推荐的朋友的数组。