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.92cms.cn其它相關文章!