1. A method for optimizing semantic web queries, the method comprising: receiving inputs, the inputs comprising: a semantic query over a resource description framework database, the semantic query comprising a plurality of hierarchically nested graph patterns, each graph pattern comprising at least one triple pattern comprising a subject, an object and predicate connecting the subject to the object; statistics describing data in the resource description framework database; and a plurality of access methods comprising alternative methods for evaluating each triple pattern; expressing the semantic query as a query parse tree comprising a plurality of nodes, the nodes comprising triple patterns from the query and logical relationships among the triple patterns; creating a data flow graph, the data flow graph comprising a plurality of triple pattern and access method pair nodes connected by a plurality of edges representing dependencies among execution of the triple patterns; determining an optimal flow tree through the data flow graph, the optimal flow comprising a set of triple pattern and access method pair nodes and edges such that all triple patterns in the semantic query are contained in the optimal flow tree; creating an execution tree independent of a structure of the resource description framework database, the execution tree comprising a sequence of evaluation of triple patterns in the optimal flow tree; transforming the execution tree into a query plan that exploits the structure of the resource description framework database; using the query plan to create a structured query language query; using the structured query language query to evaluate the semantic query over the resource description framework database.