Geog 495: GIS Database Design
10/5/05
Object-oriented database model
Let’s familiarize yourself with OO terms
OODM sees the world as the collection of “autonomous” objects
Object: represents a real-world entity that has a unique identity (OID), embedded properties (instance variables), and the ability to interact with other objects and act upon itself (methods);
Q. Can you tell the difference between entity (in relational db model) and object?
OID: object’s identity is represented by an object ID (OID), unlike relational data model it’s created by system
Instance variables: other name of attributes; unlike relational data model, abstract data type (ADT) is allowed (e.g. collection object, image, media, spatial) à describes object state (attribute value)
cf. domain: specifies possible range of values
Methods: the code that performs a specific operation on the object’s data
Data and method is interrelated
Method uses the value from instance variables and returns the result
Cf. methods can be invoked by a message
Class: a collection of similar objects with shared attributes and behavior
In summary,
Compare the OO and ER components
OO Data model |
ER Model |
|
Entity |
|
Entity set |
|
Attribute |
|
Primary key |
|
ER diagram |
Method |
|
OID |
|
OO Concepts
Inheritance: from class hierarchy, some shared properties inherit from superclass; in OOP, this allows for modularity (or code reusability)
Encapsulation: methods can be defined either public or private. Some important properties of objects should be hidden, then define this as private. It allows for protecting data from unauthorized access by other objects; ensures the integrity of the object’s state
Polymorphism: you can use method inherited from superclass. But if you define the same method in the subclass (e.g. salary calculation for pilot is not the same as the one for other employees), the method will override the method in the superclass. In other words, methods can be computed depending on the characteristics of object (e.g., where you’re pilot or not)