Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
查找Neo4j密码低于给定长度的路径,但不包括具有特定属性设置为特定值的节点的路径_Neo4j_Cypher - Fatal编程技术网

查找Neo4j密码低于给定长度的路径,但不包括具有特定属性设置为特定值的节点的路径

查找Neo4j密码低于给定长度的路径,但不包括具有特定属性设置为特定值的节点的路径,neo4j,cypher,Neo4j,Cypher,我在创建适当的密码查询时遇到问题。我想返回主题节点一定距离内的所有边和节点的子图。这可以通过以下方式轻松实现: START (topic: attribute)-[rel: describedBy*0..4]-(node: attribute WHERE id(topic) IN [37, 38] RETURN rel; 问题是我想删除路径中任何节点(而不是结束节点)的属性“key”值为“enrich”或“classification”的路径 我已尝试使用以下方法删除路径: MATCH pa

我在创建适当的密码查询时遇到问题。我想返回主题节点一定距离内的所有边和节点的子图。这可以通过以下方式轻松实现:

START (topic: attribute)-[rel: describedBy*0..4]-(node: attribute
WHERE id(topic) IN [37, 38] 
RETURN rel;
问题是我想删除路径中任何节点(而不是结束节点)的属性“key”值为“enrich”或“classification”的路径

我已尝试使用以下方法删除路径:

MATCH path=(topic: attribute)-[rel: describedBy|influences*0..4]-(intermediate: attribute)-[rel: describedBy|influences*0..4]-(node: attribute)
WHERE id(topic) IN [37,38] AND NOT intermediate in [x IN nodes(path) WHERE x.key IN ['enrichment', 'classification'] | x] and length(path) < 5
RETURN rel;
MATCH path=(主题:属性)-[rel:descripeby影响*0..4](中间:属性)-[rel:descripeby影响*0..4](节点:属性)
其中,id(主题)位于[37,38]中,而不是中间位置[x位于节点(路径)中,其中x.键入['enrichment','classification']| x],长度(路径)<5
返回rel;
我尝试在路径中的每个潜在距离处进行过滤:

MATCH (topic: attribute)-[rel:describedBy|influences]-(node: attribute)
WHERE id(topic) IN [37,38]
RETURN rel as rels
UNION
MATCH path=(topic: attribute)-[rel: describedBy|influences*1]-(intermediate: attribute)-[rel: describedBy|influences*1..3]-(node: attribute)
WHERE id(topic) IN [37,38] AND NOT intermediate.key in ['enrichment', 'classification'] and length(path) < 5
RETURN rel as rels
UNION
MATCH path=(topic: attribute)-[rel: describedBy|influences*2]-(intermediate: attribute)-[rel: describedBy|influences*1..2]-(node: attribute)
WHERE id(topic) IN [37,38] AND NOT intermediate.key in ['enrichment', 'classification'] and length(path) < 5
RETURN rel as rels
UNION
MATCH path=(topic: attribute)-[rel: describedBy|influences*3]-(intermediate: attribute)-[rel: describedBy|influences*1..1]-(node: attribute)
WHERE id(topic) IN [37,38] AND NOT intermediate.key in ['enrichment', 'classification'] and length(path) < 5
RETURN rel as rels;
MATCH(主题:属性)-[rel:descripbedby | influents](节点:属性)
其中[37,38]中的id(主题)
返回rel作为rels
联合
匹配路径=(主题:属性)-[rel:describedBy |影响*1]-(中间:属性)-[rel:describedBy |影响*1..3]-(节点:属性)
其中id(主题)在[37,38]中,而不是中间。输入['enrichment','classification']和长度(path)<5
返回rel作为rels
联合
匹配路径=(主题:属性)-[rel:describedBy |影响*2]-(中间:属性)-[rel:describedBy |影响*1..2]-(节点:属性)
其中id(主题)在[37,38]中,而不是中间。输入['enrichment','classification']和长度(path)<5
返回rel作为rels
联合
匹配路径=(主题:属性)-[rel:describedBy |影响*3]-(中间:属性)-[rel:describedBy |影响*1..1]-(节点:属性)
其中id(主题)在[37,38]中,而不是中间。输入['enrichment','classification']和长度(path)<5
将rel返回为rels;
我希望第二个匹配将停止(37)-[rel]-(32)-[rel*0..3]-()的路径,其中32具有“键”:“充实”,但它没有

有没有人建议我如何制定查询,当它到达具有特定键:值对的节点时停止跟踪路径


谢谢你的帮助。

我想这正是我想要的:

MATCH path=(topic: attribute)-[rel:describedBy|influences]-(node: attribute)
WHERE id(topic) IN [128204]
RETURN DISTINCT extract(r IN rels(path) | r)
UNION
MATCH path=(topic: attribute)-[rel1: describedBy|influences]-(intermediate: attribute)-[rel2: describedBy|influences]-(node: attribute)
WHERE id(topic) IN [128204] AND NOT intermediate.key in ['enrichment', 'classification'] and length(path) < 5
RETURN DISTINCT extract(r IN rels(path) | r)
MATCH path=(主题:属性)-[rel:descripbeby | influents](节点:属性)
其中[128204]中的id(主题)
返回不同的提取(rels(path)| r中的r)
联合
匹配路径=(主题:属性)-[rel1:describedBy |影响]-(中间:属性)-[rel2:describedBy |影响]-(节点:属性)
其中id(主题)在[128204]中,而不是中间。输入['enrichment','classification']和长度(path)<5
返回不同的提取(rels(path)| r中的r)

另外,如果可能的话,我还想用某种程度(节点)<值匹配来替换[value list]匹配中的node.key。