Information Technology Reference
In-Depth Information
By following the algorithm delete, we can translate the SQL statement to the fol-
lowing OSQL statements by deleting the aggregate attribute of the composite ob-
jects that contain the to-be-deleted object, and also by deleting the set of OFFICE
that John Doe occupies, and then delete the to-be-deleted object with the aggregate
objects pointing to the composite objects as:
6(/(&7 3
GHSDUWPHQW
3
RIILFH
IURP 67$))ZKHUH 66
LQWR2,'
VWDII
83'$7('(3$570(17VHW3
VWDII
3
VWDII
2,'
VWDII
83'$7(2)),&(VHW3
RFFXSDQW
3
RFFXSDQW
^2,'
VWDII
`
'(/(7($//IURP3(5621ZKHUH66
Now, suppose John Doe actually wants to transfer from the CS department to the IS
department. The SQL for the update statement is:
UPDATE STAFF set dept-name = 'IS' where SS# = 452112345
By following the algorithm update, we can translate the SQL statement to sets of
OSQL statements as:
6(/(&73
RIILFH
IURP67$))ZKHUH66 LQWR2,'
VWDII
83'$7('(3$570(17VHW3
VWDII
3
VWDII
2,'
VWDII
ZKHUH'HS ´&6´
83'$7(2)),&(VHW3
VWDII
3
VWDII
^2,'
VWDII
`ZKHUH'HS ´&6´
83'$7('(3$570(17VHW3
VWDII
3
VWDII
2,'
VWDII
ZKHUH'HS ´,6´
83'$7(2)),&(VHW3
VWDII
3
VWDII
^2,'
VWDII
`ZKHUH'HS ´,6´
83'$7(67$))VHWGHSWQDPH µ,6¶ZKHUH66
5.11
Query Translation from SQL to XQL
An XML Query Language (XQL) is a query language for XML documents, and
can be implemented by XPath. The SQL allows data retrieval using table join and
data manipulation using methods. In query transformation, a syntax-directed parser
converts the SQL into multi-way trees. The transformation process is performed,
based on the subtree matching and replacement technique. The process of SQL
query transformation is given in Fig.
5.13
.
5.11.1
Translation of SQL Query to XPath Query
After the schema is done, SQL query can be translated to XPath query by the fol-
lowing steps:
1.
Decompose SQL query transaction
Search WWH ::
Custom Search