A beginner's question about freebase:

I am looking for the imdb id of a movie called "O". If I use the searchbox on the freebase.com website and constrain the search by type to all:/film/film, then I get a high quality result with the best match on top:

http://www.freebase.com/search?query=o&lang=en&all=%2Ffilm%2Ffilm&scoring=entity&prefixed=true

But this does not include the imdb id. When I try to recreate and refine this search using the query editor, I can't figure out how to do a "general query". The best I could come up with was doing a fuzzy name search like this:

[{
  "type": "/film/film",
  "name": null,
  "name~=": "o",
  "imdb_id": [],
  "rottentomatoes_id": []
}]

The result contains exactly the information I want, but the movie "O" is only the 12th result in the list, buried under lots of nonsense:

http://www.freebase.com/query?lang=%2Flang%2Fen&q=[{%22type%22%3A%22%2Ffilm%2Ffilm%22%2C%22name%22%3Anull%2C%22name~%3D%22%3A%22o%22%2C%22imdb_id%22%3A[]%2C%22rottentomatoes_id%22%3A[]}]

How can I improve the quality of my result? What special magic does the "?query=o" use that "name~=":"o" does not have?

有帮助吗?

解决方案

When you use query=o, freebase does some smart sorting of the results, display exact matches first, followed by less exact matches.

With your query name ~= o you are not searching for movies with name "O", but for movies that contain "O" in their names (the ~= operator). If you want to search for a specific movie title, then specify the exact name:

[{
  "type": "/film/film",
  "name": "o",
  "imdb_id": [],
  "rottentomatoes_id": []
}]

This will result in output:

{
  "result": [{
    "imdb_id": [
      "tt0184791"
    ],
    "name": "O",
    "type": "/film/film",
    "rottentomatoes_id": [
      "o"
    ]
  }]
}

其他提示

If Search gives you the topic that you want, why not just use the output parameter to add the IMDB ID (or whatever else you want) to the output that you request it return?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top