Return notable_for in mql - freebase

My code:
[{
"id": null,
"name": null,
"/common/topic/alias": [],
"/common/topic/notable_for": [],
"limit": 100,
"type": "/sports/sport"
}]
Link
"/common/topic/alias" is returned fine however notable_for is always empty. I also tried: null, [{}], {} and /common/notable_for which gives a schema error.
How can I return the notable_for value per instance in the /sports/sport example above?

The notable_for data is computed separately from other facts in Freebase and is not accessible from the MQL API. It is however available from the Search API, the Topic API and the RDF data dumps.
Search API:
https://www.googleapis.com/freebase/v1/search?filter=(all+type:/sports/sport)&output=(/common/topic/alias)
Topic API:
https://www.googleapis.com/freebase/v1/topic/m/071k0

Related

Why does Freebase think that all wineries lack official websites?

I’m trying to query for wine producers and their websites on Freebase with this query:
[{
  "/common/topic/official_website": [],
  "id": null,
  "name": null,
  "type": "/wine/wine_producer"
}]
Here it is in the Freebase query editor:
http://www.freebase.com/query?lang=%2Flang%2Fen&q=%5B%7B%22%2Fcommon%2Ftopic%2Fofficial_website%22%3A%5B%5D%2C%22id%22%3Anull%2C%22name%22%3Anull%2C%22type%22%3A%22%2Fwine%2Fwine_producer%22%7D%5D
Why do none of the vineyards have official websites? That seems like a unlikely coincidence. Also, none of the other properties of included types have non-null values.
How do I tell Freebase to obtain the properties of included types in addition to the ones on the wine producer type itself?
False premise. 185 of them do have values for the official web site:
[{
"/common/topic/official_website": [{
"value": null
}],
"id": null,
"name": null,
"type": "/wine/wine_producer",
"return": "count"
}]
You need to forget about the notion of included types for anything related to MQL querying. MQL doesn't know and doesn't care.

/film/film/runtime always returns null

Whenever I try to query for the length of a film I get lists of null. The query I use is directly from the "Build query" button on their site and looks like this:
[{
"id": null,
"name": null,
"type": "/film/film",
"/film/film/runtime": []
}]
Ufortunately all the responses I get look like this:
{
"name": "4D Man",
"type": "/film/film",
"/film/film/runtime": [
null
],
"id": "/en/4d_man"
}
I can hover over the links you can see on the query page and see the runtime (in this case 85 minutes) but as you can see all I get from the query is null. This may be a Freebase bug, but any help is appreciated. Thank you.
There's not a single runtime of a film, the same film can have different runtimes (original version, director's cut, etc...) Freebase use the film_cut type to contain the different runtimes of a movie
You can use this query to get the runtimes:
[{
"id": null,
"name": null,
"/film/film/runtime": [{
"runtime": null
}]
}]
Tune this query to your needs, you may need type_of_film_cut or film_release_region.

freebase mql - notable_types empty?

I am sending the following mql query to get a list of topics, their mids and "notable types", but in the results notable types are always empty.
[{
"name": "The beatles",
"/common/topic/notable_types": [], //also tried "null"
"mid": null,
"limit": 10
}]
But this is inconsistent with the online freebase. For example, the query returns
{
"mid": "/m/07c0j",
"/common/topic/notable_types": [],
"name": "The Beatles"
},
And by checking the webpage "http://www.freebase.com/m/07c0j" you can see it has a notable type of "music artist".
Any suggestions if I have used wrong query or anything to do with the freebase database?
Many thanks!
They should really return on error on this query. Notably types isn't available through the MQL API -- only the Topic API.

Freebase MQL Query

I have a couple of questions.
I have a MQL query that gets some movie information. The trimmed query looks like this.
[{
"id": "/en/a_beautiful_mind",
"name": null,
"type": "/film/film",
"/common/topic/article": [{
"id": null,
"optional": true,
"limit": 3
}]
}]
it works just fine, I can retrieve the ID but is there a way to also get the article text without having to run a separate text query?
Second is I am trying to figure out how to get the featured song performer. I can do this and get the songs name.
[{
"id": "/en/a_beautiful_mind",
"name": null,
"type": "/film/film",
"featured_song": [{
"name": null,
"optional": true
}],
}]
But cant seem to figure out how to get the songs performer. Is it possible?
thanks for the help
Scott
One simple way to get this type of information about a film is to use the Topic API like this:
https://www.googleapis.com/freebase/v1/topic/en/a_beautiful_mind?filter=suggest&filter=/film/film
This won't get the featured song artist though. At least not without an additional API call. To do that in MQL you just nest additional queries inside the featured song like this:
[{
"id": "/en/a_beautiful_mind",
"name": null,
"type": "/film/film",
"featured_song": [{
"name": null,
"/music/recording/artist": [{}],
"/film/film_featured_song/performed_by": [{}],
"optional": true
}]
}]
Note that I've added two separate properties one for the artist who originally recorded the song and one for the artist who performed it in the film. In this case, the second property is empty implying that the original recording was used. Since I'm mixing properties from different types I need to use the fully-qualified property names.
All Freebase types are documented in the graph so you can look up types like /music/recording and /film/film_featured_song to see how they are meant to be used.

Freebase MQL Query print article?

here's my query:
[{
"type": "/tv/tv_series_episode",
"series": "The Simpsons",
"guest_stars": [{
"actor": {
"/common/topic/article": [{
"id": null,
"optional": true,
"limit": 3
}],
"name": null
}
}]
}]
Freebase is returning an id for the article such as: id: "/m/0sw7x", how would I print this ID. I've read that you have to use a "trans" service but I'm not exactly sure how to do this...
The trans service is actually pretty simple to use. You just append that ID to the end of a GET request and it sends back the article content like this:
http://api.freebase.com/api/trans/raw/m/0sw7x
I gave a more detailed explanation to a similar question here.
Or you can fetch the article directly with MQL as detailed in my answer to the question narphorium's pointed at.

Resources