Hello all, just got started on Neo4J and I was wondering if there were best
practices with regards to using Labels versus Relationships versus
Properties when tagging e.g.
I have a set of friends and family who are interconnected. My challenge is
to understand what is the right way to tag nodes to easily see who is
Family and who is Friend. I could use Lables to tag nodes or Properties.
What I am trying to understand is what would the impact be performance
wise, capacity wise (maybe Label access is faster but more limited then
Property ones)...and ultimately which one of the options should be taken,
based on best practices.
The first model I created had too many properties so I ended up going
beyond the capacity limitations of Neo4J, so mixing Label and Property
seems to be the way forward but is there a performance impact or design
limitation?
Option 1: determined by relationship label
- I have nodes with a :Person label
- Properties are: First Name, Last Name
- I record the :Person relationships through edges that feature
- :IS_BROTHER_OF, IS_FATHER_OF... for family
- :PLAY_CHESS_WITH, :BOXES_WITH, :WENT_TO_UNI_WITH... for friends
But I box with my little brother, so my node ends up being connected with
to his with 2 relationships, one for family, one for friend
Option 2: determined by node label
- I have nodes with a :Person label
- I add :Family label
- I add :Friend label
- I thus use Labels to tag nodes depending on if they are family or
friends
- I then add :Chess for all the people I play chess with
- I then add :Boxing for all the nodes in my boxing club
- ...
Option 3: determined by relationship property
- I have nodes with a :Person label
- I have relationships with a :IS_CONNECTED_TO label
- It has properties such as: Family (Yes/No), Friends (Yes,No),
FamilyType,FriendType
- That one would be limited as I would not be able to know if I box
and play chess with my brother
Option 4: determined by node property
- I have nodes with a :Person label
- I create Property: Family (Yes/No), Friend (Yes/No), boxing
(Yes/No)...
Option 5: Mix of labels and properties
- I have nodes with a :Person label
- Properties are: First Name, Last Name
- I record the :Person relationships through edges that feature
- :IS_RELATED_TO for family
- With a Property of: RelationshipType (Father, Mother, Son,
Daugther...)
- :KNOWS for friends
- With a Property of: Through (Chess Club, University, Boxing,
Clubbing...)
and so on
Any guidelines would be great thanks
Minh
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.