Abstract : SPARQL query language plays a significant role in developing semantic web and web intelligence. In order to deal with large data query execution over RDF, SPARQL query optimizer is an essential component in the SPARQL query engine for improving query execution performance. This paper proposes an approach for performing query planning and optimization based on an extended query pattern graph and heuristics. First, this paper generalizes SPARQL query statement representation by taking other expressions into account, aiming at overcoming the limitations of only using basic query triple patterns. Second, this paper presents the heuristics for estimating the cost of executing query triple pattern. The proposed query planning methods are implemented within Corese query engine and are evaluated using BSBM benchmark. The results suggest that the proposed methods can optimize effectively the query execution time of SPARQL query engine.