Reputation: 123
Im am wondering if there is a way to get a neo4j node with a (empty) property. I defined it as an empty array when I created a the node and update it with data in a seperate query. I am now looking for a way to get the nodes that were never updated. neo4j automatically sets the property to (empty) when there is no value in the array. Is there a way to query these nodes? I cannot use the IS NULL or WHERE HAS NOT query since the property exists. Thanks
EDIT Here is an example of the properties one of the nodes that I am trying to grab. The episodes property is listed as (empty)
thumbnail: http://is1.mzstatic.com/image/thumb/Music6/v4/0b/cf/e8/0bcfe8a9-79d4-76c1-645d-5f9b8bb56435/source/100x100bb.jpg
feedUrl: http://www.iwantspace.com/publicbriefings/?feed=podcast&cat=6
name: The Audio Collection – SPACE – Public Briefings
episodes: (empty)
url: https://itunes.apple.com/us/podcast/audio-collection-space-public/id367750633?mt=2&uo=4
Upvotes: 3
Views: 5434
Reputation: 6251
This will get you the nodes that don't have the property episodes on them
MATCH (n) WHERE NOT HAS(n.episodes) RETURN n;
What speaks against episodes being nodes themselves?
Upvotes: 0
Reputation: 8546
So you stored an empty array as a property on the node? Did you try matching on nodes with an empty array for that property?
For example:
// Create a node with empty array for property names
CREATE (n:Person) SET n.names = []
MATCH (n:Person) WHERE n.names = [] RETURN n
// Returns the node previously created
Here is a Neo4j console demonstrating this.
Upvotes: 3