I am trying to display only one relevant relationship in the cypher query web browser but it displays all the relationships in between nodes. I am running following query:
MATCH (emp:Employee)-[e:EMPLOYED {dateendrole:"Current"}]->(c:Company {companyname:"xyza"})
MATCH (emp)-[ea:EDU_ASSOCIATED]->(ec:Company)
MATCH (another_emp:Employee)-[ea1:EDU_ASSOCIATED {overlapyearstart:ea.overlapyearstart, overlapyearend:ea.overlapyearend}]->(:Company {comp_id:ec.companyId})
RETURN emp, e, c, ea, ec, another_emp, ea1, LIMIT 1;
My intention in the above query is to find associated employees into another company where an employee employed currently in one company and it was or has been employed to another company.
For example, find associated employees in some company where an employee has worked before in that company and currently working in the xyza
company.
Here, the employee and company is the nodes. It has associated relationship which contains their overlap years as properties of the relationship. e.g. (emp)-[:Associated{overlapyearstart:x, overlapyearend:y}]->(company)
If the employee has worked with another employee at some company then overlap years will be same.
The above query gives following output in the web interface of the neo4j.
In the image, "Mr"(nodes dosen't display proper names) is the employee. "United States" is current of employer. "Unknown" is company he/she worked in the past and "Doctor" is the associated employee to "Mr" at the "Unknown" company.
I've two questions:
From "Doctor" to "Unknown", why it displays all the relationships? How can I show only one relevant relationship? Currently it shows all "Doctor" to "Unknown" relationship.
How can I do the same as above for "Mr" to "Unknown"?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…