neo4j – labels vs properties vs relationship + node

Whether you should use a property, a label or a node for the category depends on how you will be querying the data.

(I’ll assume here that you have a fairly small, fairly fixed set of categories.)

Use a property if you won’t be querying by category, but just need to return the category of a node that has been found by other means. (For example: what is the category of the item with sku 001?)

Use a label if you need to query by category. (For example: what are all the foods costing less than $10?)

Use a node if you need to traverse the category without knowing what it is. (For example: what are the ten most popular items in the same category as one that the user has chosen?)

Leave a Comment