简体   繁体   English

Freebase Java API全文检索

[英]Freebase Java API full text retrieval

Is it possible to use the "text" MQL extension with the java api, so you can get the full description text. 是否可以在Java api中使用“文本” MQL扩展名,所以您可以获得完整的描述文本。 I mean sth like this: link but for the java api. 我的意思是这样: 链接,但适用于Java api。

You can use the extended parameter in the query envelope to enable MQL extensions in your query. 您可以在查询信封中使用扩展参数来启用查询中的MQL扩展。 With the example query that Philip gave in the linked question, that would look like this: 以Philip在链接的问题中给出的示例查询为例:

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. 我应该指出,MQL扩展是Freebase API的实验功能,新版本的API不支持它们。 The new API will provide text either through the Topic API or directly from the Text API. 新的API将通过主题API或直接从文本API提供文本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM