I'm using the neo4j spatial plugin. What I'm trying to do is the following
1)find persons within a certain geographical area (using withinDistance and spatial plugin)
2)return the amount of person nodes that are male
My query looks like this:
start n=node:geom('withinDistance:[12.0,13.0, 1000.0]')
match (n{sex:"m"}) return count(n)
Now I would like to count the total amount of persons (and return it in the same query). How can I achieve that? When I'm applying a match clause to my nodes I've found with the start expression, I'm kicking the female nodes out. Is there any way to "save" the initial nodes (n) and reuse them multiple times. Of course, I could do something like this:
start n=node:geom('withinDistance:[12.0,13.0,1000.0]'),
q=node:geom('withinDistance:[12.0,13.0, 1000.0]')
match (n{sex:"m"}) return count(n), count(q)
Here I'm matching the initial nodes two times (neo4j will probably chache the query), but I'd like to avoid matching the same amount of nodes multiple times.
So acutally I' m looking for something like:
start n=node:geom('withinDistance:[12.0,13.0, 1000.0]')
return count(n), count (match (n{sex:"m"}))