如何将关系数据库建模为neo4j图形数据库? [英] How to model a relational database into a neo4j graph database?

查看:298
本文介绍了如何将关系数据库建模为neo4j图形数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关系数据库(大约30个表),我想将其转置到neo4j图形数据库中,而且我不知道从哪里开始... 是否有将表和/或元组转置为图形模型的一般方法? (关系属性,一个或多个图形?)最佳的文档来源是什么?

I have a relational database (about 30 tables) and I would like to transpose it in a neo4j graph database, and I don't know where to start... Is there a general way to transpose tables and/or tuples into a graph model ? (relations properties, one or more graphs ?) What are the best sources of documentation ?

感谢您的帮助,

最诚挚的问候

推荐答案

这种转换不会一站式服务,因为并非所有数据模型都适用于图形建模,并且每个应用程序都是独特的特殊雪花...但是这样说.....

There's not going to be a one-stop-shop for this kind of conversion, as not all data models are appropriate for graph modeling, and every application is a unique special snowflake...but with that said.....

通常,您的基本"表(例如,用户,角色,订单,产品)将成为节点,而您的联接表"(也称为破坏者"表)将成为关系的候选者(例如,UserRole,OrderLineItem).要记住的关键一点是,通常,在一个图上,两个特定节点之间只能具有一种给定类型的关系-因此,在上面的示例中,如果系统允许同一产品的订单两次出现,这将导致问题.

Generally, your 'base' tables (e.g. User, Role, Order, Product) would become nodes, and your 'join tables' (a.k.a. buster tables) would be candidates for your relationships (e.g. UserRole, OrderLineItem). The key thing to remember that in a graph, generally, you can only have one relationship of a given type between two specific nodes - so in the above example, if your system allows the same product to be in an order twice - it would cause issues.

外键是关系的第二个来源,请查看它们以了解建立关系还是仅作为财产有意义.

Foreign keys are your second source of relationships, look to them to see if it makes sense to be a relationship or just a property.

请记住您要通过数据模型解决的问题-如果遍历对象以查找关系和距离等,则图形可能非常合适.如果要在建模电子商务应用程序时要处理单个嵌套对象(例如订单->订单项->产品-> sku),那么关系模型可能是合适的.

Just keep in mind what you are trying to solve by your data model - if it's traversing your objects to find relationships and distance, etc... then graphs may be a good fit. If you are modeling an eCommerce app, where you are dealing with manipulating a single nested object (e.g. order -> line item -> product -> sku), then a relational model may be the right fit.

希望我的0.02美元有帮助...

Hope my $0.02 helps...

这篇关于如何将关系数据库建模为neo4j图形数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆