An OPM multidatabase query is first partitioned into several single class OPM_QL queries. Conditions in a multidatabase query involving only a single class are generally incorporated in the component OPM_QL query for that class, while conditions involving multiple classes, possibly from different databases, are evaluated by the OPM*QL processor.
An OPM multidatabase query is processed as follows.
is generated:
SELECT
FROM C WHERE Conds
;
where
consists of each attribute path Y such that
DB:C.Y occurs either in S or in Cond.
consists of those conditions in Conds
involving only constant terms and terms of the form DB:C.Y for
some attribute path Y: that is Conds
does not involve any
references to other classes DB
:C
where
or
.
The query
is formed by first filtering the abstact syntax tree for the
multidatabase query to remove any parts involving classes other than DB:C,
and then translating the query back into OPM_QL, replacing any terms of the form
DB:C.Y with the attribute path Y.
If Conds
is empty then the WHERE keyword is omitted.
is submitted to the database DB, and the resulting
set of tuples,
, is converted into the internal representation of the multidatabase
query engine.
is formed, consisting of those conditions in
Conds involving multiple distinct classes. The values
are then
searched for sets of tuples satisfying the conditions, Conds
, and suitable
sets of tuples are then projected, renamed and combined in accordance with the
select statement S.
Example.Consider the following query expressed over the HGD (GDB) and GSDB databases:
SELECT Name = GSDB:Gene.name, Reason = HGD:Gene.reason,
Annotation = HGD:Gene.annotation
FROM GSDB:Gene, HGD:Gene
WHERE HGD:Gene.accessionID = GSDB:Gene.gdb_xref
AND GSDB:Gene.name = "ACHE" ;
First, the following two OPM_QL queries are generated:
Query
:
SELECT name, gdb_xref
FROM Gene
WHERE name = "ACHE";
Query
:
SELECT reason, annotation, accessionID
FROM Gene;
For each object instance x returned by
,
and each object instance y returned by
,
if accessionID of y is identical to
gdb_xref of x, then return:
Name = x. name, Reason = y. reason,
Annotation = y. annotation.