code: def transform_sparql_construct(rdf, construct_query):
      
  
      logging.debug("performing SPARQL CONSTRUCT transformation")
  
      if construct_query[0] == '@':  # actual query should be read from file
          construct_query = file(construct_query[1:]).read()
  
      logging.debug("CONSTRUCT query: %s", construct_query)
  
      newgraph = Graph()
      for triple in rdf.query(construct_query):
          newgraph.add(triple)
  
      return newgraph
docs: Perform a SPARQL CONSTRUCT query on the RDF data and return a new graph.