cuốn sách gpt4 ai đã làm

Ví dụ về cách sử dụng và mã của lớp de.tudarmstadt.ukp.wikipedia.api.Exception.WikiApiException

In lại Tác giả: Người biết Thời gian cập nhật: 26/03/2024 17:13:05 28 4
mua khóa gpt4 Nike

Bài viết này tổ chức Javade.tudarmstadt.ukp.wikipedia.api.Exception.WikiApiExceptionMột số ví dụ mã cho lớp, hiển thịWikiApiNgoại lệCách sử dụng cụ thể của lớp. Các ví dụ mã này chủ yếu đến từGithub/tràn ngăn xếp/MavenCác nền tảng như thế này là các mã được trích xuất từ ​​một số dự án được chọn. Chúng có ý nghĩa tham khảo mạnh mẽ và có thể giúp bạn ở một mức độ nhất định.WikiApiNgoại lệThông tin cụ thể của lớp như sau:
Đường dẫn gói: de.tudarmstadt.ukp.wikipedia.api.Exception.WikiApiException
Tên lớp: WikiApiException

Giới thiệu về WikiApiException

Chưa có

ví dụ về mã

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

/** * Tuần tự hóa biểu đồ đến đích đã cho * @param đích Điểm đến cần được lưu * @throws WikiApiException Ném đi nếu xảy ra lỗi */ public void saveGraph(String Destination) ném WikiApiException { try { GraphSerialization.saveGraph. (biểu đồ, đích); } bắt (IOException e) { ném WikiApiException mới (e);

Nguồn mẫu mã:nguồn gốc: de.tudarmstadt.ukp.dkpro.lexsemresource/de.tudarmstadt.ukp.dkpro.lexsemresource.wikipedia-asl

void void khởi tạoCategoryGraph() ném LexicalSemanticResourceException { try { this.catGraph = CategoryGraphManager.getCategoryGraph(wiki); } Catch (WikiApiException e) { e.printStackTrace(); ném LexicalSemanticResourceException mới("Không thể khởi tạo biểu đồ danh mục.",e) ;

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

result = Statement.executeQuery(query); } Catch (WikiApiException wae) { logger.error(wae.getLocalizedMessage(), wae);

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

/** * Chỉ nhận thông tin cho một tập hợp con các bài viết * @param pPages Một tập hợp các trang wiki này được sử dụng trong đối tượng thông tin */ public WikipediaInfo(Iterable pPages) ném WikiApiException { if. (pPages == null) { ném WikiApiException mới ("Bộ trang phải được khởi tạo." } pages = pPages; -1.0; // khởi tạo lười biếng => nó được tính toán và lưu trữ khi được truy cập DegreeDistribution = new HashMap();classedArticleSet = new HashSet(); // lấy số trang numberOfPages = 0; while (pages.iterator().hasNext()) { numberOfPages++; pages.iterator().next();

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

e.printStackTrace();

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

public int getTaxonomicallyBoundPathLengthInNodes(Category cat1, Category cat2) ném WikiApiException { int retValue = getTaxonomicallyBoundPathLengthInEdges(cat1, cat2); if (retValue == 0) { return 0; } else if (retValue > 0) { return (--retValue); } khác if (retValue == -1) { return -1; } else { ném WikiApiException mới ("Giá trị trả về không xác định." } }

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

} Catch (WikiApiException e) { logger.error("Không tìm thấy trang có ID ngủ đông " + id + "."); e.printStackTrace();

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

/** * Tạo một {@link CategoryGraph} bằng cách sử dụng đối tượng DirectedGraph được tuần tự hóa. * @param pWiki Một đối tượng {@link Wikipedia} * @param location Vị trí của biểu đồ được tuần tự hóa * @throws WikiApiException Ném ra nếu xảy ra lỗi. public CategoryGraph(Wikipedia pWiki, File location) ném ra WikiApiException{ try { buildCategoryGraph(pWiki, GraphSerialization.loadGraph(location)); } bắt (IOException e) { ném WikiApiException mới (e); } bắt (ClassNotFoundException e) { ném WikiApiException mới (e);

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

} catch (WikiApiException e) { System.out.println("Page " + title + " does not exist"); e.printStackTrace(); System.exit(1);

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

/** * Gets the path length between two category nodes - measured in "nodes". * @param node1 The first node. * @param node2 The second node. * @return The number of nodes of the path between node1 and node2. 0, if the nodes are identical or neighbors. -1, if no path exists. */ public int getPathLengthInNodes(Category node1, Category node2) throws WikiApiException { int retValue = getPathLengthInEdges(node1, node2); if (retValue == 0) { return 0; } else if (retValue > 0) { return (--retValue); } else if (retValue == -1) { return -1; } else { throw new WikiApiException("Unknown return value."); } }

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

private static CategoryGraph tryToLoadCategoryGraph(Wikipedia wiki, String wikiId, String size) throws WikiApiException { String defaultSerializedGraphLocation = getCategoryGraphSerializationFileName(wikiId, size); File defaulSerializedGraphFile = new File(defaultSerializedGraphLocation); if (defaulSerializedGraphFile.exists()) { try { logger.info("Loading category graph from " + defaultSerializedGraphLocation); return new CategoryGraph(wiki, GraphSerialization.loadGraph(defaultSerializedGraphLocation)); } catch (IOException e) { throw new WikiApiException(e); } catch (ClassNotFoundException e) { throw new WikiApiException(e); } } else { return null; } }

Nguồn mẫu mã:origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

private Connection getConnection(RevisionAPIConfiguration config) throws WikiApiException { Connection c; try { String driverDB = "com.mysql.jdbc.Driver"; Class.forName(driverDB); c = DriverManager.getConnection( "jdbc:mysql://" + config.getHost() + "/" + config.getDatabase(), config.getUser(), config.getPassword()); if (!c.isValid(5)) { throw new WikiApiException("Connection could not be established."); } } catch (SQLException e) { throw new WikiApiException(e); } catch (ClassNotFoundException e) { throw new WikiApiException(e); } return c; }

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

throw new WikiApiException(e);

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

throw new WikiApiException("Page ID must be > 0"); throw new WikiApiException(e);

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

throw new WikiApiException("Revision ID must be > 0"); throw new WikiApiException(e);

Nguồn mẫu mã:origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

throw new WikiApiException("Article data is inconsistent"); throw new WikiApiException(e);

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

private Connection getConnection(Wikipedia wiki) throws WikiApiException { DatabaseConfiguration config = wiki.getDatabaseConfiguration(); Connection c; try { String driverDB = "com.mysql.jdbc.Driver"; Class.forName(driverDB); c = DriverManager.getConnection("jdbc:mysql://" + config.getHost() + "/" + config.getDatabase()+"?autoReconnect=true", config.getUser(), config.getPassword()); if (!c.isValid(5)) { throw new WikiApiException( "Connection could not be established."); } } catch (SQLException e) { throw new WikiApiException(e); } catch (ClassNotFoundException e) { throw new WikiApiException(e); } return c; }

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

throw new WikiApiException("Article data is inconsistent"); throw new WikiApiException(e);

Nguồn mẫu mã:nguồn gốc: dkpro/dkpro-jwpl

/** * Helper method to obtain a connection via the given {@link RevisionAPIConfiguration} parameter. * @param config Must not be {@code null}. * @return A valid {@link Connection} to the database endpoint. * @throws WikiApiException Thrown if errors occurred while opening a connection. */ protected Connection getConnection(RevisionAPIConfiguration config) throws WikiApiException { Connection c; try { String driverDB = config.getDatabaseDriver(); Class.forName(driverDB); c = DriverManager.getConnection(config.getJdbcURL(), config.getUser(), config.getPassword()); if (!c.isValid(5)) { throw new WikiApiException("Connection could not be established."); } } catch (SQLException | ClassNotFoundException e) { throw new WikiApiException(e); } return c; }

Nguồn mẫu mã:origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

throw new WikiApiException(e);
28 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress