Get All Nodes Except Nodes with Only 2 Properties

I am developing a web application using neo4j and php.

I have 10 properties set for any given node. but some of the nodes have only 2 properties. Now i need all the nodes except the nodes with only those two particular values.

Following is an example query that i want to run BOY is a label and has name,age,height,weight,runTime ...; now , some of the nodes only have data in name and age properties

I want to get all the nodes BOY minus BOY with only Name and Age

EX : match (c : BOY) where NOT (c.height ="" AND c.weight ="") return count(c);

But the above query filters some more result that I want to get.

I have tried Multiple variations But still either the syntax is wrong or I am not getting proper results.

1 Answer

A missing property evaluates to null so instead of checking for ""

 match (c : BOY) where c.height is null and c.weight is null return count(c); 

(add more properties as necessary to find all nodes that do NOT have all these properties)

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest