密码查询给出了不必要的关系 [英] Cypher query gives unnecessary relationships

查看:52
本文介绍了密码查询给出了不必要的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在密码查询Web浏览器中仅显示一个相关关系,但它显示节点之间的所有关系.我正在运行以下查询:

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;

我在上面的查询中的意图是将关联的雇员查找到另一家公司中,该雇员当前在一个公司中受雇,并且曾经或曾经受雇于另一家公司. 例如,在某公司中找到某个雇员的相关雇员,该雇员之前曾在该公司工作过,而目前在xyza公司工作.

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.

在这里,员工和公司是节点.它具有关联的关系,其中包含它们的重叠年作为关系的属性.例如(emp)-[:Associated{overlapyearstart:x, overlapyearend:y}]->(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.

上面的查询在neo4j的Web界面中提供以下输出.

The above query gives following output in the web interface of the neo4j.

在图像中,"Mr"(节点未显示专有名称)是雇员. 美国"是用人单位当前的情况. 未知"是他/她过去工作过的公司,医生"是未知"公司中先生"的关联雇员.

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.

我有两个问题:

  1. 从医生"到未知",为什么显示所有关系?如何只显示一种相关关系?当前,它显示了所有医生"到未知"的关系.

  1. 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"?

推荐答案

我相信这些关系仅在Neo4j浏览器的图形可视化模式中存在.如果将可视化模式更改为文本",表"或代码",则这些关系将不会显示.也就是说:图形"可视化模式正在尝试为您完成"图形.

I believe that these relationships are only present in the Graph Visualization Mode of Neo4j Browser. If you change your visualization mode to "Text", "Table" or "Code" these relationships will not be shown. That is: the Graph visualization mode is trying to "complete" the graph for you.

要获得所需的结果,应转到Neo4j浏览器设置的图形可视化" 部分,然后取消选中选项连接结果节点" ,如图中所示下方:

To achieve the desired result you should go to the section "Graph Visualization" of Neo4j Browser Settings and uncheck the option "Connect result nodes" as show in the image below:

这篇关于密码查询给出了不必要的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆