在 Neo4j 数据库中重新创建参考节点 [英] Recreate reference node in a Neo4j database
问题描述
我不小心删除了节点 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.
推荐答案
自从您提出这个问题以来已经过去了一段时间,但是为了您的信息,有一些半最近的 讨论 Neo4j GitHub 问题中的参考节点 - 总之,Peter Neubauer(Neo Technology 员工)讨论了删除参考节点的概念,或添加 setReferenceNode()
API 调用.
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屋!