Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is concept of reference node in neo4j still used or deprecated?

I was going through neo4j docs at tutorials-java-embedded-index. It describes the concept of reference node. A user reference node is created usersReferenceNode which is used to connect with all user nodes created in DB.

What was/is use of this reference node? When I tried using graphDb.getReferenceNode(), it's showing as deprecated method.

So is/will there be any need to create reference node at all? If yes, what and how is the use of such reference node?

Thanks.

like image 739
N D Thokare Avatar asked Dec 27 '22 08:12

N D Thokare


2 Answers

The concept of reference node is deprecated due to a design of the system. Indexing should be used for retrieving nodes of certain types, etc. So you could have an index named Animal and an index named Bird and these can store nodes of those "types".

One reason for the reference node being removed is the dense node problem, which causes issues if you cannot store everything in RAM on Neo4j. This is where you have one node with many, many relationships. After a certain point(depending on system, but usually in the hundreds of thousands) finding nodes based on relationship types.

like image 181
Nicholas Avatar answered Dec 28 '22 21:12

Nicholas


One use-case of reference node I can see is to delete specific nodes. For example consider following scenario:

> I have two types of nodes, say ANIMAL and BIRD
> I have a reference node `animalsReference` linked to all ANIMAL nodes and
> I have a reference node `birdsReference` linked to all BIRD nodes

Now in future suppose I want to delete all BIRD nodes. Here I can use 'birdsReference' to get all BIRD type nodes and delete them all.

If graphDb.getReferenceNode() is deprecated, how can we complete such type of tasks (deleting some nodes)?

Also I can see graphDb.getAllNodes() is deprecated. So what is the way to retrieve all nodes in graphDB?

like image 43
N D Thokare Avatar answered Dec 28 '22 23:12

N D Thokare