Developer Documentation

Developer Tools

Query Editor App Editor Schema Explorer

Content Data

Freebase containts information about topics, their relationships and values of their properties, but it can also contain information such as markup descriptions and binary files (such as multimedia objects like images, sounds or videos) that can occupy a lot of space.

For this reason, such heavier pieces of information are stored in a different content store and can be retrieved by their GUID thru additional web services.

How to get topic descriptions

Every topic can have an article associated to it of type document. The content of such 'documents' can be obtained by using the content fetching services.

Let's see how this works in practice by looking up the textual description for Barack Obama.

First we run a MQL query to obtain the identifier of the articles associated to the topic we want:

[{
  "id": "/en/barack_obama",
  "/common/topic/article": [{
    "id": null
  }]
}]

running this query returned something like this:

{
    "status": "200 OK",
    "code": "/api/status/ok",
    "result": [{
        "id": "/en/barack_obama",
        "/common/topic/article": [{
            "id": "/guid/9202a8c04000641f800000000029c281"
          },{
            "id": "/guid/9202a8c04000641f8000000005b78173"
        }]
    }]
}

which indicates there are actually two articles about Obama in Freebase. To obtain the content of that article we get the article identifier and fetch its content with the trans services, like this:

http://www.freebase.com/api/trans/raw/guid/9202a8c04000641f800000000029c281

which returns the following text:

Barack Hussein Obama II (pronounced /bəˈrɑːk huːˈseɪn oʊˈbɑːmə/; born August 4, 1961) is the 44th and current President of the United States. He is the first African American to hold the office. Obama was the junior United States Senator from Illinois from January 2005 until November 2008, when he resigned after his election to the presidency. Obama is a graduate of Columbia University and Harvard Law School, where he was the first African American president of the Harvard Law Review. He was a community organizer in Chicago before earning his law degree. He worked as a civil rights attorney in Chicago and also taught constitutional law at the University of Chicago Law School from 1992 to 2004. Obama served three terms in the Illinois Senate from 1997 to 2004. Following an unsuccessful bid for a seat in the U.S. House of Representatives in 2000, Obama ran for United States Senate in 2004. His victory, from a crowded field, in the March 2004 Democratic primary raised his visibility. His prime-time televised keynote address at the Democratic National Convention in July 2004 made him a rising star nationally in the Democratic Party. He was elected to the U.S. Senate in November 2004 by

For more information on this service see here.

How to get images for topics

A similar procedure can be used to obtain images about a topic. First we get the image IDs with a MQL query, like this:

[{
  "id": "/en/barack_obama",
  "/common/topic/image": [{
    "id": null
  }]
}]

which returns something like this

 {
  "status": "200 OK",
  "code": "/api/status/ok",
  "result": [{
    "id": "/en/barack_obama",
    "/common/topic/image": [{
        "id": "/wikipedia/images/commons_id/14528216"
      },{
        "id": "/guid/9202a8c04000641f80000000082f7a5d"
      },{
        "id": "/guid/9202a8c04000641f80000000090bab60"
      },{
        "id": "/wikipedia/images/commons_id/5767332"
    }]
  }]
}

then we obtain the picture by using the same trans/get service we used before.

http://www.freebase.com/api/trans/raw/guid/9202a8c04000641f80000000082f7a5d

The image above is really big (4800x6000 pixels!) and that might not be suitable for our purposes. Freebase offers another service that can generate an smaller version of that image on the fly, like this:

http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f80000000082f7a5d?maxwidth=100

For more information about the image thumbnailing service, see here.