Reputation: 137
I have a graph with nodes like "project", "employee" and "technology". There are relations between project and technology and between employee and technology.
I want to find employees that know all the technology used by a project. My cyper-query looks like this:
start project=node:project(name = "Project1")
match technology <-[:USED]- project , employee -[:KNOWS]-> technology
return employee
When running this query I get all employees that know one technology used by the project, and want employees that know all technologies used by the project. Is this possible in cypher?
Upvotes: 1
Views: 165
Reputation: 41706
I would probably use this to avoid computing the number of technologies used by the project per employee:
start project=node:project(name = "Project1")
match technology <-[:USED]- project
with count(technology) as projectTech, project
match employee -[:KNOWS]-> technology <-[:USED]- project
with count(technology) as knownTech, projectTech, employee
where projectTech=knownTech
return employee
Upvotes: 2
Reputation: 19373
You can try something like:
start project=node:project(name = "Project1")
match employee -[:KNOWS]-> technology <-[:USED]- project
with count(technology) as knownTech, employee, project
where length(()<-[:USED]-project)=knownTech
return employee
See Finding nodes that have all common intermediaries
Upvotes: 3