简体   繁体   English

Freebase MQL查询可通过Alpha 3代码检索国家/地区描述

[英]Freebase MQL query to retrieve country description by alpha 3 code

I have been trying to come up with the appropriate MQL query to retrieve country description like how the text api does it. 我一直在尝试提出适当的MQL查询来检索国家/地区描述,例如文本api的操作方式。

https://www.googleapis.com/freebase/v1/text/en/jamaica https://www.googleapis.com/freebase/v1/text/en/jamaica

result from that call. 通话结果。

"result": "Jamaica (/dʒəˈmeɪkə/), officially the Commonwealth of Jamaica, is an island nation of the Greater Antilles, 234 kilometres (145 mi) in length, up to 80 kilometres (50 mi) in width, and 10,990 square kilometres (4,240 sq mi) in area. “结果”:“牙买加(/ dʒəˈmeɪkə /),正式为牙买加联邦,是大安的列斯群岛的一个岛国,全长234公里(145英里),宽达80公里(50英里),面积为10,990平方公里平方公里(4,240平方英里)。

I cant use the text/ topic api because I need to gather this information using the alpha 2/ alpha 3 code. 我无法使用text / topic api,因为我需要使用alpha 2 / alpha 3代码收集此信息。 This is my attempt at making the query. 这是我进行查询的尝试。

[{ "id": null, "name": null, "/common/topic/description": null, "type": "/location/country", "/location/country/iso_alpha_3": "USA" }] [{{“ id”:null,“ name”:null,“ / common / topic / description”:null,“ type”:“ / location / country”,“ / location / country / iso_alpha_3”:“美国”}]

When I run this query the common/topic/description field is not being populated. 当我运行此查询时,不会填充common / topic / description字段。 Is there any other way to retrieve a description of the country and filter by the alpha code 3? 还有其他方法可以检索国家/地区的描述并按字母代码3进行过滤吗?

You can do this using the Freebase Topic API : 您可以使用Freebase Topic API来做到这一点:

https://www.googleapis.com/freebase/v1/topic/authority/iso/3166-1/alpha-3/JAM?filter=/common/topic/description

Please make sure that you give proper attribution to the source as specified in the API response. 请确保您按照API响应中的说明正确归属了来源。

The ISO country codes are registered in namespaces rooted at /authority and those identifiers can be used interchangeably with identifiers from the /en or /m namespaces. ISO国家/地区代码在以/ authority为根的命名空间中注册,并且这些标识符可以与/ en或/ m命名空间中的标识符互换使用。 Just substitute the appropriate ID into your Text API call eg 只需将适当的ID替换为您的Text API调用即可,例如

https://www.googleapis.com/freebase/v1/text/authority/iso/3166-1/alpha-3/USA https://www.googleapis.com/freebase/v1/text/authority/iso/3166-1/alpha-3/USA

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

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