在Neo4j上,您可以获得节点标签列表以及与查询的关系:
MATCH (a)-[r]->(b)
RETURN DISTINCT head(labels(a)) AS This, type(r) as To, head(labels(b)) AS That;
结果是:
This To That
Person ACTED_IN Movie
Person DIRECTED Movie
Person PRODUCED Movie
我想将结果表转换为图形(类似于(Person)-[:ACTED_IN]->(Movie))
。如何在上面的查询中添加create语句,以便为节点和类型使用标签(a)和标签(b)( r)关系?