如何对具有未知属性的数据进行建模? [英] How to model data with unknown attributes?

查看:23
本文介绍了如何对具有未知属性的数据进行建模?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对需要查询但无法预先完全定义的数据进行建模的好方法有哪些?

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?

这对于以文档为中心的数据库(MongoDB?)是否有用,或者某些设计模式可以应用于经典的关系数据库?

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 是 6NF 的一个子集,没有 Integrity 或 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 to the context and arguments raised.

EAV-6NF 答案一
EAV-6NF 答案二
EAV-6NF 答案三

这篇关于如何对具有未知属性的数据进行建模?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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