CHAPTER 12 [OBJECT DATABASE CONCEPTS]
Naming Mechanism
object assigned a unique name in object base, user finds object by its name
Reachability
object referenced from other persistent objects, object located through references
What are the Type Inheritance rules:
All attributes/operations are inherited Order of supertypes in UNDER clause determines inheritance hierarchy Instance (object) of a subtype can be used in every context in which a supertype instance used Subtype can redefine any function defined in supertype
What is the UDT (user-defined types) used for?
Can be used to create a complex type for an attribute (similar to struct - no operations) Or: can be used to create a type as a basis for a table of objects (similar to class - can have operations)
How to Map an EER Schema to an ODB Schema
Create ODL class for each EER entity type Add relationship properties for each binary relationship Include appropriate operations for each class ODL class that corresponds to a subclass in the EER schema (Inherits type and methods of its superclass in ODL schema)
Reference Type
Create unique object identifiers (OIDs) Can specify system-generated object identifiers Alternatively can use primary key as OID as in traditional relational model
i = o.create_iterator() What does this mean?
Creates an iterator object for the collection To loop over each object in a collection
Collection (or multivalued) type constructor include?
Set (T) Bag (T) List (T) Array(T) Dictionary (K,T) These constructors are considered to be type generators
What does Class specify?
Specifies both state (attributes) and behavior (operations) of an object type Instantiable
What does Interface specify
Specifies only behavior of an object type Typically noninstantiable
Object database features that have been included in SQL:
Type constructors (generators) Mechanism for specifying object identity Encapsulation of operations Provided through user-defined types (UDTs) Inheritance mechanisms
How to create tables based on UDT
UDT must be INSTANTIABLE One or more tables can be created Table inheritance: - UNDER keyword can also be used to specify supertable/subtable inheritance -Objects in subtable must be a subset of the objects in the supertable
Subtype
Useful when creating a new type that is similar but not identical to an already defined type Subtype inherits functions Additional (local or specific) functions in subtype Example: -EMPLOYEE subtype-of PERSON: Salary, Hire_date, Seniority -STUDENT subtype-of PERSON: Major, Gpa
3 types of constructors (type generators):
1. Atom [basic data type (int, string, etc.)] 2. Struct [tuple] 3. Collection (or multivalued)
4. Typical operations that must be defined elsewhere in programming language.
1. Constructor Operation 2. Destructor Operation 3. Modifier Operations 4. Retrieve operation
What is the difference between between Object and Literal?
Object has five aspects: Identifier, name, lifetime, structure, and creation & Literal Value that does not have an object identifier
Extent
A named persistent object to hold collection of all persistent objects for a class
Behavior Inheritance
Also known as IS-A or interface inheritance.
Objects and Literals
Basic building blocks of the object model
What is the philosophical difference between relational model and object model of data?
Behavioral Specification
Encapsulation of operations
Both the object structure and the operations that can be applied to individual objects are included in the class/type definitions
UDT syntax
CREATE TYPE <type name> AS (<component declarations>);
Requirement that all objects be completely encapsulated is too stringent, what is one way to relax this requirement?
Can divide structure of object into visible and hidden attributes
What does the keyword REF specify?
Component attribute of one tuple may be a reference to a tuple of another table
What is the structure of arbitrary complexity?
Contain all necessary information that describes object or literal because in general, in traditional database systems, information about a complex object is often scattered over many relations or records, leading to loss of direct correspondence between a real-world object and its database representation. In ODBs, a complex type may be constructed from other types by nesting of type constructors.
How to map an EER schema to an ODB schema using Categories (union types)
Difficult to map to ODL
What notation applies to the 4 operations to object?
Dot notation
Transient Collection
Exists temporarily during the execution of a program
Another main characteristic of ODBs is that they do NOT allow type hierarchies and inheritance. TRUE OR FALSE
False. Another main characteristic of ODBs is that they do allow type hierarchies and inheritance.
Nesting Type Constructors
Generate complex type form other types
What is an 'Instance Variable' (attributes) in Object DB?
Holds values that define internal state of object
What happens if the keyword INSTANTIABLE is left out?
If keyword INSTANTIABLE is left out, can use UDT only as attribute data type - not as a basis for a table of objects
How does the unique identity implemented?
Implemented via a unique, system-generated object identifier (OID)
What is an example of the Operator Overloading concept?
In some languages, the operator symbol "+" can mean different things when applied to operands (objects) of different types. If the operands of "+" are of type integer, the operation invoked is integer addition. If the operands of "+" are of type floating point, the operation invoked is floating-point addition. If the operands of "+" are of type set, the operation invoked is set union. The compiler can determine which operation to execute based on the types of operands supplied.
What is the use of the extends inheritance?
Inherit both state and behavior strictly among classes
Inheritance
Inheritance allows the definition of new types based on other predefined types, leading to a type (or class) hierarchy.
Collection Objects
Inherits the basic Collection interace
What is Encapsulation related to?
It is related to the concepts of abstract data types
Type Generators
Many different types can be created. Example: set(string), set(integer), and set(Employee) are different types that can be created from the set type constructor.
How to map an EER schema to an ODB schema with an n-ary relationship with degree n>2
Map into a separate class, with appropriate references to each participating class
How to map an EER Schema to an ODB Schema with Weak entity types
Mapped same as regular entity types
Modifier Operations
Modify the state of an object
What are the typical mechanisms for making an object persistent?
Naming and Reachability mechanism
What is the Object identity?
Objects have unique identities that are independent of their attribute values and are generated by the ODB (Object database) system.
What is the one goal of the ODB (object database)?
One goal of an ODB is to maintain a direct correspondence between real-world and database objects so that objects do not lose their integrity and identity and can easily be identified and operated upon
Key
One or more properties whose values are unique for each object in extent of class
What does the Operator Overloading name refer to?
Operation name may be referred to several distinct implementations
Operation signature
Operation name, argument types, return value
What is Operator Overloading ability?
Operation's ability to be applied to different type of objects
Inheritance
Permits specification of new types or classes that inherit much of their structure and/or operation from previously defined types or classes
Encapsulation of operations
Provided through user-defined types (UDTs)
Inheritance mechanisms
Provided using keyword UNDER
CARDINALITY function
Returns the current number of elements in an array
In the Object Database, the operation is defined in what two parts?
Signature (interface) and Implementation (method)
What does keyword 'inverse' consist of?
Single conceptual relationship in inverse directions
What is the Behavior Inheritance specified by?
Specified by the colon (:) notation
Atomic (User-Defined) Objects
Specified using keyword 'class' in ODL
Type constructors (generators)
Specify complex types using UDT
What does the keyword SCOPE specifies
Specify name of table whose tuples referenced
What 2 components does an object database have?
State (value) and Behavior (operations)
Persistent Objects
Stored in database, persist after program termination. The typical mechanisms for making an object persistent are naming and reachability.
Persistent Collection
Stored permanently in the database
How is the concept of encapsulation applied to database objects in ODBs?
by defining the behavior of a class of object based on operations that can be externally applied
Multiple Inheritance
Subtype inherits functions (attributes and operations) of more than one supertype
What does ODL (object definition language) support?
Supports semantic construct of ODMG object model
What does it mean when the OID is immutable?
The OID value of a particular object should not change. This preserves the identity of the real-world object being represented. Also, It is also desirable that each OID be used only once; that is, even if an object is removed from the data- base, its OID should not be assigned to another object.
What is the concept of Encapsulation
The concept of encapsulation is one of the main characteristics of OO languages and systems.
What is the difference between conceptual design of ODB and RDB?
The difference is the handling of: Relationships and Inheritance
NOT FINAL
The keyword NOT FINAL indicates that subtypes can be created for that type
UNDER
The keyword UNDER is used to create a subtype
Collection (or multivalued) type constructor mean?
The set(T), list(T), bag(T), array(T), and dictionary(K,T), allow part of an object or literal value to include a collection of other objects or values when needed. MAKE SURE ALL ELEMENTS IN COLLECTION VALUE MUST BE SAME TYPE. Example: all values in collection of type set(string) must be string values
What is the OID (object identifier)?
The value of an OID may not be visible to the external user but is used internally by the system to identify each object uniquely and to create and manage interobject references. The OID can be assigned to program variables of the appropriate type when needed.
What are the external users of the object aware of?
They are only made aware of the interface of the operation, which defines the name and arguments (parameters) or each operation
What is the concept of Polymorphism of operations?
This concept allows the same opera- tor name or symbol to be bound to two or more different implementations of the operator, depending on the type of objects to which the operator is applied.
What is Polymorphism of Operations also known as?
This is also known as operator overloading
ODMG (Object Data Management Group) model
This is the data model for object definition language (ODL) and object query language (OQL)
Not all objects are meant to be stored permanently in the database, what is the solution?
Transient Objects and Persistant Objects
Most OO database systems allow for the representation of both objects and literals (simple or complex values) TRUE or FALSE
True
Multiple inheritance via extends not permitted in the EXTENDS inheritance? TRUE OR FALSE
True
Object Definition Language (ODL)
Used o define objects types for a particular database application
Constructor Operation
Used to create a new object
Destructor Operation
Used to destroy (delete) an object
Factory Object
Used to generate or create individual objects via its operations
Array Type
Used to specified collections
Is ODL independent of any particular programming language?
Yes
Does an object have a unique identity?
Yes, the unique identity is generally assigned to each independent object stored in the database.
Relationship in Atomic (user-defined) objects
a property that specifies that two objects in the database are related. This is represented by the keyword 'inverse'
What is the use for the dot notation?
builds path expressions
Type
defined by assigning it a type name and list of visible (public) functions (attributes or operations) since attributes resemble functions with zero arguments
Transient Objects
exist in the executing program and disappear once the program terminates
What keyword is specifies the EXTENDS inheritance?
extends
Attributes in Atomic (user-defined) objects
property that describes some aspect of an object
What does Behavior refer to
refers to operations
What does State refer to
refers to properties (attributes)
Collection objects further specialized into:
set, list, bag, array, and dictionary
In SQL, a what is user-defined type and what is the format?
specifies methods (or operations) in addition to the attributes FORMAT: CREATE TYPE <TYPE-NAME> ( <LIST OF COMPONENT ATTRIBUTES AND THEIR TYPES> <DECLARATION OF FUNCTIONS (METHODS)> );
What is this used for "-->"
used for dereferencing
Instantiable
user can create one or more tables based on the UDT
How to reference arrays
using []
How to specify that UDT is instantiable
using the phrase INSTANTIABLE