def solve_room_card_a(self, entity): room = entity['room'][0] room_name = room if room.find("_") != -1: room_name = room.split("_")[2] res = Neo4jPrepare.get_property(room) ans = "\n" if res['card'] != '': ans += "进" + room_name + "需要满足的条件为:\n" if res['card'].find(",") != -1: card_arr = res['card'].split(",") for c in card_arr: #print("==============================c",c) c_res = Neo4jPrepare.get_property(c) ans += "年龄" + c_res['age'] + "的读者可以持" + c_res[ 'office_name'] + "进入" + room_name + "\n" else: c_res = Neo4jPrepare.get_property(res['card']) ans += "年龄" + c_res['age'] + "的读者可以持" + c_res[ 'office_name'] + "进入" + room_name + "\n" else: ans += "进入该馆室无需证件\n" return ans
def solve_restype_describe(self, entity): restype = entity['restype'][0] res = Neo4jPrepare.get_reverse_relation(restype, '资源') res_arr = [] yes_room = [] no_room = [] describe = [] ans = "\n" for r in res: #print(r) sub_res = Neo4jPrepare.get_property(r['office_name']) res_arr.append(sub_res['office_name']) if sub_res['describe'] != '': yes_room.append(sub_res['office_name']) describe.append(sub_res['describe']) else: no_room.append(sub_res['office_name']) ans += restype + "包括" for r in res_arr[:-1]: ans += r + "," ans += res_arr[-1] #ans+=res_arr[-1]+"\n很抱歉,没有" for y in range(len(yes_room)): ans += yes_room[y] + ":" + describe[y] + "\n" return ans
def solve_res_time(self, entity): resource = entity['res'][0] #print(Neo4jPrepare.get_property(resource)) room = Neo4jPrepare.get_property(resource)['room'] res = Neo4jPrepare.get_property(room) workday_time = res['monday_borrow'] weekend_time = res['sunday_borrow'] if workday_time == '' and weekend_time == '': return "很抱歉," + room + "的资源材料不提供借阅\n" #ans = "\n" + resource + "的借阅时间为:\n工作日:" + workday_time + "\n周未:" + weekend_time + "\n" ans = "\n" + resource + "存放在" + room + "," ans += room + "的借阅时间为:" if workday_time != '': ans += "\n工作日:" + workday_time if weekend_time != '': ans += "\n周未:" + weekend_time return ans + "\n"
def solve_count_res(self, entity): resource = entity['res'][0] res = Neo4jPrepare.get_property(resource) ans = "\n" if res['count']!='': ans += resource+"的数量是:"+str(res['count'])+"本(份)\n" else: ans += "很抱歉,"+resource+"暂时没有数据信息\n" return ans
def solve_money_back_no(self): res = Neo4jPrepare.get_property('退押金') card = res['card'] card_arr = card.split(",") ans = "\n请到相应阅览室/服务点还清所借图书,确认无欠款后,持" for c in card_arr[:-1]: ans += c+"," ans += card_arr[len(card_arr)-1] ans += "到办证处办理退押金手续\n" return ans
def solve_room_phone(self, entity): room = entity['room'][0] room_name = room if room.find("_") != -1: room_name = room.split("_")[2] res = Neo4jPrepare.get_property(room) #print(res) ans = "\n" if res['phone'] != '': ans += room_name + "的联系电话为:" + res['phone'] + "\n" else: ans += "很抱歉," + room_name + "暂无联系电话\n" return ans
def solve_room_describe(self, entity): room = entity['room'][0] room_name = room if room.find("_") != -1: room_name = room.split("_")[2] res = Neo4jPrepare.get_property(room) #print(res) ans = "\n" if res['describe'] != '': ans += room_name + ":" + res['describe'] else: ans += "对不起,暂时没有" + room_name + "的描述信息\n" return ans
def solve_room_time(self, entity): room = entity['room'][0] res = Neo4jPrepare.get_property(room) #print(res) open_day = res['open_date'] ans = "\n" + room + "开放日为:" + open_day + "\n" workday_time = res['monday_open'] weekend_time = res['sunday_open'] if workday_time != '': ans += "工作日开放时间为:" + workday_time + "\n" if weekend_time != '': ans += "周末开放时间为:" + weekend_time + "\n" return ans
def solve_room_res_time(self, entity): room = entity['room'][0] #print(entity) res = Neo4jPrepare.get_property(room) #print("================================",res) workday_time = res['monday_borrow'] weekend_time = res['sunday_borrow'] if workday_time == '' and weekend_time == '': return "很抱歉," + room + "的资源材料不提供借阅\n" ans = "\n" + room + "的书籍材料借阅时间为:" if workday_time != '': ans += "\n工作日:" + workday_time if weekend_time != '': ans += "\n周未:" + weekend_time return ans + "\n"
def solve_service_describe(self, entity): service = entity['service'][0] #print(service) res = Neo4jPrepare.get_property(service) #print(res.keys()) ans = '' if res['discribe'] != '': ans = "\n" + service + "指" + res['discribe'] else: room_res = Neo4jPrepare.get_relation(service, '馆室') for r in room_res: if r['describe'] != '': ans += "\n" + r['office_name'] + r['describe'] if ans == '': ans = "很抱歉,暂时没有" + service + "的描述信息\n" return ans
def solve_room_borrow(self,entity): room = entity['room'][0] room_name = room if room.find("_")!=-1: room_name=room.split("_")[2] ans = "\n" res = Neo4jPrepare.get_property(room) if res['borrow'] == 1: ans+=room_name+"的资源书籍均可以外借\n" elif res['borrow'] == 2: ans += room_name + "的资源书籍均不允许外借,但可以复制与扫描\n" else: ans += room_name + "的资源书籍均不可以外借,仅供借阅\n" return ans
def solve_res_describe(self, entity): ans = "\n" for resource in entity['res']: #resource = entity['res'][0] res = Neo4jPrepare.get_property(resource) if res['ctime'] != '': ans += "国家图书馆的" + resource + "始藏于" + str(int( res['ctime'])) + "年\n" if res['describe'] != '': ans += res['describe'] + "\n" if res['belong'] != '': ans += resource + "属于" + res['belong'] if res['range'] != '': ans += ",图书馆收藏" + resource + "包括:" + res['range'] if res['topic'] != '': ans += "\n涵盖的主题包括" + res['topic'] + "\n" if ans == "": ans += "对不起,暂时没有" + resource + "的描述信息\n" return ans
def solve_finance_describe(self): res = Neo4jPrepare.get_property('国家图书馆读者卡') ans = '\n' + '读者卡的金融功能指读者卡' + res['function'] + '的功能\n' return ans
def solve_res_res_t(self, entity): restype = entity['restype'][0] res = Neo4jPrepare.get_property(restype) ans = "\n"+restype+"属于"+res['belong'] return ans