[Developers] Freebase and Yahoo Pipes
Tim Sturge
tsturge at metaweb.com
Sat Jan 19 00:38:13 UTC 2008
This is an envelope problem; in mqlread the queries= parameter takes a set of queries which are each of the form you have. So you need something like
{"q1":{"query":[{"alias":"CPU","name":null,"type":"/common/topic"}]}}
which says that there is only one query and it takes no additional parameters (like a cursor, or a change in the default language.)
If you escape that you should be fine.
Tim
----- Original Message -----
From: "Shawn Simister" <narphorium at gmail.com>
To: "For discussions about MQL, Freebase API and apps built on Freebase" <developers at freebase.com>
Sent: Friday, January 18, 2008 4:22:11 PM (GMT-0800) America/Los_Angeles
Subject: [Developers] Freebase and Yahoo Pipes
I'd like to use Freebase data in a Yahoo pipes mashup but Pipes seems to
be having trouble passing a valid query envelope to the read service. In
my pipe, I'd like to execute the following query on Freebase.
{"query":[{"alias":"CPU","name":null,"type":"/common/topic"}]}
So I build a URL that points to the read service and passes the query
envelope via the queries parameter. This gives me the following URL in
Yahoo Pipes.
http://www.freebase.com/api/service/mqlread?queries=%7B%22query%22%3A%5B%7B%22alias%22%3A%22CPU%22%2C%22name%22%3Anull%2C%22type%22%3A%22%2Fcommon%2Ftopic%22%7D%5D%7D
When I try to fetch that URL, Freebase returns the following error.
{
"status": "200 OK",
"query": {
"code": "/api/status/error",
"messages": [
{
"info": {},
"message": "Query envelope must be a dictionary",
"code": "/api/status/error/envelope/parse"
}
]
},
"code": "/api/status/ok"
}
I suspect that this is happening because Freebase doesn't like having
all the non-alphanumeric characters escaped. This is reinforced by the
fact that I can get the desired results by fetching the following URL
directly from my web browser.
http://www.freebase.com/api/service/mqlread?queries={%22query%22%20:%20[{%22alias%22%20:%20%22CPU%22,%22name%22%20:%20null,%22type%22%20:%20%22/common/topic%22}]}
Unfortunately, Yahoo Pipes seems to insist on escaping everything in the
URLs that it fetches so I'm stuck. Would it be possible for Freebase to
support fully escaped query envelopes? Alternately, is there anyone who
has been able to successfully mashup Freebase data in Pipes?
Thanks,
Shawn
_______________________________________________
Developers mailing list
Developers at freebase.com
http://lists.freebase.com/mailman/listinfo/developers
More information about the Developers
mailing list