Source: site.view [edit]
Function name: freebase
Arguments: query
Description: Returns results from a Freebase MQL query in XML
Page type: webl
Render function:  
Module: global

Page source:

var apiKey = "AIzaSyCJGQ18-gCf-OOlYRXsIalSiDqhq9dDNy4";
var u = "https://www.googleapis.com/freebase/v1/mqlread";
var cursor = "";
var table = "freebase";

Wub_DeleteData(table);
Wub_AppendData(table, `<?xml version="1.0" encoding="ISO-8859-1"?>` + "\n");
Wub_AppendData(table, "<results>\n");

var i = 0;
var cursorExists = true;
while cursorExists do // and (i < 300) do
   var P = GetURL(u, [. "key" = apiKey, query=query, cursor=cursor .]);
   if (Size(Elem(P, "cursor")) > 0) then
      cursor = Str_Trim(Text(Elem(P, "cursor")[0]));
      cursorExists = (cursor != "") and (cursor != "false");
   end;
   
   var res = "";
   every result in Elem(P, "result") do
     res = res + Markup(result) + "\n";
     i = i + 1;
   end;
     
   Wub_AppendData(table, res);
end;
Wub_AppendData(table, "</results>\n");
  
Wub_ReadData(table);