不再支持Neo4j过滤器功能 [英] Neo4j Filter function is no longer supported

查看:169
本文介绍了不再支持Neo4j过滤器功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想比较两个列表,以便在第一个列表中找到不在第二个列表中的值并返回它们。预先感谢大家
代码返回:不再支持过滤器
还有其他替代方法

I want to compare two lists in order to find the values in the first list which are not in the second and return them. thanks in advance guys the code returns: Filter is no longer supported is there any alternative way to do this

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


推荐答案

您可以使用列表理解语法,而不是过时的 filter 函数:

You can use the list comprehension syntax instead of the obsolete filter function:

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

您可以在此页面

这篇关于不再支持Neo4j过滤器功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆