예제 #1
0
 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['work_borrow']
     weekend_time = res['week_borrow']
     if workday_time == 'nan' and weekend_time == 'nan':
         return "很抱歉," + room + "的资源材料不提供借阅\n"
     # ans = "\n" + resource + "的借阅时间为:\n工作日:" + workday_time + "\n周未:" + weekend_time + "\n"
     ans = "\n" + resource + "存放在" + room + ","
     ans += room + "的借阅时间为:"
     if workday_time != 'nan':
         ans += "\n工作日:" + workday_time
     if weekend_time != 'nan':
         ans += "\n周未:" + weekend_time
     return ans + "\n"
예제 #2
0
 def solve_res_form(self, entity):
     resource = entity['res'][0]
     res = Neo4jPrepare.get_property(resource)
     ans = "\n"
     if res['form'] != 'nan':
         ans += " 图书馆收藏的" + resource + "包括" + res['form'] + "\n"
     else:
         ans += "很抱歉,暂时没有" + resource + "的形式信息\n"
     return ans
예제 #3
0
 def solve_room_phone(self, entity):
     room = entity['room'][0]
     res = Neo4jPrepare.get_property(room)
     ans = "\n"
     if res['phone'] != 'nan':
         ans += room + "的联系电话为:" + res['phone'] + "\n"
     else:
         ans += "很抱歉," + room + "暂无联系电话\n"
     return ans
예제 #4
0
 def solve_res_topic(self, entity):
     resource = entity['res'][0]
     res = Neo4jPrepare.get_property(resource)
     ans = "\n"
     if res['topic'] != 'nan':
         ans += resource + "涵盖的主题包括" + res['form'] + "\n"
     else:
         ans += "很抱歉,暂时没有" + resource + "的主题信息\n"
     return ans
예제 #5
0
 def solve_money_back_no(self):
     res = Neo4jPrepare.get_property('退押金')
     card = res['card']
     card_arr = card.split(u",")
     ans = "\n请到相应阅览室/服务点还清所借图书,确认无欠款后,持"
     for c in card_arr[:-1]:
         ans += c+","
     ans += card_arr[len(card_arr)-1]
     ans += "到办证处办理退押金手续\n"
     return ans
예제 #6
0
 def solve_room_card_a(self, entity):
     room = entity['room'][0]
     res = Neo4jPrepare.get_property(room)
     ans = "\n"
     if res['card'] != '':
         ans += "进" + room + "需要满足的条件为:\n"
         if res['card'].find(u",") != -1:
             card_arr = res['card'].split(",")
             for card in card_arr:
                 card_res = Neo4jPrepare.get_property(card)
                 ans += "年龄" + card_res['age'] + "的读者可以持" + card_res[
                     'office_name'] + "进入" + room + "\n"
         else:
             card_res = Neo4jPrepare.get_property(res['card'])
             ans += "年龄" + card_res['age'] + "的读者可以持" + card_res[
                 'office_name'] + "进入" + room + "\n"
     else:
         ans += "进入该馆室无需证件\n"
     return ans
예제 #7
0
    def solve_room_describe(self, entity):
        room = entity['room'][0]
        res = Neo4jPrepare.get_property(room)
        ans = "\n"
        if res['describe'] != 'nan':
            ans += room + ":" + res['describe']
        else:
            ans += "对不起,暂时没有" + room + "的描述信息\n"

        return ans
예제 #8
0
 def solve_service_time(self, entity):
     service = entity['service'][0]
     res = Neo4jPrepare.get_property(service)
     ans = "\n"
     if res['date'] != 'nan':
         ans += "服务日期:" + res['date'] + "\n"
     if res['worktime'] != 'nan':
         ans += "工作日服务时间为" + str(res['worktime']) + "\n"
     if res['weektime'] != 'nan':
         ans += "工作日服务时间为" + str(res['weektime']) + "\n"
     return ans
예제 #9
0
    def solve_count_restype(self, entity):
        restype = entity['restype'][0]
        #res = Neo4jPrepare.get_property(restype)
        ans = "\n"
        type = Neo4jPrepare.get_property(restype)

        if type['count'] != 'nan':
            ans += restype + "的数量是:" + str(int(float(
                type['count']))) + "本(份)\n"
        else:
            ans += "很抱歉," + restype + "暂时没有数据信息\n"
        return ans
예제 #10
0
 def solve_area_time(self, entity):
     area = entity['area'][0]
     res = Neo4jPrepare.get_property(area)
     # print(res)
     ans = "\n"
     if res['date'] != 'nan':
         ans += area + "开放日期为" + res['date'] + "\n"
     if res['worktime'] != 'nan':
         ans += "工作日开放时间为" + res['worktime'] + "\n"
     if res['weektime'] != 'nan':
         ans += "周末开放是时间为" + res['weektime'] + "\n"
     return ans
예제 #11
0
    def solve_restype_describe(self, entity):

        restype = entity['restype'][0]

        restype_search = Neo4jPrepare.get_property(restype)

        res = Neo4jPrepare.get_reverse_relation(restype, '资源')
        res_arr = []
        yes_res = []
        no_res = []
        describe = []
        ans = "\n"

        if restype_search['count'] != 'nan':
            ans += restype + "在国家图书馆的馆藏数量为:" + restype_search['count'] + "\n"
        if restype_search['describe'] != 'nan':
            ans += restype_search['describe'] + "\n"
            return ans
        for r in res:
            sub_res = Neo4jPrepare.get_property(r['office_name'])

            res_arr.append(sub_res['office_name'])

            if sub_res['describe'] != 'nan':

                yes_res.append(sub_res['office_name'])
                describe.append(sub_res['describe'])

            else:
                no_res.append(sub_res['office_name'])
        if len(res) > 0:
            ans += restype + "包括"
            for r in res_arr[:-1]:
                ans += r + ","
            ans += res_arr[-1]
            for y in range(len(yes_res)):
                ans += yes_res[y] + ":" + describe[y] + "\n"
        return ans
예제 #12
0
 def solve_room_res_time(self, entity):
     room = entity['room'][0]
     # print(entity)
     res = Neo4jPrepare.get_property(room)
     # print("================================",res)
     workday_time = res['work_borrow']
     weekend_time = res['week_borrow']
     if workday_time == 'nan' and weekend_time == 'nan':
         return "很抱歉," + room + "的资源材料不提供借阅\n"
     ans = "\n" + room + "的书籍材料借阅时间为:"
     if workday_time != 'nan':
         ans += "\n工作日:" + workday_time
     if weekend_time != 'nan':
         ans += "\n周未:" + weekend_time
     return ans + "\n"
예제 #13
0
 def solve_task_describe(self, entity):
     task = entity['task'][0]
     #print(service)
     res = Neo4jPrepare.get_property(task)
     #print(res.keys())
     ans = ''
     if res['discribe'] != 'nan':
         ans = "\n" + task + "指" + res['discribe']
     else:
         room_res = Neo4jPrepare.get_relation(task, '馆室')
         for r in room_res:
             if r['describe'] != 'nan':
                 ans += "\n" + r['office_name'] + r['describe']
     if ans == '':
         ans = "很抱歉,暂时没有" + task + "的描述信息\n"
     return ans
예제 #14
0
    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
예제 #15
0
    def solve_count_res(self, entity):
        resource = entity['res'][0]
        res = Neo4jPrepare.get_property(resource)
        ans = "\n" + resource + "存放在"
        room = Neo4jPrepare.get_relation(resource, '馆室')
        room_arr = [x['office_name'] for x in room]
        #print(room)

        for room_name in room_arr[:-1]:
            ans += room_name + ","
        ans += room_arr[-1] + "\n"

        if res['count'] != 'nan':
            ans += resource + "的数量是:" + str(res['count']) + "本(份)\n"
        else:
            ans += "很抱歉," + resource + "暂时没有数据信息\n"
        return ans
예제 #16
0
    def solve_room_time(self, entity):
        room = entity['room'][0]
        res = Neo4jPrepare.get_property(room)
        # print(res)
        open_day = res['open_date']
        ans = "\n"
        if open_day != 'nan':
            ans += room + "开放日为:" + open_day + "\n"
        workday_time = res['work_open']
        weekend_time = res['week_open']
        if workday_time != 'nan':
            ans += "工作日开放时间为:" + workday_time + "\n"
        if weekend_time != 'nan':
            ans += "周末开放时间为:" + weekend_time + "\n"
        if ans == "\n":
            ans += "很抱歉,没有" + room + "的时间信息\n"

        return ans
예제 #17
0
    def solve_res_describe(self, entity):
        ans = "\n"
        for resource in entity['res']:

            res = Neo4jPrepare.get_property(resource)
            if res['collection_time'] != 'nan':
                ans += "国家图书馆的" + resource + "始藏于" + str(
                    int(float(res['collection_time']))) + "年\n"
            if res['describe'] != 'nan':
                ans += res['describe'] + "\n"
            if res['belong'] != 'nan':
                ans += resource + "属于" + res['belong']
            if res['form'] != 'nan':
                ans += ",图书馆收藏" + resource + "包括:" + res['form']
            if res['topic'] != 'nan':
                ans += "\n涵盖的主题包括" + res['topic'] + "\n"
            if ans == "":
                ans += "对不起,暂时没有" + resource + "的描述信息\n"
        return ans
예제 #18
0
 def solve_task_time(self, entity):
     task = entity['task'][0]
     res = Neo4jPrepare.get_property(task)
     ans = "\n"
     if res['date'] != 'nan':
         ans += "业务日期:" + res['date'] + "\n"
     if res['worktime'] != 'nan':
         ans += "工作日服务时间为" + str(res['worktime']) + "\n"
     if res['weektime'] != 'nan':
         ans += "工作日服务时间为" + str(res['weektime']) + "\n"
     if ans == "\n":
         res_room = Neo4jPrepare.get_relation(task, "馆室")
         for room in res_room:
             if room['open_date'] != 'nan':
                 ans += room['office_name'] + "的开放日为" + room['open_date']
             if room['work_open'] != 'nan':
                 ans += ",工作日开放时间为" + room['work_open']
             if room['week_open'] != 'nan':
                 ans += ",周末或节假日开放时间为" + room['week_open'] + "\n"
     return ans
예제 #19
0
 def solve_res_res_t(self, entity):
     restype = entity['restype'][0]
     res = Neo4jPrepare.get_property(restype)
     ans = "\n" + restype + "属于" + res['belong']
     return ans
예제 #20
0
 def solve_library_phone(self):
     res = Neo4jPrepare.get_property("国家图书馆")
     #print(res)
     ans = "\n国家图书馆联系电话为" + res['phone'] + "\n"
     return ans
예제 #21
0
 def solve_area_pos(self, entity):
     area = entity['area'][0]
     res = Neo4jPrepare.get_property(area)
     ans = "\n" + area + "位于" + res['position'] + "\n"
     return ans
예제 #22
0
 def solve_finance_describe(self):
     res = Neo4jPrepare.get_property('国家图书馆读者卡')
     ans = '\n' + '读者卡的金融功能指读者卡' + res['function'] + '的功能\n'
     return ans