如何在Neo4j中复制路径? [英] How can I copy a path in Neo4j?

查看:138
本文介绍了如何在Neo4j中复制路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Neo4j中重新创建整个节点和关系链.

I'd like to recreate a whole chain of nodes and relationships in Neo4j.

我知道我可以使用p=保存路径,但是CREATE不接受.

I know that I can save a path with p=, but CREATE doesn't accept this.

MATCH p=(:Person)-[*]->(:Dog) CREATE p

有没有办法做到这一点?

Is there a way to do this?

推荐答案

警告:通常会在图数据库中创建与节点的其他关系,而不是重复的节点.

WARNING: One would usually create additional relationships to nodes rather than duplicate nodes in a graph database.

这不是严格密码,但可以在 Neo4j中使用外壳.它应该从Neo4j 2.0.0开始工作.请注意:此功能是实验性的且不完整的功能.

This is not strictly Cypher, but works in the Neo4j shell. It should work as of Neo4j 2.0.0. A word of caution: this is listed as an experimental and incomplete feature.

dump MATCH (pers:Person)-[r*:OWNS]->(d:Dog) RETURN pers,r,d;

您可以直接执行返回的输出以复制节点.如果ID已经存在,则将对其进行更改.将使用相同的标签和属性创建节点和关系.

You can directly execute the returned output to duplicate the nodes. IDs will be changed if they already exist. The nodes and relationships will be created with the same labels and properties.

这对于备份数据库非常方便.

This is super handy for backing up a database.

有关转储命令的更多信息

这篇关于如何在Neo4j中复制路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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