简体   繁体   English

图形数据建模(Neo4j)

[英]Graph data modeling (Neo4j)

i am new to graph databases. 我是新来的图形数据库。 I am having some issues while modeling data. 在对数据建模时遇到一些问题。 I am working on site which contains information about books. 我正在一个包含有关书籍信息的网站上工作。 I have categorized books in different categories like: arts, fiction etc. I ve generated a node for each category. 我将书籍分为不同的类别,例如:艺术,小说等。我为每个类别都生成了一个节点。 Nodes of categories are unconnected with each other and that where the first issue comes. 类别的节点之间以及第一个问题所在的节点之间是不相连的 To solve this issue i am going to index a node called category and connect all my category nodes to it which leads me to the second issue of dense node or super node . 为了解决这个问题,我将索引一个名为category的节点并将所有类别节点连接到该节点,这将导致我遇到第二个密集节点或超级节点问题 Now tell me how to solve both these issues. 现在告诉我如何解决这两个问题。

You should use labels. 您应该使用标签。 The idea of super nodes was for neo4j < 2.* 超级节点的想法是针对neo4j <2. *

You can add a label BookCategory and when you want to return back all your bookCategoryNodes, just specify the label in the match query : 您可以添加标签BookCategory,并且要返回所有bookCategoryNodes时,只需在match查询中指定标签:

MATCH (n:BookCategory) RETURN n

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM