-
-
Save mneedham/2983831 to your computer and use it in GitHub Desktop.
START n = node(*) | |
MATCH n-[r:colleagues*1..2]->c, n-[r2:member_of]->office | |
WHERE n.type? = 'person' and has(n.name) and (not(has(r2.end_date))) and office.name = 'London - UK South' and (not(has(c.thoughtquitter))) | |
RETURN n.name, count(distinct(c)) AS connections, office.name | |
ORDER BY connections DESC |
Those numbers that I gave you were from running the query through the web console actually. I haven't tried the streaming option - will read about it and give it a try
other is then null and null values are not counted by count()
I meant the numbers of nodes touched :) ah, interesting, so it should be pretty fast, did you run the query once or multiple times (so you get rid of the parsing costs (and loading scala for the first query) and also have hotter caches.
Ah ok - in which case I change my question - why is other null? I would expect that it should come up with the London office?
I tried that query a couple more times back to back, 44.7 seconds, 44.1 seconds, 44.9 seconds
Other is null becase, you have the london office already bound to the office node and there is an optional relationship which means if it cannot be satisified all the nodes dangling from that will be null as well (like an outer JOIN in SQL).
Ahhh ok. What I actually want to do is find out how many offices people who are currently working in the London office have worked at.
If I add a relationship called 'current_office' and then have the query:
START office=node:offices(name='London - UK South')
MATCH office<-[r:current_office]-person, person-[r2?:member_of]->other
WHERE (NOT(HAS(r.end_date)))
RETURN person, COUNT(DISTINCT(other))
Will that return a different result or will it be the same because the office & person nodes are still bound?
If that's the case is there any way you can think for me to do this query?
And yeh maybe I should just run it on an AWS instance and see how it works - just a bit wary of putting the data on there cause normally it's behind CAS...although you could easily argue that having it on my hard drive is probably equally risky!