def do_query(self, query): """ Renders the results page """ q = Querier() results = None try: # extracts only the bindings from the result dictionary bindings = [r['results']['bindings'] for r in q.query(str(query)) if r['results']['bindings'] != []] results = self.unpack_results(bindings) except: # in case of any exception should render an error page results = "ERROR" return self.serve_template('results.txt', results=results)
def do_query(self, query): """ Renders the results page """ q = Querier() results = None try: # extracts only the bindings from the result dictionary bindings = [ r['results']['bindings'] for r in q.query(str(query)) if r['results']['bindings'] != [] ] results = self.unpack_results(bindings) except: # in case of any exception should render an error page results = "ERROR" return self.serve_template('results.txt', results=results)
# resultQuery3 = localQuerier.query(prefix+query3) # csvFile3 = open("csvFile3.csv", 'w') # csvFile3.write(resultQuery3) # print "[Running Time] %s sec" % (time.time() - start_time) # resultQuery4 = localQuerier.query(prefix+query4) # csvFile4 = open("csvFile4.csv", 'w') # csvFile4.write(resultQuery4) # print "[Running Time] %s sec" % (time.time() - start_time) # resultQuery5 = localQuerier.query(prefix+query5) # csvFile5 = open("csvFile5.csv", 'w') # csvFile5.write(resultQuery5) # print "[Running Time] %s sec" % (time.time() - start_time) resultQuery6 = localQuerier.query(prefix + query6) csvFile6 = open("csvFile6.csv", 'w') csvFile6.write(resultQuery6) print "[Running Time] %s sec" % (time.time() - start_time) resultQuery7 = localQuerier.query(prefix + query7) csvFile7 = open("csvFile7.csv", 'w') csvFile7.write(resultQuery7) print "[Running Time] %s sec" % (time.time() - start_time) # with open('csvFile1.csv') as csvFile1: # reader1 = csv.DictReader(csvFile1) # with open('csvFile2.csv') as csvFile2: # reader2 = csv.DictReader(csvFile2) # with open('csvFile3.csv') as csvFile3: # reader3 = csv.DictReader(csvFile3)