简体   繁体   English

如何过滤掉 Neo4J/Cypher 中节点之间的非空路径

[英]How to filter out non-null path between nodes in Neo4J/Cypher

My current graph monitors board members at a company through time.我当前的图表通过时间来监控公司的董事会成员。

However, I'm only interested in currently employed directors.但是,我只对目前受雇的导演感兴趣。 This can be observed because director nodes connect to company nodes through an employment path which includes an end date (r.to) when the director is no longer employed at the firm.这可以被观察到,因为董事节点通过雇佣路径连接到公司节点,该雇佣路径包括董事不再受雇于公司的结束日期 (r.to)。 If he is currently employed, there will be no end date(null as per below picture).如果他目前在职,则没有结束日期(如下图为空)。 Therefore, I would like to filter the path not containing an end date.因此,我想过滤不包含结束日期的路径。 I am not sure if the value is an empty string, a null value, or other types so I've been trying different ways without much success.我不确定该值是空字符串、空值还是其他类型,所以我一直在尝试不同的方法,但没有取得多大成功。 Thanks for any tips!感谢您提供任何提示!

Current formula当前公式

MATCH (c2:Company)-[r2:MANAGED]-(d:Director)-[r:MANAGED]-(c:Company {ticker:'COMS'})
WHERE r.to Is null
RETURN c,d,c2

在此处输入图片说明

Unless the response from the Neo4j browser was edited, it looks like the value of r.to is not null or empty, but the string None .除非来自 Neo4j 浏览器的响应被编辑,否则r.to的值看起来不是 null 或空,而是字符串None This query will help verify if this is the case:此查询将有助于验证是否是这种情况:

MATCH (d:Director)-[r:MANAGED]-(c:Company {ticker:'COMS'})
RETURN DISTINCT r.to ORDER by r.to DESC

Absence of the property will show a null in the tabular response.缺少该属性将在表格响应中显示null Any other value is a real value of that property.任何其他值都是该属性的真实值。 If None shows up, then your query would be如果None出现,那么您的查询将是

MATCH (c2:Company)-[r2:MANAGED]-(d:Director)-[r:MANAGED]-(c:Company {ticker:'COMS'})
WHERE r.to="None"
RETURN c,d,c2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM