Package org.dbpedia.spotlight.exceptions

Examples of org.dbpedia.spotlight.exceptions.ItemNotFoundException


    @Override
    public DBpediaResourceOccurrence disambiguate(SurfaceFormOccurrence sfOccurrence) throws SearchException, ItemNotFoundException, InputException {
        List<DBpediaResourceOccurrence> candidates = bestK(sfOccurrence, 1);
        if (candidates.size()==0)
            throw new ItemNotFoundException(sfOccurrence.surfaceForm()+" was not found in the index.");
        return candidates.get(0);
    }
View Full Code Here


          = this.sqlConnection.prepareStatement("SELECT * FROM words WHERE word=? LIMIT 1;");
      statement.setString(1, candidate);
      ResultSet resultSet = statement.executeQuery();

      if(!resultSet.next())
        throw new ItemNotFoundException("Could not find information about candidate \"" + candidate +  "\".");

      return new CandidateData(resultSet.getLong("id"), candidate, resultSet.getLong("count_corpus"), resultSet.getLong("count_web"));
    } catch (SQLException e) {
      e.printStackTrace();
    }
View Full Code Here

          ("SELECT * FROM bigrams WHERE " +
              "word1=" + word1.getId() + " AND word2=" + word2.getId() + " " +
              "LIMIT 1;");

      if(!resultSet.next())
        throw new ItemNotFoundException("Could not find bigram.");

      return new CoOccurrenceData(
          0, 0,
          0, resultSet.getLong("significance_web"));

View Full Code Here

          "word1=" + word1.getId() + " AND word2=" + word2.getId() + " AND word3="
          + word3.getId() + " LIMIT 1;");


      if(!resultSet.next())
        throw new ItemNotFoundException("Could not find trigram.");

      return new CoOccurrenceData(0, resultSet.getLong("count_web"), 0, 0);

    } catch (SQLException e) {
      //Could not retrieve trigram information
      e.printStackTrace();
    }

    throw new ItemNotFoundException("Could not find trigram.");
  }
View Full Code Here

  public TaggedToken getLeftNeighbourToken(int textOffsetStart, int textOffsetEnd) throws ItemNotFoundException {

    try {
      return getLeftContext(textOffsetStart, textOffsetEnd, 1).get(0);
    }catch (IndexOutOfBoundsException e) {
      throw new ItemNotFoundException("No left neighbour token.");
    }

  }
View Full Code Here

  public TaggedToken getRightNeighbourToken(int textOffsetStart, int textOffsetEnd) throws ItemNotFoundException {

    try {
      return getRightContext(textOffsetStart, textOffsetEnd, 1).get(0);
    }catch (IndexOutOfBoundsException e) {
      throw new ItemNotFoundException("No left neighbour token.");
    }


  }
View Full Code Here

TOP

Related Classes of org.dbpedia.spotlight.exceptions.ItemNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.