简体   繁体   English

Neo4J cypher:收集中间节点属性(路径)

[英]Neo4J cypher: collect intermediate node properties (path)

I have a data lineage related graph in Neo4J with variable length path containing intermediate nodes (tables):我在Neo4J 中有一个数据沿袭相关图,其中包含包含中间节点(表)的可变长度路径:

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

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)我想返回路径中所有节点的name属性数组,而不是将 s.name 和 t.name 之间的节点作为路径返回(按遍历顺序)

I probably have to use collect, but that is not possible on a path...可能必须使用收集,但这在路径上是不可能的......

changing the last line to将最后一行更改为

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

should do the trick应该做的伎俩

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

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