コード例 #1
0
ファイル: AanLoader.java プロジェクト: memray/ACMParser
  public void load() throws IOException, SQLException {
    conn = Mysql.getConn("semsearch");
    List<String> lines = FileUtils.readLines(new File(this.filePath));
    AANPaper paper = new AANPaper();
    for (int i = 0; i < lines.size(); i++) {
      String line = lines.get(i).trim();
      if (line.equals("")) {
        process(paper);
      }
      if (line.startsWith("id")) {
        paper = new AANPaper();
        String temp = StringUtils.substringAfter(line, "{").trim();
        temp = StringUtils.substringBeforeLast(temp, "}");
        paper.setId(temp);
      } else if (line.startsWith("author")) {
        String temp = StringUtils.substringAfter(line, "{").trim();
        temp = StringUtils.substringBeforeLast(temp, "}");
        paper.setAuthor(temp);
      } else if (line.startsWith("title")) {
        String temp = StringUtils.substringAfter(line, "{").trim();
        temp = StringUtils.substringBeforeLast(temp, "}");
        paper.setTitle(temp);
      } else if (line.startsWith("venue")) {
        String temp = StringUtils.substringAfter(line, "{").trim();
        temp = StringUtils.substringBeforeLast(temp, "}");
        paper.setVenue(temp);
      } else if (line.startsWith("year")) {
        String temp = StringUtils.substringAfter(line, "{").trim();
        temp = StringUtils.substringBeforeLast(temp, "}");
        paper.setYear(temp);
      }

      System.out.println(line);
    }
  }