Nordic (9)


This series is a commentary of sorts on a PowerPoint™ presentation called Nordic – Object Relational Database Design. The previous posts are at

We have completed a physical design that includes the state class, ANIMAL_STATE. Now we move onto slide #34 of the presentation.

Object Data

The following table attempts to map attributes listed on slide #34 of the presentation against columns from Oracle Data Dictionary views. These examples are for the ANIMAL type.

Nordic Attribute Oracle
Data Dictionary View Column
ObjectID (GUID) OBJECT_ID pseudo-column.
ObjectCode
Name1 (w/soundex) USER_OBJECTS OBJECT_NAME
Name2 (w/soundex)
Workflow State Not implemented
Primary Date Not explained in presentation.
Owner Object Username used to connect to Oracle instance.
Language Object Set for the session when one connects to the Oracle instance.
Version USER_TYPE_VERSIONS VERSION#
DateCreated USER_OBJECTS CREATED
DateModified USER_OBJECTS LAST_DDL_TIME
Active Not implemented
Locked (Frozen) Not implemented

Object Facade

We are now at slide #36 of the presentation.

InsertObject

To insert a new object, we would use the INSERT command to achieve this in conjunction with the object constructor.

INSERT INTO animals VALUES( NEW horse( 'Phar Lap', NEW animal_state( 'Deceased' ) ) );

DeleteObject

To delete an object, we would use the DELETE command to achieve this.

DELETE FROM animals WHERE name = 'Phar Lap';

MorphObject

To change the class of an object, we would use the UPDATE command in conjunction with the OBJECT_VALUE psuedo-column. To morph the horse, ‘Mabel’, into a girl: (See also slide #40)

UPDATE animals ptr
  SET object_value = NEW girl( name, NEW human_state( ptr.current_state.state ) )
  WHERE name = 'Mabel';

MorphClass

To modify a class definition, we would use the ALTER TYPE command with the CASCADE option:

ALTER TYPE animal ADD ATTRIBUTE nonsense NUMBER CASCADE;

UpdateObject

To change an attribute of an object, we would use the UPDATE command:

UPDATE animals SET state = NEW animal_state( 'Ill' ) WHERE name = 'Mabel';

AssociateObject

To associate one object with another object, we would use the INSERT command to place a row in a an association table:

INSERT INTO courtships VALUES( 'Billy Joe', 'Mary Lou' );

DeleteAssociation

To remove an association between two objects, we would use the DELETE command to achieve this.

DELETE FROM courtships WHERE guy_name = 'Billy Joe' AND girl_name = 'Mary Lou';

Object Facade: Searching

We are now at slide #37 of the presentation.

FetchObjectID

Since each base class is persisted to a different table, and we have used the NAME column as the primary key for some of these columns, we can easily identify objects by table name and primary key.

SELECT object_id FROM animals WHERE name = 'Mabel';

ObjectSearch

See previous item.

Object Facade: Cascade Class Retrieval

We are now at slides #38 and #39.

The physically implementation we have done so far has been a single table. In Nordic, the persistent storage is vertically partitioned. This is not the case in our implementation.

Nordic Associations

We are now at slides #42 to #56 (inclusive).

This topic has been done to death in previous articles in this series.

Slides #54 and #55 are not clear without the narration. I will not comment further.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s