2c8595098c
git-svn-id: http://google-refine.googlecode.com/svn/trunk@883 7d457c2a-affb-35e4-300a-418c747d4874
30 lines
684 B
JavaScript
30 lines
684 B
JavaScript
var Freebase = {};
|
|
|
|
Freebase.mqlread = function(query, options, onDone) {
|
|
var params = {};
|
|
var queryEnv = {
|
|
"query": query
|
|
};
|
|
|
|
if (options) {
|
|
for (var n in options) {
|
|
if (options.hasOwnProperty(n)) {
|
|
var v = options[n];
|
|
if (typeof v != "string") {
|
|
v = JSON.stringify(v);
|
|
}
|
|
|
|
queryEnv[n] = v;
|
|
}
|
|
}
|
|
}
|
|
|
|
params.query = JSON.stringify(queryEnv);
|
|
|
|
$.getJSON(
|
|
"http://api.freebase.com/api/service/mqlread?" + $.param(params) + "&callback=?",
|
|
null,
|
|
onDone,
|
|
"jsonp"
|
|
);
|
|
}; |