Reputation: 2599
I am using neo4j in my application where i have data model something like:
There are many type of resources like car,truck,room,computer,chair etc,these resources have some properties in common but other properties are different for each type of resource.
So i can model resources in two ways :
All should be considered as Resource(Node-Label) and will have a property 'type' which can have value like car,truck etc.
Each type should be considered as node label and will have its own properties only.
Which one is better?
Upvotes: 0
Views: 69
Reputation: 39915
You can also assign multiple labels on e.g. a Car:
CREATE (mercedes:Car:Resource {color:'red', ...})
This way you'll find the node when looking for generic resources as well as when looking specifically for cars.
Using a type
property is a anti-pattern in most cases due to the invention of labels in Neo4j 2.0.
Upvotes: 3