【问题标题】:Freebase Java API full text retrievalFreebase Java API 全文检索
【发布时间】:2011-11-07 15:05:29
【问题描述】:

是否可以将“文本”MQL 扩展与 java api 一起使用,以便获得完整的描述文本。 我的意思是这样的:link 但对于 java api。

【问题讨论】:

    标签: java freebase mql


    【解决方案1】:

    您可以使用查询信封中的 extended 参数在您的查询中启用 MQL 扩展。使用 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();
    

    我应该指出,MQL 扩展是 Freebase API 的一项实验性功能,新版本的 API 不支持它们。新 API 将通过 Topic API 或直接从 Text API 提供文本。

    【讨论】:

    • 你能告诉我为什么我无法检索某些主题的信息(文本)(例如“泰晤士河”),而我可以检索属于同一类别的其他主题(例如 Docklands )?? 其他查询也会发生同样的情况,例如地理位置(纬度/经度)..
    • 您能分享您正在使用的确切查询吗?我能够在没有任何问题的情况下获得“泰晤士河”: JSON query = o( "id", "/en/river_thames", "/common/topic/article", a(o( "text", o( "最大长度", 16384, "字符", null ) )) );
    • 是的,您对文本的看法是对的,但地理位置呢?这不仅仅是 Java 问题:tinyurl.com/6d3fj9e
    • 简短的回答是尚未输入泰晤士河的纬度/经度。如果您想要更详细的答案,请将此作为单独的问题重新发布。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-08
    • 1970-01-01
    • 2011-12-19
    相关资源
    最近更新 更多