Recreate reference node in a Neo4j database

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-19 09:04:26

问题


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();

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.


回答1:


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!



来源:https://stackoverflow.com/questions/7186832/recreate-reference-node-in-a-neo4j-database

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