Neo4j Cypher:匹配数组中的多个属性值

时间:2018-08-31 11:55:21

标签: neo4j

此查询正在为数组中的'DOWNLOAD'匹配单个属性值content

MATCH (profile:Profile)
MATCH (profile)-[:LINK]->(l)
WHERE ANY(content IN l.content WHERE content = 'DOWNLOAD')
RETURN DISTINCT profile

但是当在'DOWNLOAD'中包含'RECENT'时,contenttype的多个属性值ANDWHERE ANY()出现错误:< / p>

MATCH (profile:Profile)
MATCH (profile)-[:LINK]->(l)
WHERE ANY(content IN l.content WHERE content = 'DOWNLOAD' 
AND type IN l.type WHERE type = 'RECENT')
RETURN DISTINCT profile

1 个答案:

答案 0 :(得分:2)

  

To check if an element exists in a list, you can use the IN operator

MATCH 
  (profile:Profile)
MATCH 
  (profile)-[:LINK]->(l)
WHERE 
  'DOWNLOAD' IN l.content AND
  'RECENT'   IN l.type
RETURN 
  DISTINCT profile