gpt4 book ai didi

de.tudarmstadt.ukp.wikipedia.api.exception.WikiApiException类的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 17:13:05 27 4
gpt4 key购买 nike

本文整理了Java中de.tudarmstadt.ukp.wikipedia.api.exception.WikiApiException类的一些代码示例,展示了WikiApiException类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WikiApiException类的具体详情如下:
包路径:de.tudarmstadt.ukp.wikipedia.api.exception.WikiApiException
类名称:WikiApiException

WikiApiException介绍

暂无

代码示例

代码示例来源:origin: dkpro/dkpro-jwpl

/**
 * Serializes the graph to the given destination.
 * @param destination The destination to which should be saved.
 * @throws WikiApiException Thrown if errors occurred.
 */
public void saveGraph(String destination) throws WikiApiException {
  try {
    GraphSerialization.saveGraph(graph, destination);
  } catch (IOException e) {
    throw new WikiApiException(e);
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.lexsemresource/de.tudarmstadt.ukp.dkpro.lexsemresource.wikipedia-asl

private void initializeCategoryGraph() throws LexicalSemanticResourceException  {
  try {
    this.catGraph = CategoryGraphManager.getCategoryGraph(wiki);
  } catch (WikiApiException e) {
    e.printStackTrace();
    throw new LexicalSemanticResourceException("Category graph could not be initialized.",e);
  }
}

代码示例来源:origin: dkpro/dkpro-jwpl

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

代码示例来源:origin: dkpro/dkpro-jwpl

/**
 * Get infos only for a subset of articles.
 * @param pPages A set of pages. Only this subset of wiki pages is used in the info object.
 */
public WikipediaInfo(Iterable<Page> pPages) throws WikiApiException {
  if (pPages == null) {
    throw new WikiApiException("The page set has to be initialized.");
  }
  pages = pPages;
  averageFanOut = -1.0;   // lazy initialization => it is computed and stored when it is accessed
  degreeDistribution = new HashMap<Integer,Integer>();
  categorizedArticleSet = new HashSet<Integer>();
  // get number of pages
  numberOfPages = 0;
  while (pages.iterator().hasNext()) {
    numberOfPages++;
    pages.iterator().next();
  }
}

代码示例来源:origin: dkpro/dkpro-jwpl

e.printStackTrace();

代码示例来源:origin: dkpro/dkpro-jwpl

public int getTaxonomicallyBoundPathLengthInNodes(Category cat1, Category cat2) throws WikiApiException {
  int retValue = getTaxonomicallyBoundPathLengthInEdges(cat1, cat2);
  if (retValue == 0) {
    return 0;
  }
  else if (retValue > 0) {
    return (--retValue);
  }
  else if (retValue == -1) {
    return -1;
  }
  else {
    throw new WikiApiException("Unknown return value.");
  }
}

代码示例来源:origin: dkpro/dkpro-jwpl

} catch (WikiApiException e) {
  logger.error("Page with hibernateID " + id + " not found.");
  e.printStackTrace();

代码示例来源:origin: dkpro/dkpro-jwpl

/**
 * Creates an {@link CategoryGraph} using a serialized DirectedGraph object.
 * @param pWiki A {@link Wikipedia} object.
 * @param location The location of the serialized graph
 * @throws WikiApiException Thrown if errors occurred.
 */
public CategoryGraph(Wikipedia pWiki, File location) throws WikiApiException{
  try {
    constructCategoryGraph(pWiki, GraphSerialization.loadGraph(location));
  } catch (IOException e) {
    throw new WikiApiException(e);
  } catch (ClassNotFoundException e) {
    throw new WikiApiException(e);
  }
}

代码示例来源:origin: dkpro/dkpro-jwpl

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

代码示例来源:origin: 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.");
  }
}

代码示例来源:origin: 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;
  }
}

代码示例来源: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;
}

代码示例来源:origin: dkpro/dkpro-jwpl

throw new WikiApiException(e);

代码示例来源:origin: dkpro/dkpro-jwpl

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

代码示例来源:origin: dkpro/dkpro-jwpl

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

代码示例来源:origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

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

代码示例来源:origin: 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;
}

代码示例来源:origin: dkpro/dkpro-jwpl

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

代码示例来源:origin: 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;
}

代码示例来源:origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

throw new WikiApiException(e);

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com