How to gather Freebase Aliases for type location/location?

226 views Asked by At

I'd like to pull information (MID and US English name) about all locations in Freebase AND also their Korean names and any Korean aliases via an MQL query. This is as far as I've gotten:

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

I'm only getting the Korean name, but not any Korean aliases. I don't know how to write a query that outputs properties of 2 different types in the same query. Can you get data about both /location/location AND common/topic/alias for the same entity in the same MQL query/output? Is my approach just wrong here?

Any help appreciated.

1

There are 1 answers

2
Shawn Simister On

When you need to combine properties from many different types you need to use the fully qualified property ID like this:

[{
  "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
  }]
}]

Whenever you use shortened property IDs they are assumed to be in the same type as the type you specify in your query (or /type/object if no type is given). So for example, if you were to use "geolocation" in your query it would be interpreted as "/location/location/geolocation". The only excepts are "id", "name" and "type" which you can use without using the full IDs eg. "/type/object/name".

You'll also note that I made aliases "optional" so that it would return results for locations that don't have any aliases.