q = [{'type': t, 'mid': None, 'name': None, '/common/topic/alias': [],
    'limit': 500}]
for r in freebase.mqlreaditer(q):
    print('\t'.join([t, r['mid'], r['name']] + r['/common/topic/alias']))
f.close()
How to use Freebase to label a very large unlabeled NLP dataset?