def retrieve_all_links_multpile_occ(self):
"""retrieves all xy coord for all links in wikipeida.
@return a list of coords holding the following keys:
'source_article_id': the wikipedia article id
'x': x position on screen
'y': y position on screen
"""
coords = []
try:
self._cursor.execute('SELECT source_article_id, target_article_id, target_x_coord_1920_1080, target_y_coord_1920_1080 FROM links where target_x_coord_1920_1080 is not Null and target_y_coord_1920_1080 is not Null and target_x_coord_1920_1080!=0 and target_y_coord_1920_1080!=0 and source_article_id!=target_article_id;')
result = self._cursor.fetchall()
for row in result:
link = {}
link['key']= row[0], row[1]
link['x'] = row[2]
link['y'] = row[3]
coords.append(link)
except MySQLdb.Error, e:
logging.error('error retrieving xy coord for all links links %s (%d)' % (e.args[1], e.args[0]))
return coords
评论列表
文章目录