public HashSet<OWLClass> getTransitiveAnnotations(String entity) throws SQLException {
    HashSet<OWLClass> result = new HashSet<>();

    getTransitiveAnnotations.setString(1, entity);

    try (ResultSet resultSet = getTransitiveAnnotations.executeQuery()) {
      while (resultSet.next()) {
        result.add(utils.getEntity(resultSet.getInt(1)).asOWLClass());
      }
    }

    return result;
  }
  @Override
  protected void cache() throws SQLException {
    // We read the file line by line, split each line on whitespace into three parts and use each
    // triplet to create
    // an annotation in the database.

    try (Statement statement = getConnection().createStatement()) {
      statement.execute(
          ""
              + "CREATE TABLE IF NOT EXISTS annotations ("
              + "  id INT PRIMARY KEY AUTO_INCREMENT,"
              + "  entity VARCHAR(256),"
              + "  annotation INT,"
              + "  corpus VARCHAR(256),"
              + "  INDEX (entity),"
              + "  INDEX (annotation),"
              + "  INDEX (corpus))");

      if (wipe) statement.execute("TRUNCATE TABLE annotations");
    }

    @SuppressWarnings("resource")
    PreparedStatement insertAnnotation =
        getConnection()
            .prepareStatement(
                "INSERT INTO annotations (entity, annotation, corpus) VALUES (?, ?, ?)");
    insertAnnotation.setString(3, corpus);

    String line;
    int lineNum = 0;
    int counter = 0;

    try {
      while ((line = fileReader.readLine()) != null) {
        line = line.trim();
        if (line.length() == 0 || line.startsWith("#")) continue;

        lineNum++;
        String[] parts = line.split("\\s+", 3); // Ignore everything from the third column onwards!
        if (parts.length < 2) {
          System.err.println(
              "Ignoring line " + lineNum + ": expecting 2 columns; got " + parts.length);
          continue;
        }

        String entity = parts[0];
        if (entity.length() > 256) {
          System.err.println(
              "Ignoring line "
                  + lineNum
                  + ": can only use entities whose name does not have more than 256 characters");
          continue;
        }

        int annotationID = utils.getID(factory.getOWLClass(IRI.create(parts[1])));
        if (annotationID == -1) {
          System.err.println("Ignoring line " + lineNum + ": unknown ontology term");
          continue;
        }

        insertAnnotation.setString(1, entity);
        insertAnnotation.setInt(2, annotationID);
        insertAnnotation.addBatch();

        counter++;
        if (counter % 1000 == 0) {
          System.out.println("... " + counter + " annotations found ...");
          insertAnnotation.executeBatch();
        }
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    } finally {
      insertAnnotation.executeBatch();
      insertAnnotation.close();
    }
  }