Neo4J密码:收集中间节点属性(路径) [英] Neo4J cypher: collect intermediate node properties (path)

查看:143
本文介绍了Neo4J密码:收集中间节点属性(路径)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Neo4J 中有一个与数据沿袭相关的图形,其可变长度路径包含中间节点(表):

I have a data lineage related graph in Neo4J with variable length path containing intermediate nodes (tables):

match p=(s)-[r:airflow_loads_to*]->(t)
where s.database_name='hive'
and s.schema_name='test'
and s.name="source_table"
return s.name,collect(nodes(p)),t.name

我不想返回s.name和t.name之间的节点作为路径,而是要返回 name 属性的 array 路径中的所有节点(按遍历的顺序)

Instead of returning the nodes between s.name and t.name as a path, I want to return an array of the name property of all nodes in the path (in the order of traversing)

可能都必须使用collect,但这在路径上是不可能的。 ..

I probably have to use collect, but that is not possible on a path...

推荐答案

将最后一行更改为

return s.name, [n in nodes(p) | n.name] as arrayOfName, t.name

应该可以解决问题

这篇关于Neo4J密码:收集中间节点属性(路径)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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