cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Finding nodes without a specific relationship

mburbidg
Node

I need a query that finds nodes without a specific relationship. The following query works:

 

 

MATCH (e:Entity)
WHERE NOT (e)-[:CHILD_OF]->()
RETURN e

 

 

But neo4j browser gives me the following warning:
This feature is deprecated and will be removed in future versions.

Coercion of list to boolean is deprecated. Please consider using `NOT isEmpty(...) instead
I'm not sure how to modify my query as suggested.
4 REPLIES 4

ameyasoft
Graph Maven

In new version the syntax is:

MATCH (e:Entity)
WHERE NOT isEmpty((e)-[:CHILD_OF]->())
RETURN e

Small correction: remove "NOT". (Just in case)

MATCH (e:Entity)
WHERE isEmpty((e)-[:CHILD_OF]->())
RETURN e

 

While that works, neo4j browser gives a different warning.

This feature is deprecated and will be removed in future versions.

A pattern expression should only be used in order to test the existence of a pattern. It should therefore only be used in contexts that evaluate to a boolean, e.g. inside the function exists() or in a WHERE-clause. All other uses are deprecated and should be replaced by a pattern comprehension.

 

Maybe

 

MATCH (e:Entity)
WHERE not exists((e)-[:CHILD_OF]->())
RETURN e
Oh, y’all wanted a twist, ey?