Neo4j Cypher Query "NOT IN" does not work, "IN" works

I am trying to create a cypher request in Java-Spring -Application, which should answer the question "give to all employees who did not create the item in item.nameList":

@Query("START it=node:__types__(className = 'de.my.domain.ItemCl') MATCH empl-[r:CREATE]->it WHERE (it.name NOT IN ({0})) RETURN DISTINCT empl") List<Employee> findAllEmployeesWhoNeverCreatedItemFromItemNameList(List<String> itemNameList); 

This request gives "org.springframework.dao.InvalidDataAccessResourceUsageException" and marks "NOT" as a failure.

If I try the same query without NOT ("give to all employees who created the item in item.nameList", the query does what it should.

In this thread, Peter Neubauer said that this β€œNOT IN” exists in cypher: https://groups.google.com/forum/#!topic/neo4j/_PehVUfGaIA

Any idea what's wrong?

+7
spring neo4j cypher
source share
1 answer

NOT is a negation, so you should do it like this:

 WHERE NOT(it.name IN({0})) 
+14
source share

All Articles