7

I'm trying to write an MQL query to be executed using Freebase API's. I would like to retrieve the topic summary and the image for the topic.

I have been able to work out the below query which will get me the images associated with the Bill Gates topic.

MQL:

[
  {
    "/common/topic/image" : [
      {
        "id" : null
      }
    ],
    "name" : "bill gates",
    "type" : "/people/person"
  }
]

Results:

[
  {
    "/common/topic/image" : [
      {
        "id" : "/guid/9202a8c04000641f8000000004fb4c01"
      },
      {
        "id" : "/wikipedia/images/commons_id/4486276"
      }
    ],
    "name" : "Bill Gates",
    "type" : "/people/person"
  }
]

For those that may have not run into MQL in the past but are interested in playing around with it. Check out the Freebase MQL Query Editor.

billg profile page http://i.friendfeed.com/c31a22d9e439eb67b0feeb4ffd64c3b5ed9a8e16

UPDATE

Query that I ended up using:

[
  {
    "/common/topic/image" : [
      {
        "id" : null
      }
    ],
    "article" : [
      {
        "content" : null
      }
    ],
    "name" : "bill gates",
    "type" : "/common/topic"
  }
]

These results can be combined with narphorium's answer to retrieve the actual data:

[
  {
    "/common/topic/image" : [
      {
        "id" : "/guid/9202a8c04000641f8000000004fb4c01"
      },
      {
        "id" : "/wikipedia/images/commons_id/4486276"
      }
    ],
    "article" : [
      {
        "content" : null
      },
      {
        "content" : "/guid/9202a8c04000641f800000000903535d"
      }
    ],
    "name" : "Bill Gates",
    "type" : "/common/topic"
  }
]
Eric Schoonover
  • 47,184
  • 49
  • 157
  • 202

2 Answers2

10

The images and topic summaries are stored separately in the content store and are accessible via another web service API.

For example, Bill Gates' image can be accessed like this:

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

Similarly, the GUID for the topic summary can be found by replacing /common/topic/image with /common/topic/article in your query. The results can be accessed again like this:

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

You can read more about the content store here.

Shawn Simister
  • 4,613
  • 1
  • 26
  • 31
  • funny, I aluded to the content store in my question (removed in edit cause your answer is better). But I thought it was only for the images. I ended up testing for the actual article/content and found that it also was returned but your answer describes it better than I did. Thanks! – Eric Schoonover Mar 24 '09 at 06:24
  • @Shawn Does this answer stand right as of 2012? Is the Image Service recommended over this? – Suraj Chandran Nov 15 '12 at 18:41
6

The new image service provided by freebase can now be used to get the images using the freebase ids, e.g., for Bill Gates following is the image URL:

https://usercontent.googleapis.com/freebase/v1/image/en/bill_gates

More about this service can be found at: http://wiki.freebase.com/wiki/Image_Service

vikasing
  • 11,562
  • 3
  • 25
  • 25
  • 2
    `https://usercontent.googleapis.com/freebase/v1/image/en/bill_gates?maxwidth=225&maxheight=225&mode=fillcropmid` The default image is rather small. – Xeoncross Feb 19 '14 at 20:01