Background • Object-oriented software, based on the principles of user-defined datatypes, along with inheritance and polymorphism, is firmly established in the software industry (consider C++, Java, Visual Basic, C#, etc.) • However, the popularity of OO software has no relation with the popularity, or not, of OODBMS.
Background • The debate between relational versus oo within the DB community parallels the debate between vector and raster in the GIS community during the 70’s and 80’s. • Market adoption of OODBMS has been limited. This has implications: • Reduced financial and engineering resources to performance-tune products. • SQL has retained its dominance as the lingua franca of the database world.
Background • Relational databases that incorporate ADTs and other principles of oo design are called object relational DBS (OR-DBMS). • These databases have taken the steam out of the OO engine, and appear to have the upper hand in ‘modern’ DMBS.
Background • Recall that RDBMS represents themes through relations (tables). • A geographic object is one tuple (row) of such a relation. • Each column is an attribute. • Attributes have alphanumeric types (e.g., character, string, time, date, real, logical). BLOBS are a recent addition. • Relationships are not explicit, but implied by values in specific fields (e.g., foreign keys).
RDBMS? • To incorporate spatial concepts into a RDBMS requires considerable re-organization of the RDBMS database structure, which violates the data independence principle (you need to know far more about a theme in order to determine what type of spatial entity it is, and what type of operations are permissible).
RDBMS • Performance suffers greatly as a result of the significant modifications required to incorporate space. • Topology is not implicit. • As a result, most systems were based on a loose coupling approach (e.g., Arc / Info).
OO DBMS • OO systems were first developed in the 1980s, when oo programming languages such as Simula and Smalltalk first emerged. • The initial reaction was that, within a few years, all databases would be oo databases. Such predictions were obviously way off the mark.
OO Advantages • OO principles brought to databases: • New modeling power • Extensibility of systems • Code reuse • Easy maintenance of programs • However, it is only recently that OO programming has itself really taken off.
OODBMS Terminology • Object Identity: An object is denoted in a unique way in the database system, using an identifier or OID (object identifier) that the objects keeps during its entire lifetime, independently of its attribute values.
OODBMS Terminology • Type: the type of an object corresponds to its structure and to the operations that can be performed on it. • Atomic types, such as strings and integer • Complex types are defined using ‘constructors’ (tuples or set constructors). • An object (o) can have as an atomic value not only a string or real but also the OID of another object o’. Object o is said to consist of object o’
OODBMS Terminology • Objects with the same type are grouped into classes. • Classes encompass objects having the same structure and behaviour, which is expressed by the set of methods or operations applicable to the objects they contain.
Encapsulation: A class corresponds to the implementation of an abstract data type (ADT). • Encapsulation means that neither the structure of the ADT nor its implementation is visible from the outside world. • Programmers will know how the ADT is implemented, whereas end users only know the specification.
OODBMS Terminology • ADTs: Abstract data types – combinations of data types (e.g., polygon) and their operations (e.g., PolygonArea [an operation that would compute the area of a polygon]). Note that the DBMS need not have any knowledge on the ADT implementation (i.e., the code corresponding to the operations). • ADTs are encapsulated in the sense that they are accessible only through the operations that are defined on them.
ADTs have been ‘regularized’ in the sense that the geographic dimension (e.g., points, line segments [nodes only have two arcs], complex polylines [nodes can have two or more connected arcs], polygons) is used to clearly distinguish between them.
OODBMS Terminology • Inheritance: Subclasses are defined from an existing superclass with a refinement of its structure. • Subclasses inherit methods and structures from the superclass (e.g., all methods defined for the superclass can be used in the subclass). • However, a subclass can redefine a method defined in the superclass. • A subclass can also have methods defined only for that subclass. This leads to polymorphism. • The subclass is a specialization of the superclass, and the superclass is a generalization of the subclass. • A subclass can inherit from many superclasses.
Most OO DBMS use OQL rather than SQL as their query language. • OQL is aware of the complex structures present in the OODBMS, and can return complex results. • SQL is used as the DDL, DQL and DML (data definition, data query, and data manipulation language). • In OODBMS, the primary means of developing the database is through the native OO language.
OR DBMS • PostgresSQL is the best known OR DBMS • It allows the user to extend the system by incorporating new data types—a user can integrate geometric types and operations, as well as spatial indexing. • ORDBMS incorporate ADTs, but still use tables. • OR SQL contains extensions to standard SQL than enable access to ADTs.