图数据库和网络数据库有什么区别?

发布于 2024-10-17 22:23:24 字数 61 浏览 6 评论 0原文

图数据库(例如 Neo4J)和网络数据库(例如 IDS、CODASYL)有什么区别?原则上它们是同一件事吗?

What is the difference between a Graph Database (e.g. Neo4J) and a Network Database (e.g. IDS, CODASYL)? In principle are they the same thing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

白昼 2024-10-24 22:23:24

CODSASYL 这样的网络数据库仍然或多或少基于 分层数据模型,根据父子(或 CODASYL 术语中的所有者-成员)关系进行思考。这也意味着在网络数据库中,您无法将任意记录相互关联,这使得使用面向图形的数据集变得困难。例如,您可以使用图形数据库来分析实体之间存在哪些关系。

此外,网络数据库使用带有一组预定义字段的固定记录,而图形数据库使用更灵活的 属性图模型,允许节点/顶点和关系/边上的任意键/值对。

The network databases like CODSASYL are still more or less based on a hierarchical data model, thinking in terms of parent-child (or owner-member in CODASYL terminology) relationships. This also means that in network database you can't relate arbitrary records to each other, which makes it hard to work with graph-oriented datasets. For example, you may use a graph database to analyze what relationships exist between entities.

Also, network databases use fixed records with a predefined set of fields, while graph databases use the more flexible Property Graph Model, allowing for arbitrary key/value pairs on both nodes/vertices and relationships/edges.

明明#如月 2024-10-24 22:23:24

摘自 Martin Kleppmann 的《设计数据密集型应用程序》一书。

  1. 在网络模型中,数据库有一个模式,指定哪个记录类型可以嵌套在哪个其他记录类型中。在图数据库中,没有这样的限制:任何顶点都可以有到任何其他顶点的边。这为应用程序适应不断变化的需求提供了更大的灵活性。

  2. 在网络模型中,到达特定记录的唯一方法是遍历其访问路径之一。在图数据库中,您可以通过其唯一 ID 直接引用任何顶点,也可以使用索引来查找具有特定值的顶点。

  3. 在网络模型中,记录的子项是有序集,因此数据库必须维护该顺序(这会对存储布局产生影响),并且将新记录插入数据库的应用程序必须担心位置这些集中的新记录。在图数据库中,顶点和边不是有序的(只能在查询时对结果进行排序)。

  4. 在网络模型中,所有查询都是命令式的,难以编写,并且很容易被架构的更改破坏。在图数据库中,如果愿意,您可以用命令式代码编写遍历,但大多数图数据库还支持高级声明式查询语言,例如 Cypher 或 SPARQL。

Copying from the book Designing Data-Intensive Applications by Martin Kleppmann.

  1. In the network model, the database had a schema that specified which record type could be nested within which other record type. In a graph database, there is no such restriction: any vertex can have an edge to any other vertex. This gives much greater flexibility for applications to adapt to changing requirements.

  2. In the network model, the only way to reach a particular record was to traverse one of the access paths to it. In a graph database, you can refer directly to any vertex by its unique ID, or you can use an index to find vertices with a particular value.

  3. In the network model, the children of a record were an ordered set, so the database had to maintain that ordering (which had consequences for the storage layout) and applications that inserted new records into the database had to worry about the positions of the new records in these sets. In a graph database, vertices and edges are not ordered (you can only sort the results when making a query).

  4. In the network model, all queries were imperative, difficult to write and easily broken by changes in the schema. In a graph database, you can write your traversal in imperative code if you want to, but most graph databases also support high-level, declarative query languages such as Cypher or SPARQL.

风吹雨成花 2024-10-24 22:23:24

首先,我们要正确地提出问题。图数据库有两种类型:RD Graph(标准)和 Property Graph(非标准)。 Neo4J 是一个属性数据库,而不是“标准”RDF 图。

然后,如果您阅读了 Sumit Sethia 上面的答案,您将在网络模型和图数据库(默认情况下应将其理解为 RDF 图)之间的关系方面得到正确的答案。

将关系视为开发时间线会有所帮助,其中下一步“改进”前一步。那么它会像首先是分层数据库,然后是网络模型,然后是图,然后是属性图。顺便说一句,这不是“严格”的。

First, let´s ask the question correctly. There are TWO types of graph databases: RD Graph (standard) and Property Graph (non-standard). Neo4J is a Property Database, not a "standard" RDF Graph.

Then, if you read Sumit Sethia´s answer above, you will have the right answer in terms of the relationship between the Network Model and the Graph DB (which, by deafult should be understood as an RDF graph).

It helps to think of the relationships as a development time-line, where next step "improves" previous step. Then it would be something like the Hierarchical DB first, then the Network Model, then Graph, and then Property Graph. This is not "strict", by the way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文