[Developers] eMQL errors

Andi Vajda vajda at metaweb.com
Tue Jun 2 23:38:33 UTC 2009


On Tue, 2 Jun 2009, Benjamin Goldenberg wrote:

> I've been trying to write an eMQL adapter to extend /music/track to
> query LyricWiki via their REST API for song lyrics. (It seems unlikely
> that the RIAA will ever let Freebase host song lyrics, but eMQL seems
> to provide an almost as good solution.) I cloned the umql and
> stock_quote scripts from the umql acre app at
> http://acre.freebase.com/#app=/freebase/apps/umql My cloned scripts
> are at http://acre.freebase.com/#app=/user/bgoldenberg/emql I've been
> testing it using the following query:
>
> [{
>  "id": "/en/like_a_rolling_stone",
>  "/music/track/lyrics": null
> }]
>
> If I use the debug=pre option, I can see that the pre step seems to
> transform the query into a valid MQL query, but the fetch step causes
> the following cryptic error:

Your adapter seems to be returning something unexpected during the 'fetch' 
phase. I improved the error message (thanks for pointing out the oversight):

{
   "status": "400 Bad Request",
   "code": "/api/status/error",
   "messages": [{
     "code": "/api/status/error/emql",
     "message": "Parameter query: adapter 'fetch' phase failed: 'fetch' phase 
is expected to return a dict, but got an object of type unicode",
     "error": "ParameterError"}],
   "transaction_id": 
"tomcat;rooster:8118;01044;2009-06-02T23:35:05.535324Z;0002"
}

During 'fetch', your adapter is supposed to return a dict keyed on the guid
for each match passed to you:
    http://search.labs.freebase.com/api/service/emql?help#fetch
See the '/people/person/age' property adapter for an example:
    http://acre.freebase.com/#app=/user/ovalmeta/emql&file=age

Andi..

>
> {
>  "status":        "500 Server Error",
>  "code":          "/api/status/error",
>  "messages": [{
>    "code":    "/api/status/error/emql",
>    "message": "'unicode' object does not support item assignment
> Traceback (most recent call last):
>  File '/mw/vajda/mw/mwbuild/_work/relevance-trunk_2009.02.26-00.29.11/python/packages/jemql-1.0-py2.6-linux-x86_64.egg/jemql/emql.py',
> line 995, in emql_query
>    escape, lang, debug, parameter)
>  File '/mw/vajda/mw/mwbuild/_work/relevance-trunk_2009.02.26-00.29.11/python/packages/jemql-1.0-py2.6-linux-x86_64.egg/jemql/emql.py',
> line 940, in _query
>    parameter)
> ...
> }
>
> Regards,
> Ben
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>


More information about the Developers mailing list