From 18a653de4d27ac79ba3ac506ea998a2301f09eea Mon Sep 17 00:00:00 2001 From: David Huynh Date: Fri, 8 Oct 2010 17:08:28 +0000 Subject: [PATCH] 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 --- .../refine/freebase/util/FreebaseUtils.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/extensions/freebase/src/com/google/refine/freebase/util/FreebaseUtils.java b/extensions/freebase/src/com/google/refine/freebase/util/FreebaseUtils.java index 739c5e3c8..90d518f8c 100644 --- a/extensions/freebase/src/com/google/refine/freebase/util/FreebaseUtils.java +++ b/extensions/freebase/src/com/google/refine/freebase/util/FreebaseUtils.java @@ -39,6 +39,9 @@ public class FreebaseUtils { 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 int SAMPLE_SIZE = 300; + static final private int JUDGES = 4; private static String getUserInfoURL(String host) { return "http://" + host + "/api/service/user_info"; @@ -148,6 +151,19 @@ public class FreebaseUtils { 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( HttpServletRequest request, String qa, @@ -183,7 +199,7 @@ public class FreebaseUtils { formparams.add(new BasicNameValuePair("mdo_guid", mdo_id)); } 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"); @@ -220,4 +236,4 @@ public class FreebaseUtils { String url = (String) ProjectManager.singleton.getPreferenceStore().get("freebase.freeq"); return url != null ? url : FREEQ_URL; } -} +} \ No newline at end of file