Exemplo n.º 1
0
def get_organization():  #机构属性页面

    user_id = request.args.get('user_id', '')

    ### 机构属性查询函数
    if user_id:
        result_att = search_org_by_id(user_id)
    else:
        result_att = {}

    ### 获取相关wiki
    try:
        if result_att['uname']:  #name不为空
            wiki_list = getUrlByKeyWord(result_att['uname'])
        else:
            wiki_list = []
    except KeyError:
        wiki_list = []

    ### 获取关联实体
    if user_id:
        relation_dict = search_neo4j_by_uid(user_id, org_index_name,
                                            org_primary)
    else:
        relation_dict = {'people': [], 'org': [], 'event': []}

    relation_dict['wiki'] = wiki_list[0:10]

    return render_template('index/organization.html',
                           result_att=result_att,
                           relation_dict=relation_dict)
Exemplo n.º 2
0
def get_organization():  #机构属性页面

    user_id = request.args.get('user_id', '')
    user_name = g.user.email
    ### 机构属性查询函数
    if user_id:
        result_att = search_org_by_id(user_id, user_name)
        doc_list = search_related_docs(user_id, es_related_docs,
                                       user_docs_name, user_docs_type)  #查找关联文档
        inter_list = get_interaction(user_id)  #查找人物交互情况
        friends_dict = search_bci(user_id)  #查找人物的影响力信息
        text_list = get_people_weibo(user_id)  #查找人物的微博文本
    else:
        result_att = {}
        doc_list = []
        inter_list = {
            'retweet': [],
            'beretweet': [],
            'comment': [],
            'becomment': []
        }
        friends_dict = {'fansnum': '', 'statusnum': '', 'friendnum': ''}
        text_list = []

    ### 获取相关wiki
    try:
        if result_att['uname']:  #name不为空
            wiki_list = getUrlByKeyWord(result_att['uname'])
        else:
            wiki_list = []
    except KeyError:
        wiki_list = []

    ### 获取关联实体
    if user_id:
        relation_dict = search_neo4j_by_uid(user_id, org_index_name,
                                            org_primary)
    else:
        relation_dict = {'people': [], 'org': [], 'event': []}

    relation_dict['wiki'] = wiki_list[0:10]
    relation_dict['doc'] = doc_list[0:10]

    return render_template('index/organization.html',
                           result_att=result_att,
                           inter_list=inter_list,
                           friends_dict=friends_dict,
                           text_list=text_list,
                           relation_dict=relation_dict)
Exemplo n.º 3
0
def wikitest():
    key = "特朗普"
    wiki_list = getUrlByKeyWord(key)
    return json.dumps(wiki_list)