gpt4 book ai didi

filter - 不再支持 Neo4j Filter 功能

转载 作者:行者123 更新时间:2023-12-01 21:40:45 30 4
gpt4 key购买 nike

我想比较两个列表,以便找到第一个列表中不在第二个列表中的值并返回它们。提前谢谢大家代码返回:不再支持过滤器有没有其他方法可以做到这一点

MATCH (cu:Customer{name: "myCustomer"})-[pu:PURCHASED]->(o:Order)-[*]->(cat:Category)
MATCH (b:Book)-[:IS_a]->(cat)
WITH COLLECT(DISTINCT pu.ISBN) AS purchasedbooks,COLLECT(DISTINCT b.ISBN) AS booksFromTheSameCategory
RETURN FILTER( n IN booksFromTheSameCategory WHERE NOT n IN purchasedbooks ) as listC

最佳答案

您可以使用 list comprehension语法而不是过时的 filter 函数:

MATCH (cu:Customer{name: "myCustomer"})-[pu:PURCHASED]->(o:Order)-[*]->(cat:Category)<-[:IS_a]-(b:Book)
WITH COLLECT(DISTINCT pu.ISBN) AS purchasedbooks, COLLECT(DISTINCT b.ISBN) AS booksFromTheSameCategory
RETURN [n IN booksFromTheSameCategory WHERE NOT n IN purchasedbooks] as listC

您可以在 this page 上查看 Cypher 语法更改文档.

关于filter - 不再支持 Neo4j Filter 功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61446845/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com