Queries in an OPM-based multidatabase system are expressed in the OPM multidatabase query language (OPM*QL) [8]. OPM*QL extends the single-database OPM query language, OPM-QL, with constructs needed for querying multiple databases. These extensions include the ability to query multiple classes, possibly from distinct databases; constructs that allow navigation between the classes of multiple databases following inter-database links; and the ability to rename fields of a query in order to resolve potential naming conflicts between multiple databases.
An example of a simple OPM*QL query over databases GSDB and GDB is:
SELECT Name = GSDB:Gene.name, Annotation = GDB:Gene.annotation
FROM GSDB:Gene, GDB:Gene
WHERE GDB:Gene.accessionID = GSDB:Gene.gdb_xref AND GSDB:Gene.name = "ACHE" ;
In the query above, the term `` GSDB:Gene'' refers to class Gene of database schema GSDB (which must be recorded in the MBD directory) while term `` GSDB:Gene.name'' refers to attribute name of class Gene. If a class name is unique among all the classes listed in the multidatabase directory, the database name can be omitted from a term, for example `` Gene'' could be used instead of `` GSDB:Gene''.
The WHERE statement consists of and-or compositions of atomic comparisons. Conditions can involve multiple classes, possibly from different databases.
Processing OPM multidatabase queries involves generating OPM-QL queries over individual databases in the multidatabase system, and combining the results of these queries using a local query processor. The stages of generating OPM-QL queries and manipulating data locally may be interleaved depending on the particular query evaluation strategy being pursued.