Kindly Help me to solve below query

List the Names of the projects belonging to department managed by employee “…….”
relations:
Works_in : employee works in a department
Has_acquired: employee has acquired a skill
Assigned_to : employee assigned to a project
Controlled_by: A project is controlled by a department
Project_manager : Employee is a project_manager of a Project

Hi! From the relationships you've listed there, it feels as though the query cannot be satisfied.

We could find what projects a particular department has, but there's no relationship to say what departments employee “…….” manages.

Perhaps a comma is missing? This would make the query more like:

List the Names of the projects belonging to department, managed by employee “…….”

Perhaps this is better said as:

List the names of the projects, and the departments they belong (are controlled by) to, where the project is managed by employee “…….”.

Hope that helps point you in the right direction.

Then what is the answer of the query. still i am unable to find the answer

It's not clear about your data model. Run this script and post the image of the resultant graph.

call apoc.meta.graph()

1 Like

I have used neo 4j console so here i have uploaded graph with model
Kindly help me to solve following queries
1)List the Names of employees having the same skills as employee “………..”
2) List the Names of the projects belonging to department managed by employee “……"

Thanks for the info. One question on your Skillset node. What properties you have on this node. If am employee has multiple skills, are you storing them as an array? Just post a sample of Skillset properties and values. This will help me to write better queries. Thanks.

Here are some queries:

1)List the Names of employees having the same skills as employee “………..”
match (e:Employee)-[]-(s:Skill)
with s.name as skill, collect(distinct e.name) as emp
return skill, emp, size(emp) as empcnt order by empcnt desc

Result:
Screen Shot 2021-04-09 at 1.26.40 PM

2) List the Names of the projects belonging to department managed by employee “……"
//All employees......
match (p:Project)-[:PROJECT_MANAGER]-(e:Employee)
match (e)-[]-(d:Department)
with p.name as proj, e.name as projMngr, d.name as dept
return proj, projMngr, dept

//For Shreya........
match (e:Employee) 
where e.name = "Shreya"
match (e)-[:PROJECT_MANAGER]-(d)    
with e.name as projMngr, collect(distinct d.name) as proj
return projMngr, proj, size(proj) as projCnt order by projCnt desc

Screen Shot 2021-04-09 at 1.27.24 PM

Hope this will help you.

Here is another query that shows all the projects and relationships with Departments and Employees.

match (p:Project)-[]-(d:Department)
match (e:Employee)-[]-(d)
return p, d, e

Result:

Thank You for answer