我正在開發一個GWT應用程序以從Freebase獲取查詢結果。這是我的EntryPoint類的代碼。在Java中使用Freebase API
package com.google.tracker.client;
import com.freebase.api.Freebase;
import com.freebase.json.JSON;
import com.google.gwt.core.client.EntryPoint;
public class Tracker implements EntryPoint{
public void onModuleLoad() {
Freebase freebase = Freebase.getFreebase();
String query_str = "{" +
"'id': null," +
"'type': '/film/film'," +
"'name': 'Blade Runner'," +
"'directed_by': [{" +
"'id': null," +
"'name': null" +
"}]" +
"}".replace('\'', '"');
JSON query = new JSON(query_str);
JSON result = freebase.mqlread(query);
@SuppressWarnings("unused")
String director = result.get("result").get("directed_by").get(0).get("name").string();
}
}
我收到以下錯誤:
[ERROR] Line 10: No source code is available for type com.freebase.api.Freebase; did you forget to inherit a required module?
[ERROR] Line 21: No source code is available for type com.freebase.json.JSON; did you forget to inherit a required module?
可能是什麼,這些可能的原因是什麼?
除非您正在爲Google編寫此代碼,否則您不應該在代碼中使用com.google命名空間。 – 2012-02-18 16:20:31