[Developers] Python query not working?

Chris Mahon darthmahon at gmail.com
Tue Jul 22 14:12:24 UTC 2008


Hi Chris,

This is the code. I removed the first [ bracket at the beginning/end. I'm
not at my dev box at the moment to tell you the error, will be later.

Using Django and Python 2.4 if that helps?

CODE
======
from freebase.api import HTTPMetawebSession, MetawebError

query = {  "sort": "s0:type.link.timestamp.value",
    "publisher": {
      "optional": true,
      "name": null,
      "id": null
    },
    "version_specific_name": null,
    "!q2284:\/cvg\/cvg_platform\/games_on_this_platform": [
      {
        "id": "\/en\/xbox_360"
      }
    ],
    "s0:type": [
      {
        "link": [
          {
            "timestamp": [
              {
                "type": "\/type\/datetime",
                "value": null
              }
            ],
            "type": "\/type\/link"
          }
        ],
        "type": "\/type\/type",
        "id": "\/cvg\/game_version"
      }
    ],
    "regions": [
      {
        "name": null,
        "optional": true,
        "id!=": "\/en\/xbox_360",
        "limit": 6,
        "type": "\/cvg\/computer_game_region",
        "id": null
      }
    ],
    "game": {
      "optional": true,
      "name": null,
      "id": null
    },
    "limit": 30,
    "type": "\/cvg\/game_version",
    "id": null,
    "developer": {
      "optional": true,
      "name": null,
      "id": null
    }
}

mss = HTTPMetawebSession('www.freebase.com')
result = mss.mqlread(query)

for game in result.game:
    print game

On Tue, Jul 22, 2008 at 3:00 PM, Christopher R. Maden <crism at metaweb.com>
wrote:

> Chris Mahon wrote:
> > Trying to use the query generated by this page in my Python app:
> >
> >
> http://sandbox.freebase.com/view/en/xbox_360?pid=%2Fcvg%2Fcvg_platform%2Fgames_on_this_platform
> >
> > I've clicked on Use Results, and copied the query under "See the query".
> > I copied the code on this page, but replace the query in it with the one
> > from the page above:
> >
> >
> http://code.google.com/p/freebase-python/source/browse/trunk/freebase-api/examples/get_albums.py
> >
> > I'm using freebase-python, basically just gives me a MQL error. I've
> > used the basic query that gets all of stings albums, works fine.
> >
> > Any ideas?
>
> What is the MQL error you are getting?
>
> Exactly how did you replace the query in the sample code?  Did you
> replace the entire Sting query, including the curly braces, with the
> entire Xbox query, including the square brackets?
>
> ~Chris
> --
> Christopher R. Maden
> Data Architect
> Freebase.com: <URL: http://www.freebase.com/ >
> Metaweb Technologes, Inc. <URL: http://www.metaweb.com/ >
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebase.com/pipermail/developers/attachments/20080722/68e8cc41/attachment-0001.htm 


More information about the Developers mailing list