Freebase MQL query for topic summary and image?
Asked Answered
G

2

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"
  }
]
Grethel answered 24/3, 2009 at 5:1 Comment(2)
Wow, it's actually called "Freebase?"Acoustic
Yes and it's pretty coolGrethel
H
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.

Hypogeum answered 24/3, 2009 at 5:53 Comment(2)
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!Grethel
@Shawn Does this answer stand right as of 2012? Is the Image Service recommended over this?Schelling
V
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

Virginia answered 24/2, 2013 at 7:46 Comment(1)
https://usercontent.googleapis.com/freebase/v1/image/en/bill_gates?maxwidth=225&maxheight=225&mode=fillcropmid The default image is rather small.Griseldagriseldis

© 2022 - 2024 — McMap. All rights reserved.