Search code examples
freebase

Freebase query for full topic summary


I'm trying to retrieve the full topic description/summary for some Freebase articles. I have been using the Freebase topic API, which returns this type of results: http://www.freebase.com/experimental/topic/standard?id=/en/jimi_hendrix

But I notice that the description is not complete and ends with "...". Is there a way to use some Freebase API to obtain the article's full description?

Does Freebase even store the complete description or does it just stores a portion of the description from Wikipedia?


Solution

  • Freebase just stores a portion of the Wikipedia description but there is usually more than what's given by the topic API.

    To get the "full" text for a Wikipedia blurb associated with a Freebase topic you first need to query the Read API for a list of related articles like this:

    {
      "id": "/en/jimi_hendrix",
      "/common/topic/article": [{}]
    }​
    

    Try it in the Query Editor

    Then choose one or more of the articles that it returns and feed its ID into the /trans/raw API like this:

    http://api.freebase.com/api/trans/raw/m/043dz
    

    You'll notice that the blurb of text that gets returned is a bit longer (1200 chars) and doesn't have the "..." but its still chopped off at the end.

    When I display Freebase topic descriptions in a web page I have some code to clean it up before hand. I split it apart into paragraphs by looking for newlines and then if the last paragraph doesn't end with a period, exclamation mark or question mark I just throw away that paragraph. The way the Wikipedia blurbs are written, you usually only need the first paragraph anyways.