对象标识以及对象与文字

2023年 9月 1日 83.1k 0

对象标识以及对象与文字

DBMS supports object-oriented data. It ensures direct correspondence between real-world objects and their representations in the database. This correspondence ensures that objects retain their integrity and identity. It enables easy identification and manipulation. Object Data Management System (ODMS) assigns unique identity to each independent object stored in the database.

这个独特的身份通过系统生成的对象标识符(OID)来实现。该OID作为系统分配给每个对象的独特值。它对外部用户不可见。然而,系统在内部利用它来确保每个对象的唯一标识,并建立和管理对象之间的引用。在需要时,系统将OID分配给适当类型的程序变量,以进行涉及对象的操作。

Immutability and Uniqueness

Primary requirement for an Object Identifier (OID) in an Object Data Management System (ODMS) is immutability. It is crucial that the OID value assigned to a specific object remains unchanged, ensuring the preservation of the object's identity in the real world. ODMS must incorporate mechanisms for generating OIDs and enforcing their immutability. It is desirable for each OID to be unique and used only once. Even if an object is removed from the database, its OID should not be reassigned to another object.

To fulfill these requirements, OID should not depend on any attribute values of the object. This is necessary because attribute values may change or be corrected over time. In the relational model, each relation requires primary key. If the value of the primary key is altered, tuple will consider new identity. In different relations, real-world object may have different names for its key attributes. It can create challenges in determining if the keys represent the same real-world object. For example, the object identifier may be represented as "Emp_id" in one relation and as "Ssn" in another relation.

使用对象标识符(OIDs)进行高效检索

Object Identifier (OID) on the physical address of the object in storage is deemed inappropriate in a Database Management System (DBMS). This is because the physical address can change following a physical reorganization of the database. However, some early Object Data Management Systems (ODMSs) have employed the physical address as the OID in order to enhance the efficiency of object retrieval.

为了适应物理地址发生变化的情况,可以利用涉及间接指针的机制。该指针放置在原始地址上,并提供对象的新物理位置。然而,在现代实践中,将长整数分配为OID更为常见。随后,使用哈希表或类似的数据结构将OID值映射到对象在存储中的当前物理地址。这种方法确保OID不受任何物理重组的影响,同时仍能实现高效的对象检索。

Early Approaches and Challenges with OIDs

In early Object-Oriented (OO) data models, there was a requirement that all entities, including simple values and complex objects, be represented as objects. Consequently, each basic value like an integer, string, or Boolean value was assigned an Object Identifier (OID). This approach allowed identical basic values to possess different OIDs, which could be advantageous in certain situations. For instance, the integer value 50 could represent the weight in kilograms in one context and the age of a person in another context. By creating two distinct basic objects with separate OIDs, both objects could represent the integer value 50. However, while this approach held theoretical value, it proved impractical as it resulted in the generation of a large number of OIDs.

为了解决这个限制,大多数面向对象数据库系统现在支持对象和字面量(或值)的表示。每个对象必须有一个不可变的OID分配给它,以确保其唯一标识。相比之下,字面量值没有OID,只是表示其自身的值。通常,字面量值存储在对象内部,不能被其他对象引用。此外,在许多系统中,如果需要,可以创建复杂的结构化字面量值而无需相应的OID。

以上就是对象标识以及对象与文字的详细内容,更多请关注每日运维网(www.mryunwei.com)其它相关文章!

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论