Today it is widely recognized that optimization based on rewriting leads to faster query execution. The role of a query rewrit-
ing grows significantly when a query defined in terms of some view is processed. Using views is a good idea for building flexible
virtual data integration systems with declarative query support. At present time such systems tend to be based on the XML
data model and use XML as the in- ternal data representation for processing query over heterogeneous data. Hence an elaborated
algorithm of query rewriting is of great importance for efficient processing of XML declarative queries. This paper describes
the query rewriting techniques for the XQuery language that is imple- mented as part of the BizQuery virtual data integration
system. The goals of XQuery rewriting are stated. Query rewriting rules for FLWR expressions and for recursive XQuery functions
are presented. Also the role of the XML schema in query rewriting is discussed.