Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-10-2018 02:45 PM
Hi guys!
I'm building a example of a solution to count visits between Persons and Places. In this time I have some doubts to modeling.
First of all, what is the better pratice, make various Visit nodes with it's own properties, or put some properties on relationships.
This question is about create nodes with just one relation, like Person-make->Visit and Visit-there->Place (only one node visit with unique relation between them, or, shoud I make various relations Visit, with it's own properties but between the same nodes when it repeats?
I hope that you can understand my english. =/
Thanks for help!
Solved! Go to Solution.
10-15-2018 06:26 AM
Thak's guys. I think this problem is solved. I will do like ameyasoft way, if I have to make some adjusts that's ok.
❤️
10-11-2018 01:15 PM
Hi,
This is how I model:
Create one root node for Places and another node for Visitors.
Add all the Places as child nodes to Places node. Simlarly add all visitors as child nodes to Visitors node.
If a Visitor 'A' visits a Place 'Z', then create a 'VISITS' relation between Visitor 'A' node and Place 'Z' node.
Hope this works for you.
-Kamal
10-11-2018 01:34 PM
Thanks @ameyasoft!
I have a doubt. The Visitor can visits more than one time the Place, so... I must create n relations between Visitor and Place when it's repeats?
I'm having some trouble to decide, cuz I need to put some property on Visiti relations, like the timestamp, precision, arrival and departure.
10-11-2018 05:36 PM
I would start with relationships and only if you see the need arise to add more information to the visit choose to elevate them to nodes (either in general or in a case-by-case basis).
What is your use-case you want to solve with the data?
10-11-2018 10:59 PM
Hi,
It's better to add timestamp, precision, arrival and departure as properties to the Relationship. See the picture below.
I added relationship {date:'01/01/2018'} to "VISITS" relationship. Here visitor 'V1' visits places 'P1' and 'P2' on the same day and also visits 'P1' on a different date. 'V1' has two relations with 'P1'.
You can extend this simple model to suit your needs.
-Kamal
10-11-2018 11:00 PM
Hi,
Correction: I added property {date:'01/01/2018'} to the 'VISITS' relationship.
-Kamal
10-11-2018 05:35 PM
The root nodes are not needed anymore since Neo4j 2.0 as you have labels to group nodes into sets.
10-15-2018 06:26 AM
Thak's guys. I think this problem is solved. I will do like ameyasoft way, if I have to make some adjusts that's ok.
❤️
All the sessions of the conference are now available online