【发布时间】:2017-09-08 11:50:37
【问题描述】:
我有以下 Neo4j Cypher 查询,用于检查 User 和 entity 之间是否存在关系并返回布尔结果:
MATCH (u:User) WHERE u.id = {userId} MATCH (entity) WHERE id(entity) = {entityGraphId} RETURN EXISTS( (u)<-[:OWNED_BY]-(entity) )
请帮助重写此查询,以便能够接受{entityGraphIds} 的集合而不是单个{entityGraphId},并检查User 和具有这些{entityGraphIds} 的任何实体之间是否存在关系。
例如,我有user1 和entity1,entity2。 user1 与 entity2 有关系。我将通过{user.id} 像{userId} 和{entity1.id, entity2.id} 像{entityGraphIds} 这样查询应该返回true。
【问题讨论】: