Reputation: 419
I'm trying to design a Neo4j graph database, and I will illustrate my specific requirement. I'm designing an app that allows users to collaborate on the books and magazines they have read. Requirements:
The same Book can be read by multiple people
The order in which a specific person reads the books is important. For example, I want to be able to represent that Person A read Books B1 and B2 in that order, while Person B may have read Books B3, B2 and B1 in that order.
I'm thinking of having nodes representing a Book, Magazine, Person, etc.
What is the best way to ensure the order/sequence information? A couple of options I thought about:
Upvotes: 1
Views: 257
Reputation: 6514
To me this is the way to go, easy and effective.
Store a order ID or timestamp in the relationship between a Person and a Book node and use that to query all Books read by the person in the right order.
Storing a Next/Previous relationship will not work, because you would have to save UserID in the NEXT relationship between books and that is just nonsense.
Upvotes: 2