Issue 328 - don't retry unsuccessful MQL key based reconciliation

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1997 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2011-02-04 00:56:31 +00:00
parent 1df3348b52
commit cccfbf9ad8

View File

@ -178,36 +178,38 @@ public class KeyBasedReconConfig extends StrictReconConfig {
try { try {
String s = ParsingUtilities.inputStreamToString(is); String s = ParsingUtilities.inputStreamToString(is);
JSONObject o = ParsingUtilities.evaluateJsonStringToObject(s); JSONObject o = ParsingUtilities.evaluateJsonStringToObject(s);
JSONArray results = o.getJSONArray("result"); if (o.has("result")) {
int count = results.length(); JSONArray results = o.getJSONArray("result");
int count = results.length();
for (int i = 0; i < count; i++) {
JSONObject result = results.getJSONObject(i); for (int i = 0; i < count; i++) {
JSONObject result = results.getJSONObject(i);
String key = result.getJSONArray("key").getJSONObject(0).getString("value");
String key = result.getJSONArray("key").getJSONObject(0).getString("value");
JSONArray types = result.getJSONArray("type");
String[] typeIDs = new String[types.length()]; JSONArray types = result.getJSONArray("type");
for (int j = 0; j < typeIDs.length; j++) { String[] typeIDs = new String[types.length()];
typeIDs[j] = types.getString(j); for (int j = 0; j < typeIDs.length; j++) {
} typeIDs[j] = types.getString(j);
}
ReconCandidate candidate = new ReconCandidate(
result.getString("id"), ReconCandidate candidate = new ReconCandidate(
result.getString("name"), result.getString("id"),
typeIDs, result.getString("name"),
100 typeIDs,
); 100
);
Recon recon = Recon.makeFreebaseRecon(historyEntryID);
recon.addCandidate(candidate); Recon recon = Recon.makeFreebaseRecon(historyEntryID);
recon.service = "mql"; recon.addCandidate(candidate);
recon.judgment = Judgment.Matched; recon.service = "mql";
recon.judgmentAction = "auto"; recon.judgment = Judgment.Matched;
recon.match = candidate; recon.judgmentAction = "auto";
recon.matchRank = 0; recon.match = candidate;
recon.matchRank = 0;
keyToRecon.put(key, recon);
keyToRecon.put(key, recon);
}
} }
} finally { } finally {
is.close(); is.close();
@ -215,10 +217,17 @@ public class KeyBasedReconConfig extends StrictReconConfig {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
for (int i = 0; i < jobs.size(); i++) { for (ReconJob job : jobs) {
String key = ((KeyBasedReconJob) jobs.get(i)).key; String key = ((KeyBasedReconJob) job).key;
Recon recon = keyToRecon.get(key); Recon recon = keyToRecon.get(key);
if (recon == null) { // add a no-match recon if none
recon = Recon.makeFreebaseRecon(historyEntryID);
recon.service = "mql";
recon.judgment = Judgment.None;
recon.matchRank = -1;
keyToRecon.put(key, recon);
}
recons.add(recon); recons.add(recon);
} }