Tabnine Logo
WikiPageNotFoundException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
de.tudarmstadt.ukp.wikipedia.api.exception.WikiPageNotFoundException
constructor

Best Java code snippets using de.tudarmstadt.ukp.wikipedia.api.exception.WikiPageNotFoundException.<init> (Showing top 20 results out of 315)

origin: dkpro/dkpro-jwpl

/**
 * @see de.tudarmstadt.ukp.wikipedia.api.Category#Category(Wikipedia, long)
 */
private void createCategory(long id) throws WikiPageNotFoundException {
  Session session = this.wiki.__getHibernateSession();
  session.beginTransaction();
  hibernateCategory = catDAO.findById(id);
  session.getTransaction().commit();
  if (hibernateCategory == null) {
    throw new WikiPageNotFoundException("No category with id " + id + " was found.");
  }
}
origin: dkpro/dkpro-jwpl

private void fetchByPageId(int pageID)
  throws WikiApiException
{
  Session session = this.wiki.__getHibernateSession();
  session.beginTransaction();
  hibernatePage = (de.tudarmstadt.ukp.wikipedia.api.hibernate.Page) session
      .createQuery("from Page where pageId = :id").setParameter("id", pageID, IntegerType.INSTANCE).uniqueResult();
  session.getTransaction().commit();
  if (hibernatePage == null) {
    throw new WikiPageNotFoundException("No page with page id " + pageID + " was found.");
  }
}
origin: dkpro/dkpro-jwpl

throw new WikiPageNotFoundException("The article with the ID " + articleID
    + " was not found.");
origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

throw new WikiPageNotFoundException("The article with the ID " + articleID
    + " was not found.");
origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

throw new WikiPageNotFoundException("The revision with the ID " + revisionID
    + " was not found.");
origin: dkpro/dkpro-jwpl

/**
 * Gets the page ids for a given title with case insensitive matching.<br>
 *
 *
 * @param title The title of the page.
 * @return The ids of the pages with the given title.
 * @throws WikiApiException Thrown if errors occurred.
 */
public List<Integer> getPageIdsCaseInsensitive(String title) throws WikiApiException {
  title = title.toLowerCase();
  title = title.replaceAll(" ", "_");
  Session session = this.__getHibernateSession();
  session.beginTransaction();
  Iterator results = session.createQuery(
  "select p.pageID from PageMapLine as p where lower(p.name) = :pName").setParameter("pName", title, StringType.INSTANCE).list().iterator();
  session.getTransaction().commit();
  if(!results.hasNext()){
    throw new WikiPageNotFoundException();
  }
  List<Integer> resultList = new LinkedList<Integer>();
  while(results.hasNext()){
    resultList.add((Integer)results.next());
  }
  return resultList;
}
origin: dkpro/dkpro-jwpl

/**
 * Gets the page ids for a given title.<br>
 *
 *
 * @param title The title of the page.
 * @return The id for the page with the given title.
 * @throws WikiApiException Thrown if errors occurred.
 */
public List<Integer> getPageIds(String title) throws WikiApiException {
  Session session = this.__getHibernateSession();
  session.beginTransaction();
  Iterator results = session.createQuery(
  "select p.pageID from PageMapLine as p where p.name = :pName").setParameter("pName", title, StringType.INSTANCE).list().iterator();
  session.getTransaction().commit();
  if(!results.hasNext()){
    throw new WikiPageNotFoundException();
  }
  List<Integer> resultList = new LinkedList<Integer>();
  while(results.hasNext()){
    resultList.add((Integer)results.next());
  }
  return resultList;
}
origin: dkpro/dkpro-jwpl

/**
 * @throws WikiApiException Thrown if errors occurred.
 * @see de.tudarmstadt.ukp.wikipedia.api.Page
 */
private void fetchByHibernateId(long id)
  throws WikiApiException
{
  Session session = this.wiki.__getHibernateSession();
  session.beginTransaction();
  hibernatePage = pageDAO.findById(id);
  session.getTransaction().commit();
  if (hibernatePage == null) {
    throw new WikiPageNotFoundException("No page with id " + id + " was found.");
  }
}
origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

throw new WikiPageNotFoundException("The revision with the ID " + revisionID
    + " was not found.");
origin: dkpro/dkpro-jwpl

throw new WikiPageNotFoundException("The revision with the ID " + revisionID
    + " was not found.");
origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

throw new WikiPageNotFoundException("The article with the ID " + articleID
    + " was not found.");
origin: dkpro/dkpro-jwpl

/**
 * Gets the {@link Category categories} for a given {@link Page} identified by its {@code pageTitle}.
 * @param pageTitle The title of a {@link Page}, not a category.
 * @return The category objects which are associated with the given {@code pageTitle}.
 * @throws WikiPageNotFoundException Thrown if no {@link Page} exists for the given {@code pageTitle}.
 */
public Set<Category> getCategories(String pageTitle) throws WikiPageNotFoundException
{
  if (pageTitle == null || pageTitle.length() == 0) {
    throw new WikiPageNotFoundException();
  }
  Session session = this.__getHibernateSession();
  session.beginTransaction();
  List<Integer> categoryHibernateIds = session.createQuery(
      "select c from Page p left join p.categories c where p.name = :pageTitle", Integer.class)
      .setParameter("pageTitle", pageTitle).list();
  session.getTransaction().commit();
  Set<Category> categorySet = new HashSet<Category>(categoryHibernateIds.size());
  for (int hibernateId : categoryHibernateIds) {
    try {
      categorySet.add(new Category(this, hibernateId));
    } catch (WikiPageNotFoundException e) {
      logger.warn("Could not load Category by it's HibernateId = '"+hibernateId+"'");
    }
  }
  return categorySet;
}
origin: dkpro/dkpro-jwpl

throw new WikiPageNotFoundException("The article with the ID " + articleID
    + " was not found.");
origin: dkpro/dkpro-jwpl

/**
 * Creates a category object.
 * @param wiki The wikipedia object.
 * @param pName The name of the category.
 * @throws WikiPageNotFoundException If the category does not exist.
 */
public Category(Wikipedia wiki, String pName) throws WikiApiException {
  if (pName == null || pName.length() == 0) {
    throw new WikiPageNotFoundException();
  }
  this.wiki = wiki;
  catDAO = new CategoryDAO(wiki);
  Title catTitle = new Title(pName);
  createCategory(catTitle);
}
origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

throw new WikiPageNotFoundException("The article with the ID " + articleID
    + " was not found.");
origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine

throw new WikiPageNotFoundException("The article with the ID " + articleID
    + " was not found.");
origin: dkpro/dkpro-jwpl

/**
 * Creates a page object.
 *
 * @param wiki
 *            The wikipedia object.
 * @param pName
 *            The name of the page.
 * @param useExactTitle
 *            Whether to use the exact title or try to guess the correct wiki-style title.
 * @throws WikiApiException Thrown if errors occurred.
 */
public Page(Wikipedia wiki, String pName, boolean useExactTitle)
  throws WikiApiException
{
  if (pName == null || pName.length() == 0) {
    throw new WikiPageNotFoundException();
  }
  this.wiki = wiki;
  this.pageDAO = new PageDAO(wiki);
  Title pageTitle = new Title(pName);
  fetchByTitle(pageTitle, useExactTitle);
}
origin: dkpro/dkpro-jwpl

/**
 * Gets the title for a given pageId.
 *
 * @param pageId The id of the page.
 * @return The title for the given pageId.
 * @throws WikiApiException Thrown if errors occurred.
 */
public Title getTitle(int pageId) throws WikiApiException {
  Session session = this.__getHibernateSession();
  session.beginTransaction();
  Object returnValue = session.createNativeQuery(
    "select p.name from PageMapLine as p where p.pageId= :pId").setParameter("pId", pageId, IntegerType.INSTANCE).uniqueResult();
  session.getTransaction().commit();
  String title = (String)returnValue;
  if(title==null){
    throw new WikiPageNotFoundException();
  }
  return new Title(title);
}
origin: dkpro/dkpro-jwpl

/**
 * @see de.tudarmstadt.ukp.wikipedia.api.Category#Category(Wikipedia, String)
 */
private void createCategory(Title title) throws WikiPageNotFoundException {
  String name = title.getWikiStyleTitle();
  Session session = this.wiki.__getHibernateSession();
  session.beginTransaction();
  Object returnValue;
  String query = "select cat.pageId from Category as cat where cat.name = :name";
  if(wiki.getDatabaseConfiguration().supportsCollation()) {
    query += Wikipedia.SQL_COLLATION;
  }
  returnValue = session.createNativeQuery(query)
      .setParameter("name", name, StringType.INSTANCE)
      .uniqueResult();
  session.getTransaction().commit();
  // if there is no category with this name, the hibernateCategory is null
  if (returnValue == null) {
    hibernateCategory = null;
    throw new WikiPageNotFoundException("No category with name " + name + " was found.");
  }
  else {
    // now cast it into an integer
    int pageID = (Integer) returnValue;
    createCategory( pageID);
  }
}
origin: dkpro/dkpro-jwpl

throw new WikiPageNotFoundException("Not discussion page was available at the time of the given article revision");
de.tudarmstadt.ukp.wikipedia.api.exceptionWikiPageNotFoundException<init>

Popular methods of WikiPageNotFoundException

  • printStackTrace

Popular in Java

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • setScale (BigDecimal)
  • setContentView (Activity)
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now