2012-02-16 11 views
1

私は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? 

これらの考えられる理由何ができますか?

+0

これをGoogleに書いている場合を除き、コードにcom.google名前空間を使用しないでください。 –

答えて

3

FreebaseのAPIパッケージはGWTモジュールではないため、Javascriptに変換することはできません。そのため、「利用可能なソースコードがありません」という理由があります。サーバからFreebaseを呼び出し、結果をクライアントに送信する必要があります。

+0

それは問題になる可能性があります、私はしようとし、一日に戻って.. :) –

+0

ありがとうトン! –

+0

チェックコードの編集 –

関連する問題