编辑“︁
Meta object model for relational data storage
”︁
跳转到导航
跳转到搜索
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
{{Navigation for Marauroa Top|Internals}} {{Navigation for Marauroa Developers}} {{Future Concept}} == Object Model of Marauroa == Marauroa supports definition of classes and attributes at runtime. The type information is stored in instances of RPClass. Instantiated Objects are RPObjects which must obey the rules defined in their associated RPClass. Associations are defined in RPClass as well and the links on the instance layer are represented by RPSlot instances. == The basic Meta Model == This chapter will describe a generic meta model for object orientated systems. The following class diagrams are designed with mapping to database tables in mind. Therefore the direction of the association arrows may appear strange on a first glance. === Model Layer === Let's start with thinking about the model layer. It consists of classes with their attributes and associations. In addition to that the classes form a hierarchy of specializations. [[Image:Model_layer.png]] In Marauroa "associations" are named "slots". They don't have a target type. === Instance Layer === Based on the model layer instances can be created: [[Image:Instance_layer.png]] On the instance layer the actual life data is managed. Every object on the instance layer has a type on the model layer. So for example every object is an instance of exactly one class. Just as the model layers classes have attributes, objects have values. Those values are instances of the appropriate attribute. This means that there is a consistency condition: A value may only belong to an object which is an instance of a class (or subclass) to which the attribute belongs. The same is true for links on the other side of the diagram. They are instances of association with the same set of consistency conditions. Differences to Marauroa: In Marauroa associations (slots) don't have a target type. So that condition is not required. But the slots are ordered lists, so an additional attribute in link for the sort oder is required. == Converting the Meta Model into a database structure == TODO: ... == Performance optimization for inheritance == TODO: reflexive and transitive == Version support for the model layer == TODO: ... == Revision support for the instance layer == TODO: ... == TODO == TODO: ... CREATE TABLE class (id SERIAL, name VARCHAR); CREATE TABLE inheritance (id SERIAL, sub_class_id INTEGER, super_class_id INTEGER); CREATE TABKE attribute_type (id SERIAL, name VARCHAR, class_id INTEGER, type CHAR(1)); CREATE TABKE association_type (id SERIAL, name VARCHAR, class_id INTEGER, class_id INTEGER); CREATE TABLE object (id SERIAL, class_id INTEGER); CREATE TABLE value_char (id SERIAL, attribute_type_id INTEGER, object_id INTEGER, value VARCHAR); CREATE TABLE value_int (id SERIAL, attribute_type_id INTEGER, object_id INTEGER, value INTEGER); CREATE TABLE value_blob (id SERIAL, attribute_type_id INTEGER, object_id INTEGER, value BLOB); CREATE TABLE link (id SERIAL, association_type_id INTEGER, object_id INTEGER, target_object_id INTEGER); There is a type layer at the top, consisting of classes (e.g. Player), attributes (e. g. ATK) and associations (e. g. bank_slot). The Inheritance is the reference to the super object (Player, RPEntity) The second block is the instance layer. It consists of objects (4711 of type Player), values (43 for atk) and links (items in the bank_slot). Of cause there are some consistency conditions required. For example value.object.class <= value.attribute.class. This basic model can than be easily extended. For example in our case we want a sort order in links table. And because some databases are very slow at deleting rows, or just in case we may want a revision safe system there is an easy way to achieve that: Add a new table activity which basically has a timestamp. All the table on the instance layer get two additional columns: created_activity_id and deleted_activity_id. This is a lit bit redundant but required for performance reasons. Together with a second trick, the whole system is much faster as one would guess: This trick is to have two special activities: "beginning of time" (lowest possible date) and "end of time" (highest possible date). This allows to greatly simplify the queries, because deleted_activity now always has a valid value. Life objects are simply deleted at the end of time. [[Category:Marauroa]] {{#breadcrumbs: [[Marauroa]] | [[Navigation for Marauroa Developers|Internals]] | [[Marauroa Roadmap|Roadmap]] | [[Meta object model for relational data storage|Meta object model]] }}
摘要:
请注意,所有对gamedev的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Gamedev:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
该页面使用的模板:
Template:Br
(
编辑
)
Template:Future Concept
(
编辑
)
Template:Navigation Menu Marauroa General
(
编辑
)
Template:Navigation Menu Marauroa Internals
(
编辑
)
Template:Navigation Menu Marauroa Users
(
编辑
)
Template:Navigation for Marauroa Developers
(
编辑
)
Template:Navigation for Marauroa Top
(
编辑
)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
页面
讨论
不转换
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息