Freebase Java API full text retrieval

↘锁芯ラ 提交于 2019-11-30 20:34:51

问题


Is it possible to use the "text" MQL extension with the java api, so you can get the full description text. I mean sth like this:link but for the java api.


回答1:


You can use the extended parameter in the query envelope to enable MQL extensions in your query. With the example query that Philip gave in the linked question, that would look like this:

JSON query = o(
  "id", "/en/jimi_hendrix",
  "/common/topic/article", a(o(
    "text", o(
      "maxlength", 16384,
      "chars", null
    )
  ))
);
JSON envelope = o("extended", 1);
JSON params = o();
Freebase freebase = Freebase.getFreebase();
JSON response = freebase.mqlread(query, envelope, params);
String text = response.get("result")
                      .get("/common/topic/article")
                      .get(0).get("text")
                      .get("chars")
                      .toString();

I should point out that MQL extensions are an experimental feature of the Freebase API and they are not supported in the new version of the API. The new API will provide text either through the Topic API or directly from the Text API.



来源:https://stackoverflow.com/questions/7820106/freebase-java-api-full-text-retrieval

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