Object identity



next up previous
Next: Encapsulation Up: Mandatory features: the Previous: Complex objects

Object identity

Thou shalt support object identity


Object identity has long existed in programming languages. The concept is more recent in databases, e.g., [Hall et al. 76], [Maier and Price 84], [Khoshafian and Copeland 86]. The idea is the following: in a model with object identity, an object has an existence which is independent of its value. Thus two notions of object equivalence exist: two objects can be identical (they are the same object) or they can be equal (they have the same value). This has two implications: one is object sharing and the other one is object updates.

Object sharing: in an identity-based model, two objects can share a component. Thus, the pictorial representation of a complex object is a graph, while it is limited to be a tree in a system without object identity. Consider the following example: a Person has a name, an age and a set of children. Assume Peter and Susan both have a 15-year-old child named John. In real life, two situations may arise: Susan and Peter are parent of the same child or there are two children involved. In a system without identity, Peter is represented by:

        (peter, 40, {(john, 15, {})})

and Susan is represented by:

        (susan, 41, {(john, 15, {})}).

Thus, there is no way of expressing whether Peter and Susan are the parents of the same child. In an identity-based model, these two structures can share the common part (john, 15, {}) or not, thus capturing either situations.

Object updates: assume that Peter and Susan are indeed parents of a child named John. In this case, all updates to Susan's son will be applied to the object John and, consequently, also to Peter's son. In a value-based system, both sub-objects must be updated separately. Object identity is also a powerful data manipulation primitive that can be the basis of set, tuple and recursive complex object manipulation, [Abiteboul and Kanellakis 89].

Supporting object identity implies offering operations such as object assignment, object copy (both deep and shallow copy) and tests for object identity and object equality (both deep and shallow equality).

Of course, one can simulate object identity in a value-based system by introducing explicit object identifiers. However, this approach places the burden on the user to insure the uniqueness of object identifiers and to maintain referential integrity (and this burden can be significant for operations such as garbage collection).

Note that identity-based models are the norm in imperative programming languages: each object manipulated in a program has an identity and can be updated. This identity either comes from the name of a variable or from a physical location in memory. But the concept is quite new in pure relational systems, where relations are value-based.



next up previous
Next: Encapsulation Up: Mandatory features: the Previous: Complex objects




Wed Apr 26 02:23:56 EDT 1995