neo4j - 我如何建模节点模式少? [英] neo4j - how do I model node schema less?
问题描述
我读了一些noe4j或其他nosql数据库是无模式的。所以什么是模式?我想更多地了解它与用例。
I read some where that noe4j or other nosql database is schemaless. so what is the schemaless? I would like to know more about it with use case.
推荐答案
您不需要定义一个模式,在mysq与表。相反,您可以根据需要向每个节点(条目)添加属性及其值。
You don't need to define a schema like you would have to do e.g. in mysq with a table. Instead, you can add properties and their value to each individual node (entry), as you like.
例如:如果你在安卓手机上查看通讯录,一个人的条目可以有很多属性 - 电话号码,地址,名字。有些人有很多属性,有些没有。
E.g: if you look at the address book in an android phone a person entry can have a multitude of properties - phone numbers, addresses, names. Some people have a lot of attributes, some have none.
使用模式(例如表结构)做类似的操作真的很难,需要提前规划字段是什么,以及如何在未来。
Doing something like that with a schema (e.g. table structure) is really hard, and requires advance planning of what your fields are, and how you want to query them in the future.
没有模式,你可以或多或少地玩,并根据需要添加。
Without a schema you can more or less play it by ear, and add things as needed.
什么需要决定是什么作为属性添加到节点,以及作为相关节点。例如。是地址的一个节点,还是一个人的财产? (很可能是一个独立的节点,但它取决于你的用例)
What needs deciding though is what to add as property to a node, and what as a related node. E.g. is an address a node, or just a property of a person? (Most likely a seperate node, but it depends on your use case)
这篇关于neo4j - 我如何建模节点模式少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!