如何建模具有未知属性的数据? [英] How to model data with unknown attributes?
问题描述
例如...说我想关于世界各国的模型信息。每个国家/地区都有人口,标志和语言列表,这很简单。但是说我们也想模仿他们国家棒球队的胜负记录,当然不是所有的国家都有一个。或者,我们想跟踪他们的国王&皇后(再次显然不适用于大多数国家)。或者,我们决定我们要模拟平均部落成员在一生中直立的蒙古包数量。无论如何,无论如何,无论如何,我们不会(而且永远不会)知道到达我们之前会发生什么。哪些方法既可扩展又可查询?
这可能对于以以文档为中心的数据库MongoDB?)或者一些设计模式可以应用于经典的关系数据库?
你可以在一个纯粹的关系数据库中做到这一点,享受关系数据库的速度和力量。
您需要使用第六个正常表单,正确的方法具有完整的完整性和控制权。
EAV是一个子集的6NF没有完整性或控制权,并且通常非常糟糕的实现。
我对这些问题的回答提供了对该主题的完整的处理。由于提出的背景和论点,最后一个特别长。
EAV-6NF答案一
EAV-6NF答案二
EAV-6NF答案三
What are good ways to model data that will need to be queried but where it's impossible to fully define up front?
For instance... say I want to model information about the countries of the world. Each country has a population, a flag and a list of languages, that's easy enough. But say we also want to model the win/loss record of their national baseball team and not all countries have one, of course. Or, we want to track the lineage of their kings & queens (again, obviously not applicable to most countries). Or, we decide we want to model the number of yurts the average clan member will erect in a lifetime.
Anyway, point is, we don't (and won't ever) know what's coming until it hits us. What approaches are there that are both scalable and query-able?
Is this, perhaps, a good use for a Document-centric database (MongoDB?) or perhaps some design pattern could be applied to the classic Relational database?
You can do that in a pure Relational Database, and enjoy the speed and power of Relational databases.
You need to use Sixth Normal Form, the proper method with full integrityand control.
EAV is a subset of 6NF without the Integrity or control, and usualy very badly implemented.
My answers to these questions provide a full treatment of the subject. The last one is particularly long due the the context and arguments raised.
EAV-6NF Answer One
EAV-6NF Answer Two
EAV-6NF Answer Three
这篇关于如何建模具有未知属性的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!