Freebase PHP – building a simple query

Bart asked how I would go about “trying to query the database to find out which subdomains/types the domain computer games has?”

Here are the steps I took: (By the way, I don’t think subdomains exist)

  1. Check the steps in ‘Getting started with Freebase and PHP’
  2. On Freebase do a keyword search for ‘Computer Games
  3. The first hit is the right domain, you can see that its id is ‘/cvg’ from the URL
  4. Open the MQL Query Editor
  5. Scroll through the examples for a suitable example query.
    Choose ‘3.2.21 Types in the music domain’
  6. Change “id”:”/music” to “id”:”/cvg

So the query in Javascript is:

{
  "query":{
    "id":"/cvg",
    "type":"/type/domain",
    "types":[]
  }
}

Which translates to the following PHP:

$query = array( "type" => "/type/domain",
                 "id" => "/cvg",
                 "types" => array());

There you go!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: