Using Freebase API in Java

怎甘沉沦 提交于 2019-12-13 19:43:22

问题


I am developing a GWT application to get the query results from the Freebase. This is the code of my EntryPoint class.

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();
    }
}

I am getting following errors :

[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?

What could be the possible reasons for these?


回答1:


Freebase's API package is not a GWT module and as such can't be translated to Javascript. That's why there's "No source code available". You need to make the call to Freebase from the server and send the results down to the client.



来源:https://stackoverflow.com/questions/9311438/using-freebase-api-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!