1. A method for optimizing queries over a vertically stored database having items that are partitioned into several partitions each having a partition signature representing items therein, the method comprising: decomposing a first query received from a user into multiple first subqueries; generating a signature for each first subquery in a way corresponding to a way of generating the partition signature; comparing the signature of the each first subquery with the partition signatures of all partitions, in order to obtain all partitions matching the first subquery; rewriting a second subquery translated from the first subquery based on the matching partitions, in order to obtain the rewritten second subquery; and composing rewritten second subqueries for all the first subqueries to form a second query so that queries are executed over the database using the second query; wherein the database is an resource description framework (RDF) store in which each item contains RDF triples, the RDF store contains a subject column whose value represents RDF triple subjects, a property column whose value represents RDF triple properties, and an object column whose value represents RDF triple objects, and the RDF store further contains a unique identifier column whose value represents partitions where corresponding RDF triples are located.