The class I copied over from main/ was not up to date yesterday. It missed Stefano's latest changes. So I copied the latest version from svn/main/ here and check it in.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1456 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
142591a090
commit
18a653de4d
@ -39,6 +39,9 @@ public class FreebaseUtils {
|
|||||||
static final private String FREEQ_URL = "http://data.labs.freebase.com/freeq/refine";
|
static final private String FREEQ_URL = "http://data.labs.freebase.com/freeq/refine";
|
||||||
|
|
||||||
static final private String AGENT_ID = "/en/google_refine";
|
static final private String AGENT_ID = "/en/google_refine";
|
||||||
|
|
||||||
|
static final private int SAMPLE_SIZE = 300;
|
||||||
|
static final private int JUDGES = 4;
|
||||||
|
|
||||||
private static String getUserInfoURL(String host) {
|
private static String getUserInfoURL(String host) {
|
||||||
return "http://" + host + "/api/service/user_info";
|
return "http://" + host + "/api/service/user_info";
|
||||||
@ -148,6 +151,19 @@ public class FreebaseUtils {
|
|||||||
return EntityUtils.toString(httpResponse.getEntity());
|
return EntityUtils.toString(httpResponse.getEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getTweezersParams(int sample_size, int judges) {
|
||||||
|
String o = "{" +
|
||||||
|
"'sample_size':" + sample_size + "," +
|
||||||
|
"'votes':{" +
|
||||||
|
"'reconciled':" + judges + "," +
|
||||||
|
"'invalid':" + judges + "," +
|
||||||
|
"'new':" + judges + "," +
|
||||||
|
"'skip':" + (judges + 2) +
|
||||||
|
"}" +
|
||||||
|
"}";
|
||||||
|
return o.replace('\'', '"');
|
||||||
|
}
|
||||||
|
|
||||||
public static String uploadTriples(
|
public static String uploadTriples(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
String qa,
|
String qa,
|
||||||
@ -183,7 +199,7 @@ public class FreebaseUtils {
|
|||||||
formparams.add(new BasicNameValuePair("mdo_guid", mdo_id));
|
formparams.add(new BasicNameValuePair("mdo_guid", mdo_id));
|
||||||
}
|
}
|
||||||
if (Boolean.parseBoolean(qa)) {
|
if (Boolean.parseBoolean(qa)) {
|
||||||
formparams.add(new BasicNameValuePair("rabj", "true"));
|
formparams.add(new BasicNameValuePair("rabj", getTweezersParams(SAMPLE_SIZE,JUDGES)));
|
||||||
}
|
}
|
||||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
|
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
|
||||||
|
|
||||||
@ -220,4 +236,4 @@ public class FreebaseUtils {
|
|||||||
String url = (String) ProjectManager.singleton.getPreferenceStore().get("freebase.freeq");
|
String url = (String) ProjectManager.singleton.getPreferenceStore().get("freebase.freeq");
|
||||||
return url != null ? url : FREEQ_URL;
|
return url != null ? url : FREEQ_URL;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user