warning: this project is pretty much outdated, I suggest to use the well maintained https://github.com/graphaware/neo4j-uuid instead.
A lot of Neo4j based projects I've seen need a unique identifier for nodes/relationship to reference contents in the graph database from some third party system. The most obvious thing namely using node.getId() is a bad choice since after deletion of a node its id might be recycled. For details on why and how this works, see an excellect blog post. A best practice for having unique identifiers is to assign each node/relationship a uuid property and let Neo4j perform autoindexing on the uuid property. Third party systems store only the UUID. A simple index lookup retrieves then the referenced node or relationship in the graph database.
GPL v3
neo4j-uuid uses Gradle as build system. To install uuid-neo4j in a Neo4j server instance:
./gradlew assemble
./build/libs/neo4j-uuid.jar
to your Neo4j server's plugins
directoryplugins
directory as well (will automate that step in future).amend $NEO4J_SERVER/conf/neo4j-server.properties
with the following line:
org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.extension.uuid=/db/uuid
uuid
properties and registers a UUIDTransactionEventHandler
UUIDRestInterface