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

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

问题描述

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

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"(节点不显示专有名称)是员工.美国"是雇主的现任.Unknown"是他/她过去工作过的公司,Doctor"是Unknown"公司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. 从Doctor"到Unknown",为什么显示所有关系?如何仅显示一种相关关系?目前它显示所有医生"到未知"的关系.

  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 Browser 的 Graph Visualization Mode 中.如果您将可视化模式更改为文本"、表格"或代码",这些关系将不会显示.即:Graph 可视化模式正在尝试为您完成"图表.

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:

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

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