Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Freebase MQL query for topic summary and image?

Tags:

freebase

mql

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"
  }
]
like image 878
Eric Schoonover Avatar asked Mar 24 '09 05:03

Eric Schoonover


2 Answers

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.

like image 60
Shawn Simister Avatar answered Nov 12 '22 14:11

Shawn Simister


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

like image 32
vikasing Avatar answered Nov 12 '22 15:11

vikasing