Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-20-2021 07:08 AM
Hi! I am interested in best practices for multi label nodes. In my case I have biologist node with name, surname, age, university where he/she works and so on. So what I want to know is how many labels I can give to this biologist node, are there any best practices? In my case my biologist can have labels like Person, Scientist, and some specific spheres of biology like neurobiology. I know that I can use properties for this purpose too so may be there is a rule of thumb for it.
09-24-2021 04:46 PM
Labels are useful for both selectivity, and also for addressing the same nodes differently depending on their context. For what labels to use, that's often query driven.
If all your persons are scientists, or you otherwise never query for persons JUST as persons, but always based upon their role as a scientist of some type, then the :Person label isn't useful.
If you have queries where it's hardcoded around specialty, so you KNOW you're querying over biologists, and it's not based on a parameter or anything, then it would make sense to include the :Biologist label.
If your queries query based on specialty, but it's driven dynamically from user parameters, then it may make sense to use a property for their specialization.
Alternately, you could have a :Specialization node for each (so one for (:Specialization {name:'Biology'})
), and connect these to all scientist nodes who specialize in that field. That design can be useful if you want to support multiple specializations, instead of just one.
Figure out what kind of queries you think you'll be making, and then consider what the most efficient means of modeling would be for addressing them. That can usually guide you in the right direction for modeling.
All the sessions of the conference are now available online