Hi Group !
I'm a very basic and newbie user of neo4J and Cypher and I'm trying to build a query.
This is about the visibility of a Component in an application given a set of eligibility conditions (items) for the Employee that is connected to the application.
the data model:
What I'm trying ?
- Get a first set of names of eligibility items for an Employee
- Get a second set of name of eligibility items for a Block
- Intersect both sets (using APOC function), if something is common it means that i can display/render the Block for that Employee
my (very bad) attempts
match (ee:Employee {name:"Carlos"})-[:EE_Eligible_For]->(o:EligibilityItem) with ee, collect(o.name) as l1
match (:Component {name:"HEALTH_ACCORDION"})-[:Is_Eligible_For]->(e:EligibilityItem)
with collect(e.name) as l2, collect (o.name) as l2 return apoc.coll.intersection (l1, l2)
// fetch the eligibility items for the component
match (c:component {key:"HEALTH_ACCORDION"})->[:Is_Eligible_For]->(e:EligibilityItem)
with c,collect(e) as ComponentEList
// fetch the eligibility items for the logged user
match (ee:Employee {name:"Carlos")->[:EE_Eligible_For]->(e2:EligibilityItem)
with ee, collect(e2) as EmployeeEList
match (sal:SalaryClass) where ee.salary > sal.min and ee.salary < sal.max
with sal.name + EmployeeEList
// intersect the eligibility list
return apoc.coll.intersect(ComponentEList,EmployeeEList)
Greatly appreciate if you can point me the right direction to achieve my goal.
Running Neo4J 4.0.4
best regards
Rui