Luận văn thạc sĩ ứng dụng công nghệ web ngữ nghĩa và openstreetmap phát triển ứng dụng hỗ trợ tìm kiếm thông tin về bệnh nhân covid 19

79 10 0
Luận văn thạc sĩ ứng dụng công nghệ web ngữ nghĩa và openstreetmap phát triển ứng dụng hỗ trợ tìm kiếm thông tin về bệnh nhân covid 19

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

HỌC VIỆN CƠNG NGHỆ BƯU CHÍNH VIỄN THƠNG - Phan Hồng Dương ỨNG DỤNG CÔNG NGHỆ WEB NGỮ NGHĨA VÀ OPENSTREETMAP PHÁT TRIỂN ỨNG DỤNG HỖ TRỢ TÌM KIẾM THƠNG TIN NGƯỜI BỆNH COVID-19 LUẬN VĂN THẠC SĨ KỸ THUẬT (Theo định hướng ứng dụng) HÀ NỘI - 2021 e HỌC VIỆN CƠNG NGHỆ BƯU CHÍNH VIỄN THƠNG - Phan Hồng Dương ỨNG DỤNG CÔNG NGHỆ WEB NGỮ NGHĨA VÀ OPENSTREETMAP PHÁT TRIỂN ỨNG DỤNG HỖ TRỢ TÌM KIẾM THƠNG TIN NGƯỜI BỆNH COVID-19 CHUYÊN NGÀNH : HỆ THỐNG THÔNG TIN MÃ SỐ : 8.48.01.04 LUẬN VĂN THẠC SĨ KỸ THUẬT (Theo định hướng ứng dụng) NGƯỜI HƯỚNG DẪN KHOA HỌC: PGS.TS HOÀNG HỮU HẠNH HÀ NỘI - 2021 e i LỜI CAM ĐOAN Tôi Phan Hồng Dương, học viên lớp M19CQIS02-B xin cam đoan báo cáo luận văn viết hướng dẫn thầy PGS TS Hoàng Hữu Hạnh Trong toàn nội dung luận văn, điều trình bày kết cá nhân kế thừa, tổng hợp từ nhiều nguồn tài liệu khác liệt kê danh mục tài liệu tham khảo rõ ràng Hà Nội, ngày 03 tháng 03 năm 2021 Học viên thực Phan Hồng Dương e ii LỜI CẢM ƠN Lời đầu tiên, xin bày tỏ cảm ơn chân thành thầy giáo PGS.TS Hoàng Hữu Hạnh - Giáo viên hướng dẫn trực tiếp Thầy giúp tiếp cận kiến thức công nghệ Web ngữ nghĩa đồ giới mở OpenStreetMap suốt trình nghiên cứu hồn thiện luận văn thạc sĩ Tơi xin gửi lời cảm ơn tới các thầy, cô khoa Công nghệ thơng tin trường Học viện Cơng nghệ Bưu Viễn thông với quan tâm, dạy dỗ, bảo tận tình chu đáo thầy, cơ, đến tơi hồn thành luận văn Đặc biệt, để hồn thành luận văn này, nhận giúp đỡ từ quan, gia đình, bạn bè Tơi xin chân thành cảm ơn tất hỗ trợ động viên tạo điều kiện thuận lợi cho Tôi xin chân thành cảm ơn! Hà Nội, ngày 06 tháng 03 năm 2021 Học viên thực luận văn kỹ thuật Phan Hồng Dương e iii MỤC LỤC LỜI CAM ĐOAN i LỜI CẢM ƠN ii DANH MỤC CÁC THUẬT NGỮ VÀ CHỮ VIẾT TẮT vi DANH MỤC CÁC HÌNH VẼ VÀ ĐỒ THỊ vii MỞ ĐẦU CHƯƠNG 1: KIẾN THỨC CƠ SỞ 1.1 Web ngữ nghĩa 1.1.1 Khái niệm Web ngữ nghĩa .3 1.1.2 Kiến trúc Web ngữ nghĩa 1.2 RDF, RDFS 1.2.1 Giới thiệu RDF .5 1.2.2 Giới thiệu RDFS 1.3 Các ngôn ngữ truy vấn Web ngữ nghĩa 12 1.3.1 Simple Protocol And RDF Query Language (SPARQL) 12 1.4 LINKED DATA 14 1.4.1 Khái niệm 14 1.4.2 Các quy tắc triển khai Linked Data 15 1.4.3 Truy vấn Web liệu 15 1.5 Tiểu kết chương 16 CHƯƠNG 2: LẬP TRÌNH VỚI WEB NGỮ NGHĨA 17 2.1 Mơi trường lập trình Web ngữ nghĩa .17 2.1.1 Mơi trường lập trình Intellij 17 2.1.2 Jena .19 e iv 2.2 Mơ hình hóa thơng tin với Jena .21 2.2.1 Chương trình Hello Word! Jena 21 2.2.2 Tạo mơ hình RDF .22 2.2.3 Đọc mơ hình RDF .26 2.3 Chuyển đổi liệu Web ngữ nghĩa 28 2.4 Framework Spring MVC 28 2.4.1 Giới thiệu Framework Spring MVC 28 2.4.2 Ví dụ trang web Spring MVC 29 2.5 Tiểu kết chương 30 CHƯƠNG 3: ỨNG DỤNG TÌM KIẾM THƠNG TIN BỆNH NHÂN COVID-19 TẠI VIỆT NAM 31 3.1 Giới thiệu tốn tìm kiếm thơng tin bệnh nhân COVID-19 31 3.1.1 Kiến trúc hệ thống 31 3.1.2 Ý nghĩa thực tiễn hệ thống 32 3.1.3 Chuẩn bị liệu cho toán .35 3.2 Giải pháp hệ thống 45 3.2.1 Mơ hình hệ thống 45 3.2.2 Tạo liệu RDF 46 3.2.3 Truy vấn liệu 47 3.3 Xây dựng hệ thống 47 3.3.1 Mô tả hệ thống 47 3.3.2 Đặc tả chức 49 3.3.3 Phân tích hệ thống 50 3.3.4 Thiết kế giao diện .54 e v 3.4 Kết luận chương .56 KẾT LUẬN 57 DANH MỤC CÁC TÀI LIỆU THAM KHẢO 58 BẢN CAM ĐOAN 67 e vi DANH MỤC CÁC THUẬT NGỮ VÀ CHỮ VIẾT TẮT Viết tắt Tiếng Anh Tiếng Việt RDF Resource Description Framework Framework mô tả tài nguyên URL Uniform Resource Locator Định vị tài nguyên thống URI Uniform Resource Identifier Định dạng tài nguyên thống XML eXtensible Markup Language Ngôn ngữ đánh dấu mở rộng OWL Web Ontology Language Ngôn ngữ thể học HTTP HyperText Transfer Protocol Giao thức truyền tải siêu văn HTML Hypertext Markup Language Ngôn ngữ đánh dấu siêu văn OSM OpenStreetMap Bản đồ đường sá mở SPARQL Simple Protocol And RDF Query Language Java Development Toolkit Giao thức ngôn ngữ truy vấn RDF Bộ công cụ phát triền Java JDT e vii DANH MỤC CÁC HÌNH VẼ VÀ ĐỒ THỊ Hình 1.1 Kiến trúc Web ngữ nghĩa Hình 1.2 Mơ hình ba RDF (RDF triple) Hình 1.3 Mối quan hệ thành phần ba RDF Hình 1.4 Đồ thị RDF Hình 1.5 Cấu trúc phân cấp lớp 10 Hình 1.6 Cấu trúc phân cấp thuộc tính 10 Hình 1.7 Các tầng RDF RDFS 11 Hình 1.8 Các lớp thuộc tính RDF 11 Hình 2.1 Giao diện Intellij .17 Hình 2.2 Các thành phần Jena API 20 Hình 2.3 Kiến trúc Jena 21 Hình 2.4 Thêm thư viện Jena 21 Hình 2.5 Biểu diễn phát biểu dạng đồ thị 23 Hình 2.6 Kết giao diện console .23 Hình 2.7 Dữ liệu xuất dạng Turtle 27 Hình 2.8 Các thành phần Spring .29 Hình 3.1 Kiến trúc chương trình 32 Hình 3.2 Thống kê dịch COVID-19 Việt Nam tính đến ngày 01/09/2021 33 Hình 3.3 Mơ tả mối liên hệ bệnh nhân COVID-19 với F0 34 Hình 3.4 Mơ tả mối liên hệ F0 với địa điểm .35 Hình 3.5 Dữ liệu thơng tin người bệnh .36 Hình 3.6 Dữ liệu thông tin địa điểm 36 e viii Hình 3.7 Dữ liệu thông tin kiện 37 Hình 3.8 Kiến trúc OpenStreetMap 39 Hình 3.9 Trích xuất liệu OpenStreetMap 40 Hình 3.10 Đọc liệu từ OpenStreetMap với JOSM 41 Hình 3.11 Dữ liệu Học viện Cơng nghệ Bưu Viễn thông OpenStreetMap 42 Hình 3.12 Hiển thị thơng tin node dựa vào OSM_ID .43 Hình 3.13 LinkedGeoData.org 44 Hình 3.14 Kết hiển thị Linkedgeodata.org HTML 45 Hình 3.15 Mơ hình hệ thống tra cứu thông tin bệnh nhân .45 Hình 3.16 Mơ hình phát triển hệ thống 47 Hình 3.17 Use case hệ thống tìm kiếm thơng tin bệnh nhân COVID-19 48 Hình 3.18 Sơ đồ kiến trúc thông tin 48 Hình 3.19 Biểu đồ chức thống kê 50 Hình 3.20 Biểu đồ chức xem lịch trình di chuyển bệnh nhân 51 Hình 3.21 Biểu đồ chức xem danh sách bệnh nhân 53 Hình 3.22 Giao diện trang thống kê 54 Hình 3.23 Giao diện tra cứu thơng tin lịch trình di chuyển người bệnh 55 Hình 3.24 Giao diện chi tiết thông tin người bệnh COVID-19 .56 e 55 Giao diện tra cứu thông tin lịch trình di chuyển người bệnh Hình 3.23 Giao diện tra cứu thơng tin lịch trình di chuyển người bệnh Khi người dùng chọn bệnh nhân hệ thống hiển thị tất kiện, địa điểm xác người bệnh tương ứng di chuyển thời gian trước theo ngày cụ thể Ngoài thông số Tổng ca nhiễm, Số ca hôm nay, Số người chết, Số chữa khỏi cập nhật từ Website y tế https://ncov.moh.gov.vn/ e 56 Giao diện trang chi tiết thông tin người bệnh Hình 3.24 Giao diện chi tiết thơng tin người bệnh COVID-19 3.4 Kết luận chương Trong Chương tổng hợp lại kiến thức Web ngữ nghĩa để xây dựng ứng dụng minh họa Trước hết phần mơ tả tốn tìm kiếm thơng tin bệnh nhân COVID-19 Việt Nam Tiếp theo giải pháp cho hệ thống tìm kiếm thơng tin: trình bày mơ hình hệ thống, chuyển đổi (RDF) lưu trữ liệu (Jena) Chương trình bày cách thức tải liệu, chỉnh sửa liệu cách trực quan hóa liệu Web ngữ nghĩa OpenStreetMap Cuối ứng dụng minh họa cụ thể hệ thống tìm kiếm thơng tin người bệnh e 57 KẾT LUẬN Luận văn nghiên cứu trình bày kiến thức Web ngữ nghĩa kiến thức RDF, RDF Schema, ngôn ngữ truy vấn liệu Web ngữ nghĩa SPARQL, mơi trường lập trình Web ngữ nghĩa trực quan hóa liệu OpenStreetMap Qua luận văn đạt số kết sau: Về lý thuyết, luận văn sâu nghiên cứu nhiều kiến thức RDF RDFS, từ hiểu cơng nghệ Web ngữ nghĩa để dựa vào triển khai ứng dụng khác Trình bày cụ thể phương pháp lập trình với Web ngữ nghĩa, cách chuyển đổi liệu cho Web ngữ nghĩa Luận văn trình bày cách trích xuất xử lý liệu từ OpenStreetMap Về ứng dụng minh hoạ, với mục tiêu làm rõ thêm lý thuyết, luận văn ứng dụng xây dựng Web ngữ nghĩa với công cụ hỗ trợ Intellij Spring MVC Cụ thể xây dựng liệu RDF thông tin bệnh nhân mắc COVID-19 Việt Nam, đồng thời trực quan hóa với OpenStreetMap dựa OSM_ID trích xuất từ liệu, khai thác tính truy xuất tài liệu có mơ tả ngữ nghĩa nhằm chia sẻ tài nguyên thông tin bệnh nhân thực tìm kiếm với kết xác e 58 DANH MỤC CÁC TÀI LIỆU THAM KHẢO Tiếng Việt [1] Hoàng Hữu Hạnh - Lê Mạnh Thạnh, Giáo trình Web ngữ nghĩa, NXB giáo dục Tiếng Anh [2] David Wood - Marsha Zaidman and Luke Ruth with Michael Hausenblas, Linked data Structured Data on the Web [3] Glen Hart – Catherine Dolbear, Linked Data A Geographic Perspective [4] Liyang Yu, A Developer’s Guide to the Web ngữ nghĩa [5] Leslie F.Sikos, PhD., Mastering Structured Data On The Semantec Web Frederik Ramm, Jochen Topf, Steve Chilton - UIT Cambridge, 1st edition, 2010 OpenStreetMap Using and Enhancing the Free Map of the World Website [6] http://www.OpenStreetMap.info/ [7] http://wiki.OpenStreetMap.org/wiki/OSM_Semantic_Network [8] https://www.w3.org/2004/02/skos/ [9] https://www.ncov.moh.gov.vn/ e 59 PHỤ LỤC Mã nguồn lấy liệu từ file Excel: public class GenFromExcel { //URI cac tai nguyen static final String dbUri = "https://dbpedia.org/ontology/"; static final String dcUri = "http://purl.org/dc/elements/1.1/"; static final String foafUri = "http://xmlns.com/foaf/0.1/"; public Model model; private GenFromExcel() { //Tao mo hinh RDF moi model = ModelFactory.createDefaultModel(); //Them cac thuoc tinh va moi quan he Property dbPlaceId = model.createProperty(dbUri, "id"); Property dbPlaceName = model.createProperty(dbUri, "name"); Property dbPlaceLatitude = model.createProperty(dbUri, "latitude"); Property dbPlaceLongitude = model.createProperty(dbUri, "longitude"); Property dbSeeAlso = model.createProperty(dbUri, "seeAlso"); Property dcDate = model.createProperty(dcUri, "date"); Property dcPlace = model.createProperty(dcUri, "place"); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream inputStream = classLoader.getResourceAsStream("data/Data_BenhNhan.xlsx"); InputStream inputStream2 = classLoader.getResourceAsStream("data/Data_DiaDiem.xlsx"); InputStream inputStream3 = classLoader.getResourceAsStream("data/Data_LichSu.xlsx"); List benhNhanList = new ArrayList(); List diaDiemList = new ArrayList(); List lichSuList = new ArrayList(); Set suKienSet = new HashSet(); try { OPCPackage pkg = OPCPackage.open(inputStream); XSSFWorkbook wb = new XSSFWorkbook(pkg); XSSFSheet sheet = wb.getSheetAt(0); for (Row row : sheet ) { BenhNhan benhNhan = new BenhNhan(); benhNhan.setId(row.getCell(0).getStringCellValue()); benhNhan.setTuoi(String.valueOf(row.getCell(1).getNumericCellValue())); benhNhan.setDiaChi(row.getCell(2).getStringCellValue()); benhNhan.setTinhTrang(row.getCell(3).getStringCellValue()); benhNhan.setQuocTich(row.getCell(4).getStringCellValue()); e 60 benhNhanList.add(benhNhan); } OPCPackage pkg2 = OPCPackage.open(inputStream2); XSSFWorkbook wb2 = new XSSFWorkbook(pkg2); XSSFSheet sheet2 = wb2.getSheetAt(0); for (Row row : sheet2 ) { DiaDiem diaDiem = new DiaDiem(); diaDiem.setId(row.getCell(0).getStringCellValue()); diaDiem.setTen(row.getCell(1).getStringCellValue()); diaDiem.setOsmId(String.valueOf(row.getCell(2).getNumericCellValue())); diaDiem.setLatitude(String.valueOf(row.getCell(3).getNumericCellValue())) ; diaDiem.setLongitude(String.valueOf(row.getCell(4).getNumericCellValue()) ); diaDiemList.add(diaDiem); } OPCPackage pkg3 = OPCPackage.open(inputStream3); XSSFWorkbook wb3 = new XSSFWorkbook(pkg3); XSSFSheet sheet3 = wb3.getSheetAt(0); for (Row row : sheet3 ) { LichSu lichSu = new LichSu(); lichSu.setThoiGian(row.getCell(0).getStringCellValue()); lichSu.setIdBenhNhan(row.getCell(1).getStringCellValue()); lichSu.setIdDiaDiem(row.getCell(2).getStringCellValue()); lichSuList.add(lichSu); SuKien suKien = new SuKien(lichSu.getThoiGian(),lichSu.getIdDiaDiem()); suKienSet.add(suKien); } } catch (Exception e) { System.out.println(e.getMessage()); } //Them cac tai nguyen List benhNhanRsList = new ArrayList(); for (BenhNhan benhNhan : benhNhanList ) { String name = benhNhan.getId(); Resource benhNhanRs = model.createResource(foafUri + name); benhNhanRs.addProperty(FOAF.name, "Bệnh nhân " + benhNhan.getId().replaceAll("BN", "")); benhNhanRs.addProperty(FOAF.openid, name); benhNhanRs.addProperty(FOAF.age, benhNhan.getTuoi()); benhNhanRs.addProperty(FOAF.based_near, benhNhan.getDiaChi()); benhNhanRs.addProperty(FOAF.status, benhNhan.getTinhTrang()); benhNhanRsList.add(benhNhanRs); } e 61 List diaDiemRsList = new ArrayList(); for (DiaDiem diaDiem : diaDiemList ) { String name = diaDiem.getId(); Resource diaDiemRs = model.createResource(dbUri + name); diaDiemRs.addProperty(dbPlaceId, name); diaDiemRs.addProperty(dbPlaceName, diaDiem.getTen()); diaDiemRs.addProperty(dbPlaceLatitude, diaDiem.getLatitude()); diaDiemRs.addProperty(dbPlaceLongitude, diaDiem.getLongitude()); diaDiemRsList.add(diaDiemRs); } List suKienLst = new ArrayList(); suKienLst.addAll(suKienSet); Collections.reverse(suKienLst); List suKienRsList = new ArrayList(); for (int i = 0; i < suKienLst.size(); i++) { Resource resource = model.createResource(dcUri + i); resource.addProperty(dcDate,suKienLst.get(i).getNgay()); resource.addProperty(dcPlace,suKienLst.get(i).getDiaDiem()); suKienRsList.add(resource); } Set lichSuSet = new HashSet(); for (LichSu lichSu : lichSuList ) { SuKien suKien = new SuKien(lichSu.getThoiGian(),lichSu.getIdDiaDiem()); for (SuKien suKien1: suKienLst ) { if(suKien.getNgay().equalsIgnoreCase(suKien1.getNgay())&&suKien.getDiaDie m().equalsIgnoreCase(suKien1.getDiaDiem())){ suKien= suKien1; } } Resource resource1 = null; for (Resource rs : benhNhanRsList ) { if (rs.getProperty(FOAF.openid).getObject().toString().equalsIgnoreCase(lich Su.getIdBenhNhan())) { resource1 = rs; } } Resource resource2 = null; for (Resource rs : diaDiemRsList ) { if (rs.getProperty(dbPlaceId).getObject().toString().equalsIgnoreCase(lichSu getIdDiaDiem())) { resource2 = rs; } } e 62 lichSu.setDiaDiem(resource2); Resource resource3 = null; for (Resource rs : suKienRsList ) { if (rs.getProperty(dcDate).getObject().toString().equalsIgnoreCase(lichSu.ge tThoiGian()) && rs.getProperty(dcPlace).getObject().toString().equalsIgnoreCase(lichSu.ge tIdDiaDiem())) { resource3 = rs; } } lichSuSet.add(lichSu); lichSu.setSuKien(resource3); Statement statement = model.createStatement(resource1, dbSeeAlso, resource3); model.add(statement); } List lichSuList1 = new ArrayList(); lichSuList1.addAll(lichSuSet); for (LichSu lichSu: lichSuList1 ) { Statement statement = model.createStatement(lichSu.getSuKien(), dbSeeAlso, lichSu.getDiaDiem()); model.add(statement); } System.out.println("DONE"); } Mã nguồn lấy liệu SPARQL Model model = ModelFactory.createDefaultModel(); InputStream in = FileManager.get().open(inputFileName); model.read(in, ""); String queryString = "PREFIX foaf: " + "PREFIX db: " + "PREFIX dc: " + "SELECT ?ten ?ngay ?tenDiaDiem ?lat ?long" + " WHERE { " + " ?x foaf:name ?ten ; " + " db:seeAlso ?sukien " + " OPTIONAL{?sukien dc:date ?ngay;" + " db:seeAlso ?diaDiem " + " ?diaDiem db:name ?tenDiaDiem " + " ?diaDiem db:latitude ?lat " + " ?diaDiem db:longitude ?long " + " }." + " FILTER regex(?ten, '"+ten+"') " + " }"; Query query = QueryFactory.create(queryString); e 63 QueryExecution qe = QueryExecutionFactory.create(query, model); ResultSet results = qe.execSelect(); Mã nguồn chương trình tìm kiếm thơng tin bệnh nhân COVID-19 Việt Nam: package vn.com.fpt.foxpay.wallet.mock.web.mvc; import import import import import import import import import import import import import com.fasterxml.jackson.databind.ObjectMapper; io.micrometer.core.annotation.Timed; org.apache.jena.query.*; org.apache.jena.rdf.model.Model; org.apache.jena.rdf.model.ModelFactory; org.apache.jena.util.FileManager; org.slf4j.Logger; org.slf4j.LoggerFactory; org.springframework.http.*; org.springframework.stereotype.Controller; org.springframework.web.bind.annotation.*; org.springframework.web.client.RestTemplate; org.springframework.web.servlet.ModelAndView; import java.io.IOException; import java.io.InputStream; import java.util.*; @Controller public class MerchantMockController { private final Logger log = LoggerFactory.getLogger(MerchantMockController.class); @RequestMapping(value = { "", "" }, method = RequestMethod.GET) @ResponseBody @Timed public ModelAndView checkout(org.springframework.ui.Model model2, @RequestParam(required = false) String ten) { if(ten == null){ ten = "Bệnh nhân 1"; } String resourceUrl = "https://corona.lmao.ninja/v2/countries/vn"; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); headers.add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"); HttpEntity entity = new HttpEntity("parameters", headers); ResponseEntity response = e 64 restTemplate.exchange(resourceUrl, HttpMethod.GET,entity,String.class); ObjectMapper mapper = new ObjectMapper(); try { ResStatus resStatus = mapper.readValue(response.getBody(),ResStatus.class); model2.addAttribute("resStatus", resStatus); } catch (IOException e) { e.printStackTrace(); } final String inputFileName = "D:\\test3.rdf"; Model model = ModelFactory.createDefaultModel(); InputStream in = FileManager.get().open(inputFileName); model.read(in, ""); String queryString = "PREFIX foaf: " + "PREFIX db: " + "PREFIX dc: " + "SELECT ?ten ?ngay ?tenDiaDiem ?lat ?long" + " WHERE { " + " ?x foaf:name ?ten ; " + " db:seeAlso ?sukien " + " OPTIONAL{?sukien dc:date ?ngay;" + " db:seeAlso ?diaDiem " + " ?diaDiem db:name ?tenDiaDiem " + " ?diaDiem db:latitude ?lat " + " ?diaDiem db:longitude ?long " + " }." + " FILTER regex(?ten, '"+ten+"') " + " }"; Query query = QueryFactory.create(queryString); QueryExecution qe = QueryExecutionFactory.create(query, model); ResultSet results = qe.execSelect(); List benhNhatList = getlistBenhNhan(); List thongtinList = new ArrayList(); List lichTrinhList = new ArrayList(); model2.addAttribute("benhNhatList", benhNhatList); model2.addAttribute("benhNhan", ten); List kq=results.getResultVars(); while(results.hasNext()) { QuerySolution qs=results.nextSolution(); String val0=qs.get(kq.get(0).toString()).toString(); String val1=qs.get(kq.get(1).toString()).toString(); String val2=qs.get(kq.get(2).toString()).toString(); String val3=qs.get(kq.get(3).toString()).toString(); String val4=qs.get(kq.get(4).toString()).toString(); ThongTin thongTin = new ThongTin(); thongTin.setBenhNhan(val0); thongTin.setNgay(val1); thongTin.setDiaDiem(val2); thongTin.setLat(val3); thongTin.setLon(val4); thongtinList.add(thongTin); } e 65 qe.close(); Set ngaySet = new HashSet(); for (ThongTin thongtin: thongtinList ) { ngaySet.add(thongtin.getNgay()); } List ngayLst = new ArrayList(); List diaDiemList2 = new ArrayList(); ngayLst.addAll(ngaySet); for (String s: ngayLst ) { LichTrinh lichTrinh = new LichTrinh(); lichTrinh.setNgay(s); List diaDiemList = new ArrayList(); for (ThongTin thongtin: thongtinList ) { if(thongtin.getNgay().equals(s)){ DiaDiem diaDiem = new DiaDiem(); diaDiem.setTen(thongtin.getDiaDiem()); diaDiem.setLatitude(thongtin.getLat()); diaDiem.setLongitude(thongtin.getLon()); diaDiemList.add(diaDiem); diaDiemList2.add(diaDiem); } } lichTrinh.setDiaDiem(diaDiemList); lichTrinhList.add(lichTrinh); } model2.addAttribute("lichTrinh", lichTrinhList); model2.addAttribute("diaDiem", diaDiemList2); return new ModelAndView("merchant-mock-checkout"); } @RequestMapping(value = "/danh-sach", method = RequestMethod.GET) @ResponseBody @Timed public ModelAndView danhSach(org.springframework.ui.Model model2, @RequestParam(required = false) String ten) { String resourceUrl = "https://corona.lmao.ninja/v2/countries/vn"; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); headers.add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"); HttpEntity entity = new HttpEntity("parameters", headers); ResponseEntity response = restTemplate.exchange(resourceUrl, HttpMethod.GET,entity,String.class); e 66 ObjectMapper mapper = new ObjectMapper(); try { ResStatus resStatus = mapper.readValue(response.getBody(),ResStatus.class); model2.addAttribute("resStatus", resStatus); } catch (IOException e) { e.printStackTrace(); } return new ModelAndView("danh-sach"); } public List getlistBenhNhan(){ final String inputFileName = "D:\\test3.rdf"; Model model = ModelFactory.createDefaultModel(); InputStream in = FileManager.get().open(inputFileName); model.read(in, ""); String queryString = "PREFIX foaf: " + // // // // // // // // "PREFIX db: " + "PREFIX dc: " + "SELECT ?ten " + " WHERE { " + " ?x foaf:name ?ten ; " + " db:seeAlso ?sukien " + " OPTIONAL{?sukien dc:date ?ngay;" + " db:seeAlso ?diaDiem " + " ?diaDiem db:name ?tenDiaDiem " + " ?diaDiem db:latitude ?lat " + " ?diaDiem db:longitude ?long " + " }." + " FILTER regex(?ten, 'Bệnh nhân 1') " + " }"; Query query = QueryFactory.create(queryString); QueryExecution qe = QueryExecutionFactory.create(query, model); ResultSet results = qe.execSelect(); List kq=results.getResultVars(); List lst = new ArrayList(); while(results.hasNext()) { QuerySolution qs=results.nextSolution(); String val0=qs.get(kq.get(0).toString()).toString(); lst.add(val0); // String val5=qs.get(kq.get(5).toString()).toString(); // out.println(""+val1+""); } Collections.sort(lst); qe.close(); return lst; } } e 67 BẢN CAM ĐOAN Tôi cam đoan thực việc kiểm tra mức độ tương đồng nội dung luận văn qua phần mềm DoIT cách trung thực đạt kết mức tương đồng 9% toàn nội dung luận văn Bản luận văn kiểm tra qua phần mềm cứng luận văn nộp để bảo vệ trước hội đồng Nếu sai xin chịu hình thức kỷ luật theo quy định hành Học viện Cơng nghệ Bưu Viễn thơng Hà Nội, ngày 06 tháng 03 năm 2021 Học viên thực luận văn kỹ thuật Phan Hồng Dương e 68 Học viên thực luận văn Người hướng dẫn luận văn Phan Hồng Dương PGS TS Hoàng Hữu Hạnh e 69 e ... CƠNG NGHỆ BƯU CHÍNH VIỄN THƠNG - Phan Hồng Dương ỨNG DỤNG CÔNG NGHỆ WEB NGỮ NGHĨA VÀ OPENSTREETMAP PHÁT TRIỂN ỨNG DỤNG HỖ TRỢ TÌM KIẾM THƠNG TIN NGƯỜI BỆNH COVID- 19. .. dụng công nghệ Web ngữ nghĩa OpenStreetMap phát triển ứng dụng hỗ trợ tìm kiếm thơng tin bệnh nhân COVID- 19? ?? e CHƯƠNG 1: KIẾN THỨC CƠ SỞ Nội dung chương bao gồm giới thiệu chung cơng nghệ Web ngữ. .. quan Web liệu Đề tài hướng việc ứng dụng công nghệ Web ngữ nghĩa việc phát triển ứng dụng Web liệu hệ thống liệu đồ mở - OpenStreetMap nhằm kết nối datasets để hỗ trợ hiệu việc tìm kiếm thơng tin

Ngày đăng: 27/03/2023, 09:00

Tài liệu cùng người dùng

Tài liệu liên quan