Search code examples
neo4jspring-data-neo4jneo4j-ogm

Neo4j OGM - negating labels


I need to form a query using neo4j-ogm (spring-data-neo4j), which is equivalent to this Cypher:

MATCH (n:Employee)
WHERE NOT n:Manager AND NOT n:Support
RETURN n;

Is it possible with Filters (or other means) from neo4j-ogm? Manager and Support are subclasses of Employee in the model.

Thank you.


Solution

  • There is no support for this in derived finder/query methods. This can only be solved by using custom queries by annotating your finder method with @Query("<query string>").