简体   繁体   中英

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.

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.

I cant use the text/ topic api because I need to gather this information using the alpha 2/ alpha 3 code. 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" }]

When I run this query the common/topic/description field is not being populated. Is there any other way to retrieve a description of the country and filter by the alpha code 3?

You can do this using the 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.

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. Just substitute the appropriate ID into your Text API call eg

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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