def extract(self): # TODO : Should be an exporter plugin
graph = {
'meta': {}, # self.__meta,
'properties': {} # self.__properties
}
graph['nodes'] = list()
for v in self.__vertices.find().sort('id', pymongo.ASCENDING):
v.pop("_id") # Remove MongoDB document ID
graph['nodes'].append(v)
graph['edges'] = list()
for e in self.__edges.find().sort("src", pymongo.ASCENDING):
e.pop("_id") # Remove MongoDB document ID
graph['edges'].append(e)
graph['tokens'] = list();
for t in self.__tokens.find().sort('id', pymongo.ASCENDING):
t.pop("_id") # Remove MongoDB document ID
t['id'] = str(t['id'])
t['ts'] = time.mktime(t['ts'].timetuple())
graph['tokens'].append(t)
return graph
评论列表
文章目录