在Neo4j数据库中重新创建参考节点 [英] Recreate reference node in a Neo4j database

查看:141
本文介绍了在Neo4j数据库中重新创建参考节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不小心删除了节点0,这是我在新图中的参考节点,因此对getReferenceNode()的调用此后将失败.我搜索了Neo4j源,发现可以使用以下命令重新创建它:

I accidentally deleted node 0, which was my reference node on a new graph, so calls to getReferenceNode() would fail afterwards. I searched through the Neo4j source and found a that I could recreate it using:

GraphDatabaseService graphDb = new EmbeddedGraphDatabase("mytestdb");    
((EmbeddedGraphDatabase) graphDb).getConfig().getGraphDbModule().createNewReferenceNode();

我是否缺少重新创建参考节点的更好方法?有时,当我运行它时,它的ID为0,有时为5,这取决于存在的其他节点.另外,关于getConfig()的评论说它可能会在将来的版本中删除.

Am I missing a better way to recreate the reference node? Sometimes it gets an id of 0, sometimes 5 when I run this, depending on what other nodes exist. Also, comments around getConfig() say that it may be removed in future releases.

推荐答案

自您提出此要求以来,已经过去了一些时间,但为您提供参考,有一些最近的

Some time has passed since you asked this, but for your information there was some semi-recent discussion about reference nodes in a Neo4j GitHub issue - in summary, Peter Neubauer (Neo Technology employee) discusses either removing the concept of reference nodes, or adding a setReferenceNode() API call.

从该线程看来似乎没有太多结论,但是要从字面上回答您的问题,现在您并没有错过一种更好的方法来重新创建参考节点-希望很快就会出现!

There doesn't seem much conclusion from that thread, but to answer your question literally, right now you're not missing a better way to recreate the reference node - hopefully one will be coming soon!

这篇关于在Neo4j数据库中重新创建参考节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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