Chemistry Reference
In-Depth Information
This defines the SQL function oe _ smiles , which is realized by calling
the C function oe _ anysmiles in the shared object file gnova.so . The
definition of the input arguments and return values is done in the same
way as for a function written in any other procedural language.
There is an open-source extension of PostgreSQL called pgchem. 7 It
uses C functions and OpenBabel. It implements some of the core functions
described in Chapter 7. The names of the functions are not the same as the
names used here. Using pgchem, it should be possible to perform most of
the operations represented by the core functions described in this topic.
The Appendix contains a simple C language function to return the
number of bits set in a bit data type. The PostgreSQL Web site documenta-
tion contains examples of C language functions.
10.6 Object RDBMS
PostgreSQL is generally referred to as an Object Relational Database
Management System (ORDBMS). The use of the word object implies objects
in the sense of an object-oriented computer language. While not intended
to be fully object-oriented in the same sense as a computer language, an
ORDBMS shares the essential aspects of objects. These include composite
data types, methods (functions), and inheritance.
This chapter has shown how composite data types can be of great use
in chemical databases. The components of a composite data type are either
basic SQL data types, or other composite data types. This is the same way
an object is defined in an object-oriented computer language. This level of
abstraction can help simplify the development of complex databases.
Another important aspect of objects is the methods that operate on
them. An ORDBMS calls these functions, but the effect is the same. As
shown in this chapter, the functions defined for new data types enable
them to be integrated in the SQL language and handled just like standard
SQL data types. This can be by casting the data type, for example, to allow
range data to be treated as float . New functions that operate exclusively
on range data can be defined, such as range _ cmp . The ability to define
operators of new data types enhances their usability and integration into
SQL even more.
An ORDBMS is a kind of hybrid of a traditional RDBMS and a fully
object-oriented OODBMS. The range of types of DBMS and their advan-
tages and disadvantages is discussed elsewhere. 8-10
References
1. Plpgsql. 2008. http://www.postgresql.org/docs/8.2/static/plpgsql.html
(accessed April 18, 2008).
2. Stones R. and Matthew, N. 2005. Beginning databases with PostgreSQL .
Berkeley: Apress.
Search WWH ::




Custom Search