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.
Related
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.
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
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.
I want to query all recipients of the Nobel Peace Prize and the date (year) from Freebase. I looked at the site, which shows me all winners, but if I do the query here, I do only get "null" results!
What I have so far:
[{
"id": "/m/05f3q",
"/award/award_category/winners": []
}]
If you look at the schema for the information that you're trying to query, you can see that what you are getting back is actually an Award Honor object which has a schema like this. It's got a bunch of different properties, but it doesn't have any meaningful name which is why it's coming back as null.
Try something more along the lines of the below (add additional properties as needed):
[{
"type": "/award/award_honor",
"award": {
"id": "/m/05f3q"
},
"award_winner": [{
"id": null,
"name": null
}],
"year": null
}]
[{
"id": "/en/nobel_prize_in_economics",
"/award/award_category/winners": [{
"/award/award_honor/award_winner": [],
"/award/award_honor/year": null,
"/award/award_honor/award": null,
"/award/award_honor/honored_for": []
}]
}]
I cannot do it in just one call, so I do the same for "/en/nobel_prize_in_physiology_or_medicine", "/en/nobel_prize_in_chemistry", "/en/nobel_peace_prize", "/en/nobel_prize_in_literature".
I'm trying to retrieve the topic description for some film ("/film/film") and film genres ("film/film_genre") in italian language.
I think the problem is the same in both cases, so I post the MQL query that I'm trying to run for the film genre description:
Mql query
[{
"type": "/film/film_genre",
"name": "Film culto",
"/common/topic/article": [{
"id": null
}]
}]
Response
{
"result": [{
"type": "/film/film_genre",
"name": "Film culto",
"/common/topic/article": [{
"id": "/m/01q0d"
}]
}]
}
With the article ID received ("/m/01q0d"), I would use the "trans/wrap" service (http://api.freebase.com/api/trans/raw/m/01q0d). However, even though I use the query parameter "lang=it", the article is in English... :(
Any suggestions? I'm going crazy :D
Freebase contains non-English names, but it doesn't, for the most part, contain descriptions in anything other than English. You could use the Topic API and get the /common/topic/topic_equivalent_webpage for the Italian Wikipedia to fetch the article/description from there, but that's probably the closest you'll get.
https://www.googleapis.com/freebase/v1/topic/m/01q03
And, as Phil said, the api.freebase.com is going away in a matter of days, so you need to be using the new APIs.