[英]How to design neo4j db nodes that have ordered relationship with other nodes
I'm trying to design a Neo4j graph database, and I will illustrate my specific requirement. 我正在尝试设计Neo4j图形数据库,我将说明我的具体要求。 I'm designing an app that allows users to collaborate on the books and magazines they have read. 我正在设计一个应用程序,允许用户在他们阅读的书籍和杂志上进行协作。 Requirements: 要求:
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. 例如,我希望能够代表人A以此顺序阅读书籍B1和B2,而人B可能以该顺序阅读书籍B3,B2和B1。
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: 我考虑过几个选择:
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. 将订单ID或时间戳记存储在Person和Book节点之间的关系中,并使用该ID或时间戳查询该人按正确顺序阅读的所有Book。
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. 存储下一个/上一个关系将不起作用,因为您必须将UserID保存在书籍之间的NEXT关系中,这只是废话。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.