Advanced Database Systems

0 of 4 lessons complete (0%)

Chapter 1: Concepts for Object-Oriented DatabasesAdvanced Database Systems

1.2. Object Identity, Object Structure, and Type Constructors

This is a preview lesson

Register or sign in to take this lesson.

Object Identity & Type Constructors – CoSc 2042 | Ethio Temari
Advanced Database Systems: Object Identity, Object Structure, Type Constructors – OID, atom, tuple, set. Ethiopian Higher Education exam prep.

📌 Chapter 1.2 – Object Identity, Object Structure, and Type Constructors

👋 Hi, Ethio students! Welcome back. Today we dig deep into object identity, the (i, c, v) triple, and the constructors that build complex objects. Everything is from your CoSc 2042 module. Let’s make it crystal clear! 🇪🇹

🔐 1.2.1 Object Identity (OID) – the soul of an object

In an object‑oriented database, every object is given a unique, never‑changing object identifier (OID). It’s like a fingerprint or a national ID number (like your Ethiopian passport number) but for the database. No matter how the object’s data changes, the OID stays the same.

The PDF states: “OID is not visible to the external user, but it is used internally to identify each object uniquely and to create inter‑object references.” So you never see it, but the database uses it everywhere.

💡 Example – two students with same name:

Student table (conceptual)
------------------------------------------------
| OID (hidden)  |  name    |  department       |
------------------------------------------------
| 0x9A2C1       |  Abebe   |  Computer Science |
| 0x9A2C2       |  Abebe   |  Software Eng     |
------------------------------------------------
Even if both are called Abebe, OIDs are unique. If Abebe changes his dept, OID 0x9A2C1 remains.
        

✨ Two main properties of OID

  • Immutable – never changes after creation.
  • Single‑use – even if the object is deleted, its OID is never assigned to another object. (like a burnt Ethiopian birr note – we never reuse serial numbers)

Forms of identity in computer systems (important for exam)

Identity typeDescriptionExample
Value‑basedidentity by data values (primary key)Relational primary key (e.g., student ID = 1234)
Name‑baseduser‑supplied namevariable name in a program, file path
Built‑in (OID)system‑generated, invisible, never changesObject‑oriented databases, OIDs

🔔 Remember: OODBS uses built‑in identity. No user‑supplied identifier is required.

📘 Exam tip – Mid/Ethio Exit: They often ask: “Which identity form is used in OODBS?” or “List two properties of OID.” Also be ready to contrast OID with relational primary key. Primary key can change if you update a value, but OID never changes.

📝 Practice questions – Object Identity

Q1 (exit style): In an object‑oriented database, the object identifier (OID) has which of the following characteristics?
A) It can be modified by the user if needed
B) It is reused immediately after object deletion
C) It is immutable and each OID is used only once
D) It is based on the object’s primary key value

✅ Correct: C. OID is immutable and never reused – even after deletion. A and B are false; D is wrong because OID is not value‑based.

Q2: Which form of identity is used in object‑oriented database systems?
A) Value‑based (primary key)
B) User‑supplied name
C) Built‑in identity
D) File path

✅ C – built‑in identity. OODB relies on system‑generated, invisible OIDs.

Q3 (true/false): If an object’s attributes are all changed, its OID remains the same. (True/False)

✅ True. OID is immutable – it survives any change to the object’s state.

🧩 1.2.2 Object Structure – the (i, c, v) triple

The PDF gives us a formal way: every object can be viewed as a triple (i, c, v) where:

  • i = unique object identifier (OID)
  • c = type constructor (how the state is built: atom, tuple, set, list …)
  • v = object state (current value)

This allows objects to be nested: a set can contain tuples that contain atoms, etc.

🔍 Example – a University object (simplified):

(i: OID_U001,
 c: tuple,
 v:  < name: "AAU",
       students: (i: OID_S100, c: set, v: { S1, S2, S3 })
      > )
        

We see nesting: tuple constructor contains an atom (name) and a set (students). Each student is another object.

🏗️ The three most basic type constructors

From page 9 of the PDF: atom, tuple, set are the core. Then we have list, bag, array as extra.

ConstructorMeaningExample value (v)Usage
Atombasic atomic values25, ‘Ethiopia’, true, 3.14integers, strings, booleans
Tuplerecord with named fields<fname: ‘Azeb’, lname: ‘Wondimu’>structured data (like a row)
Setunordered collection, no duplicates{ oid1, oid2, oid3 }many-to-many relationships
Listordered, duplicates allowed[ ‘A’, ‘B’, ‘A’ ]ordered data

Think of constructors as ways to build complex objects from simpler pieces. Like we use cement, bricks, wood to build a house – we combine atoms, tuples, sets to build any real‑world object.

🌰 More examples from the PDF idea:

(oid101, atom, 1996)                           // a simple integer
(oid102, tuple, < city: "Addis", pop: 5e6 >)   // tuple with two fields
(oid103, set, { oid101, oid104, oid105 })       // set of OIDs (references)
    

📝 Practice – object structure & constructors

Q4: In the triple (i, c, v), what does ‘c’ represent?
A) object identifier
B) constructor indicating how state is built
C) current class name
D) collection

✅ B – constructor. c is the type constructor (atom, tuple, set, …).

Q5: Which constructor would you use to represent a student’s list of grades in order (with possible repeated scores)?
A) set
B) atom
C) tuple
D) list

✅ D – list. List preserves order and allows duplicates, perfect for grade sequence.

Q6 (exit): A complex object in OODB can have arbitrary nesting of constructors. Which of the following is valid?
A) set of tuples
B) tuple containing an atom and a set
C) list of sets
D) all of the above

✅ D – all of the above. OODB allows unlimited nesting: set of tuples, tuple containing set, list of sets — all possible.

⚙️ 1.2.3 Deep dive – atom, tuple, set (and friends)

Let’s look more closely at each constructor from the exam point of view.

⚛️ Atom constructor

The atom constructor represents simple, built‑in data types: integers, floats, chars, strings, booleans. It’s the leaf of the object tree. From PDF: “used to represent all basic atomic values”.

Atom examples: (oid200, atom, 100) (oid201, atom, "Debre Zeit") (oid202, atom, false)

📦 Tuple constructor

Tuple is like a record or struct with field names. It groups related values. Important: fields can be atoms or even other objects (via OID).

(oid300, tuple, <   courseCode: "CoSc2042",
                   title: "Advanced DB",
                   credits: 5,
                   instructor: oid301   >)
    

Here the instructor field is an OID referencing another object.

🔗 Set constructor

A set holds an unordered collection of objects/values with no duplicates. Perfect for representing relationships like “courses a student is enrolled in”.

(oid400, set, { oid401, oid402, oid403 })   // set of three OIDs
    

➕ Other constructors (list, bag, array)

  • List: ordered, may have duplicates. e.g., to-do list.
  • Bag: unordered, allows duplicates (like a multiset).
  • Array: fixed‑size indexed collection.
ConstructorOrder?Duplicates?Typical use
Atomsimple values
Tupleby field nameN/Arecords
Setnonounique collections
Listyesyesordered data, e.g., timeline
Bagnoyesmultiset, e.g., inventory with counts

Q7 (Mid): Which constructor should be used to represent a set of phone numbers assigned to a person, assuming a person cannot have the same number twice?
A) list
B) bag
C) set
D) tuple

✅ C – set. Set disallows duplicates, which fits “cannot have same number twice”.

Q8 (design): An order object contains order lines, and the lines must be kept in the order they were entered. Which constructor is appropriate for the lines?
A) set
B) bag
C) list
D) atom

✅ C – list. List preserves insertion order.

Q9: True or False: A tuple constructor can contain an atom as a field value, and also a set as another field.

✅ True. Nesting is allowed. Example: tuple with name (atom) and course set (set).

🎯 Putting it all together – why this matters for your exam

Object identity and constructors are the foundation of OODB. You’ll face questions like:

  • “Explain the (i,c,v) model with an example.”
  • “Differentiate between set and list constructors.”
  • “Why is OID immutable?”

📌 Common mistakes to avoid

❌ Thinking OID is same as primary key – primary key is value‑based, OID is built‑in.
❌ Mixing up set (no duplicates) and bag (duplicates allowed).
❌ Forgetting that tuples have named fields (unlike lists).

📝 Mixed practice (Exit exam level)

Q10: Given the following object: (oid52, tuple, <a: (oid53, atom, 10), b: (oid54, set, {1,2,3})>). Which statement is correct?
A) The object has nested constructors – tuple contains atom and set
B) It is invalid because a tuple cannot contain a set
C) The OID of the inner set is oid52
D) The set constructor contains tuples

✅ A – nested constructors: tuple contains atom field ‘a’ and set field ‘b’. It’s perfectly valid. OID of set is oid54, not oid52. Set contains atoms 1,2,3, not tuples.

Q11: Why do OODB systems use built‑in identity instead of value‑based identity? (short answer)

✅ Because objects may change their state (values) but still need to be identified as the same entity. Built‑in identity (OID) remains unchanged even when values change, ensuring consistent references.

🧾 Quick summary – what we studied

  • OID – immutable, single‑use, built‑in identity.
  • Object structure = (i, c, v).
  • Three basic constructors: atom (basic values), tuple (record), set (unordered unique).
  • Nesting is allowed: set of tuples, tuple with set, etc.
  • Other constructors: list (ordered), bag (duplicates allowed), array.

✨ Keep practising, Ethio students! You’ll master OODB. Tell your friends about ethiotemari.com.

Scroll to Top