def solve_multype_room(self, entity): room = entity['room'][0] multype = entity['multype'][0] restype_search = Neo4jPrepare.get_reverse_relation(multype, '资源类型') restype_arr = [x['office_name'] for x in restype_search] ans = "\n" if len(restype_arr) > 0: ans += multype + "包括" else: return "很抱歉,没有" + multype + "的具体信息\n" for restype in restype_arr[:-1]: ans += restype + "," ans += restype_arr[-1] + "\n" #print("===",restype_arr) for restype in restype_arr: #print(restype) res = Neo4jPrepare.get_relation_mul(restype, '馆室') #print(res) room_arr = [r['office_name'] for r in res] #print(room_arr) if room in room_arr: ans += room + "存有" + restype return ans ans += multype + "不存放在" + room + "\n" return ans
def solve_restype_room(self, entity): room = entity['room'][0] restype = entity['restype'][0] res = Neo4jPrepare.get_relation_mul(restype, '馆室') ans = "\n" room_arr = [r['office_name'] for r in res] print(room_arr) if room in room_arr: ans += room + "存有" + restype ans += self.solve_count_res(entity) else: ans += restype + "不存放在" + room + "\n" + restype + "存放在" for r in room_arr[:-1]: ans += r + "," ans += room_arr[-1] + "\n" return ans