Greetings,
I am trying to construct a query but no matter how i approach it the results aren't accurate and the performance is bad. I'll give a somewhat pseudo example of what i'm trying to achieve and hopefully someone knows how to accomplish it as i have been trying for days and searching google has not been successful.
- CODE BELOW IS SOMEWHAT PSEUDO SO I KNOW IT NOT CORRECT. i just wanted to try and make it as clear as possible what i'm trying to achieve *
MATCH (e:User {id: 163014})
MATCH (a:Application)-[:IS_AT]->(l:Location)
WHERE (
(e)-[:HAS_ACCESS_TO]->(l)<-[:IS_AT]-(a)
AND NOT (a)-[:IS_FOR]->(:Job)
)
OR
(a)-[:IS_FOR]->(j)<-[:HAS_ACCESS_TO]-(e)
return DISTINCT(a)
skip 0
limit 100
The general summary is i'm trying to get all Application that either:
1: The User has access to via Location that they have access to BUT the application for that Location has no Job attached
2: The User has access to via Job that an application is for
An Application will either have a Location and Job attached, or Just Location. It was a simple query in mysql to write but the performance was trash. I feel that since its all about relations Neo4j should handle it much better. I just don't know how to do it