Rewriting queries using views is a powerful technique that has applications in query optimization, data integration, data warehousing etc. Query rewriting in relational databases is by now rather well investigated. However, in the framework of semistructured data the problem of rewriting has received much less attention. In this paper we focus on extracting as much information as possible from algebraic rewritings for the purpose of optimizing regular path queries. The cases when we can nd a complete exact rewriting of a query using a set a views are very \ideal." However, there is always information available in the views, even if this information is only partial. We introduce \lower" and \possibility" partial rewritings and provide algorithms for computing them. These rewritings are algebraic in their nature, i.e. we use only the algebraic view de nitions for computing the rewritings. This fact makes them a main memory product which can be used for reducing secondary ...