【问题标题】:How to gather Freebase Aliases for type location/location?如何为类型位置/位置收集 Freebase 别名?
【发布时间】:2013-12-10 00:01:13
【问题描述】:

我想通过 MQL 查询获取有关 Freebase 中所有位置的信息(MID 和美国英文名称)以及它们的韩文名称和任何韩文别名。这是据我所知:

[{
"id": null,
"name": null,
"mid": null,
"type": "/location/location",
"Korean:name": [{
"lang": "/lang/ko",
"value": null
}]
}]

我只得到韩文名字,但没有韩文别名。我不知道如何编写在同一查询中输出 2 种不同类型的属性的查询。您能否在同一个 MQL 查询/输出中获得有关同一实体的 /location/location 和 common/topic/alias 的数据?我的方法在这里错了吗?

任何帮助表示赞赏。

【问题讨论】:

    标签: freebase mql


    【解决方案1】:

    当您需要组合多种不同类型的属性时,您需要使用完全限定的属性 ID,如下所示:

    [{
      "id": null,
      "name": null,
      "mid": null,
      "type": "/location/location",
      "Korean:name": [{
        "lang": "/lang/ko",
        "value": null
      }],
      "/common/topic/alias": [{
        "lang": "/lang/ko",
        "value": null,
        "optional": true
      }]
    }]
    

    当您使用缩短的属性 ID 时,它们被假定为与您在查询中指定的类型相同的类型(或 /type/object,如果没有给出类型)。例如,如果您要在查询中使用“地理位置”,它将被解释为“/location/location/geolocation”。唯一的例外是“id”、“name”和“type”,您可以在不使用完整 ID 的情况下使用它们,例如。 “/类型/对象/名称”。

    您还会注意到,我将别名设置为“可选”,以便返回没有任何别名的位置的结果。

    【讨论】:

    • 太棒了!感谢您的示例和解释。为了回答我的下一个问题:如何确保返回没有指定语言别名的位置的结果!
    • optional: "true" 添加到Korean:name/common/topic/alias
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-16
    • 2012-04-22
    • 1970-01-01
    相关资源
    最近更新 更多