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.
這個(gè)獨(dú)特的身份通過系統(tǒng)生成的對(duì)象標(biāo)識(shí)符(OID)來實(shí)現(xiàn)。該OID作為系統(tǒng)分配給每個(gè)對(duì)象的獨(dú)特值。它對(duì)外部用戶不可見。然而,系統(tǒng)在內(nèi)部利用它來確保每個(gè)對(duì)象的唯一標(biāo)識(shí),并建立和管理對(duì)象之間的引用。在需要時(shí),系統(tǒng)將OID分配給適當(dāng)類型的程序變量,以進(jìn)行涉及對(duì)象的操作。
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.
使用對(duì)象標(biāo)識(shí)符(OIDs)進(jìn)行高效檢索
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.
為了適應(yīng)物理地址發(fā)生變化的情況,可以利用涉及間接指針的機(jī)制。該指針放置在原始地址上,并提供對(duì)象的新物理位置。然而,在現(xiàn)代實(shí)踐中,將長整數(shù)分配為OID更為常見。隨后,使用哈希表或類似的數(shù)據(jù)結(jié)構(gòu)將OID值映射到對(duì)象在存儲(chǔ)中的當(dāng)前物理地址。這種方法確保OID不受任何物理重組的影響,同時(shí)仍能實(shí)現(xiàn)高效的對(duì)象檢索。
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.
為了解決這個(gè)限制,大多數(shù)面向?qū)ο髷?shù)據(jù)庫系統(tǒng)現(xiàn)在支持對(duì)象和字面量(或值)的表示。每個(gè)對(duì)象必須有一個(gè)不可變的OID分配給它,以確保其唯一標(biāo)識(shí)。相比之下,字面量值沒有OID,只是表示其自身的值。通常,字面量值存儲(chǔ)在對(duì)象內(nèi)部,不能被其他對(duì)象引用。此外,在許多系統(tǒng)中,如果需要,可以創(chuàng)建復(fù)雜的結(jié)構(gòu)化字面量值而無需相應(yīng)的OID。
以上就是對(duì)象標(biāo)識(shí)以及對(duì)象與文字的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注www.92cms.cn其它相關(guān)文章!