Neo4J cypher: collect intermediate node properties (path)

放肆的年华 提交于 2020-01-25 07:58:09

问题


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

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)

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


回答1:


changing the last line to

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

should do the trick



来源:https://stackoverflow.com/questions/59734396/neo4j-cypher-collect-intermediate-node-properties-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!