コード例 #1
0
  protected void extendRow(
      Row row, DataExtension dataExtension, int extensionRowIndex, Map<String, Recon> reconMap) {
    Object[] values = dataExtension.data[extensionRowIndex];
    for (int c = 0; c < values.length; c++) {
      Object value = values[c];
      Cell cell = null;

      if (value instanceof ReconCandidate) {
        ReconCandidate rc = (ReconCandidate) value;
        Recon recon;
        if (reconMap.containsKey(rc.id)) {
          recon = reconMap.get(rc.id);
        } else {

          if (rc.id.equals("")) {
            cell = new Cell(rc.name, null);
          } else {

            recon =
                new DBpediaDataExtensionReconConfig(new DBpediaType(rc.name, rc.id))
                    .createNewRecon(_historyEntryID);
            recon.addCandidate(rc);
            recon.service = "dbpedia-extension";
            recon.match = rc;
            recon.matchRank = 0;
            recon.judgment = Judgment.Matched;
            recon.judgmentAction = "auto";
            recon.judgmentBatchSize = 1;

            reconMap.put(rc.id, recon);
            cell = new Cell(rc.name, recon);
          }
        }

      } else {
        cell = new Cell((Serializable) value, null);
      }

      row.setCell(_firstNewCellIndex + c, cell);
    }
  }
コード例 #2
0
  protected void extendRow(
      Row row, DataExtension dataExtension, int extensionRowIndex, Map<String, Recon> reconMap) {
    Object[] values = dataExtension.data[extensionRowIndex];
    for (int c = 0; c < values.length; c++) {
      Object value = values[c];
      Cell cell = null;

      if (value instanceof ReconCandidate) {
        ReconCandidate rc = (ReconCandidate) value;
        Recon recon;
        if (reconMap.containsKey(rc.id)) {
          recon = reconMap.get(rc.id);
        } else {
          if (rc.id.equals("")) {
            cell = new Cell(rc.name, null);
          } else {
            // TODO: maybe zemanta type will be needed
            // what if there are many types? - preview links?
            // maybe recon fields have to be populated with data from results
            recon = new ZemantaDataExtensionReconConfig().createNewRecon(_historyEntryID);
            recon.addCandidate(rc);
            recon.service = "zemanta";
            recon.match = rc;
            recon.matchRank = 0;
            recon.judgment = Judgment.Matched;
            recon.judgmentAction = "auto";
            recon.judgmentBatchSize = 1;

            reconMap.put(rc.id, recon);
            cell = new Cell(rc.name, recon);
          }
        }
      } else {
        cell = new Cell((Serializable) value, null);
      }

      row.setCell(_firstNewCellIndex + c, cell);
    }
  }