Information Technology Reference
In-Depth Information
SELECT {attribute-list-1} FROM {R 1 ,R 2 ,……R n }
WHERE {join-condition} AND/OR {search-condition-1}
ORDER BY {attribute-list-2} GROUP BY {attribute-list-2} HAVING
{search-condition-2}
Step 2. Create the query graph of SQL through input relations join path
Based on the input relations, a join graph can be created to indicate the join con-
dition from one relation to another. The join condition can be based on the natural
join, i.e., the value match of common attributes of the input relations, or, based on
the search condition specified in the SQL statement. The join path can be described
as:
J
1 , J 2 ….. J n
R 1 R 2 …… R n where
J
J
J
1
2
n
Step 3. Map the SQL query graph to OSQL query graph
We can map each relation to a corresponding class from the pre-process. The first
relation in the join graph (in step 2) can be mapped to an anchor class. We can then
form a class navigation path to follow from the anchor class to its associated class,
and so on until all the mapped classes are linked. The class navigation graph is the
mapped OSQL QG as shown below:
C anchor C 2 .. C n where P 1 , P 2 .. P n are aggregate attributes of class
P 1
P 2
P n
C anchor ,C 2 ..C n
For example, Fig. 5.12 shows how a SQL QG among three relations' join QG is
mapped into an OSQL QG among two classes associated by the Stored OID of class
Student addressing to the OID of class Course. Note that QGs are in the direction
of the arrows.
Step 4. Transform SQL to OSQL query transaction
From the QG of SQL, a corresponding OSQL transaction can be constructed by
• replacingthetargetattributeofrelationsbythetargetattributeofclassesinnavi-
gation path
• replacingtheinputrelationsintheFROMclausebytheanchorclass
The translated OSQL statement can be described as:
SELECT {attributes in classes navigation path into OID} FROM {C anchor }
WHERE {transformation of join-condition} AND/OR {transformation of
search-condition-1}
ORDER
BY
{transformation
of
attribute-list-2}
GROUP
BY
{transformation of attribute-list-2}
HAVING {transformation of search-condition-2}
Search WWH ::




Custom Search