In object-database systems, data objects can be given an object identifier (oid), which is some value that is unique in the database across time. The DBMS is responsible for generating oids and ensuring that an oid identies an object uniquely over its entire lifetime. In some systems, all tuples stored in any table are objects and are automatically assigned unique oids; in other systems, a user can specify the tables for which the tuples are to be assigned oids. Often, there are also facilities for generating oids for larger structures (e.g., tables) as well as smaller structures.
An object's oid can be used to refer (or `point') to it from elsewhere in the data. Such a reference has a type, with a corresponding type constructor :
ref(base): a type representing a reference to an object of type base. The ref type constructor can be interleaved with the type constructors for structured types; for example,
Notions of Equality
The distinction between reference types and reference-free structured types raises an other issue: the definition of equality. Two objects having the same type are defined to be deep equal if and only if:
The objects are of atomic type and have the same value, or
The objects are of reference type, and the deep equals operator is true for the two referenced objects, or
The objects are of structured type, and the deep equals operator is true for all the corresponding subparts of the two objects.
Two objects that have the same reference type are defined to be shallow equal if they both refer to the same object . The definition of shallow equality can be extended to objects of arbitrary type by taking the definition of deep equality and replacing deep equals by shallow equals in parts (2) and (3).
Dereferencing Reference Types
An item of reference type ref(foo) is not the same as the foo item to which it points. In order to access the referenced foo item, a built-in deref() method is provided along with the ref type constructor.
For example, given a tuple from the Nowshowing table, one can access the name eld of the referenced theater_t
Nowshowing.deref(theater).name. Since references to tuple types are common, some systems provide a java-style arrow operator, which combines a postx version of the dereference operator with a tuple-type dot operator. Using the arrow notation, the name of the referenced theater can be accessed with the equivalent syntax Now showing.theater->name.