Google App Engine上的博客标记系统的数据建模建议 [英] Data Modelling Advice for Blog Tagging system on Google App Engine

查看:154
本文介绍了Google App Engine上的博客标记系统的数据建模建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以提供一些有效的方法来建立一个数据模型来完成下面描述的简单系统的概念性建议。对于以非关系方式进行思考有点新,并且想要避免任何明显的缺陷。我的理解是,一个基本的原则是存储便宜,不用担心数据重复,就像在规范化的RDBMS中一样。



我想要建模的是:

可以给出0-n标签的博客文章。许多博客文章可以共享相同的标签。当检索数据时,希望允许检索与标签匹配的所有文章。在很多方面与在此使用的方法非常相似。



我的正常心态是在标签和博客文章之间建立多对多的关系。然而,我在GAE的背景下认为,这将是昂贵的,虽然我已经看到它的例子。

也许使用包含每个标签的ListProperty作为文章实体的一部分,以及第二个数据模型用于追踪标签添加和删除?这种方式不需要任何关系,并且ListProperty仍然允许任何列表元素匹配返回结果的查询。



关于在GAE上最有效的方法提出任何建议?

解决方案

感谢您的建议。我已经实现(第一次迭代)如下。不知道这是否是最好的方法,但它是有效的。



A类=文章。有一个可以在列表元素上查询的StringListProperty



Class B = Tags。每个标签一个实体,也保持使用每个标签的文章总数的计数。

对A的数据修改伴随着对B的维护工作。预先计算是一个阅读繁重的环境中的好方法。


Am wondering if anyone might provide some conceptual advice on an efficient way to build a data model to accomplish the simple system described below. Am somewhat new to thinking in a non-relational manner and want to try avoiding any obvious pitfalls. It's my understanding that a basic principal is that "storage is cheap, don't worry about data duplication" as you might in a normalized RDBMS.

What I'd like to model is:

A blog article which can be given 0-n tags. Many blog articles can share the same tag. When retrieving data would like to allow retrieval of all articles matching a tag. In many ways very similar to the approach taken here at stackoverflow.

My normal mindset would be to create a many-to-may relationship between tags and blog articles. However, I'm thinking in the context of GAE that this would be expensive, although I have seen examples of it being done.

Perhaps using a ListProperty containing each tag as part of the article entities, and a second data model to track tags as they're added and deleted? This way no need for any relationships and the ListProperty still allows queries where any list element matching will return results.

Any suggestions on the most efficient way to approach this on GAE?

解决方案

Thanks to both of you for your suggestions. I've implemented (first iteration) as follows. Not sure if it's the best approach, but it's working.

Class A = Articles. Has a StringListProperty which can be queried on it's list elements

Class B = Tags. One entity per tag, also keeps a running count of the total number of articles using each tag.

Data modifications to A are accompanied by maintenance work on B. Thinking that counts being pre-computed is a good approach in a read-heavy environment.

这篇关于Google App Engine上的博客标记系统的数据建模建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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