We need to investigate & design a public query API. Goals for this API are:
- Easy to build queries with a variety of clients (probably JSON) without dealing with low-level issues like escaping.
- Only expose queries with reasonable resource consumption (CPU and IO, < 1 minute run time?). If this cannot be statically guaranteed, have a way to reliably kill long-running queries, ideally before they consume a lot of resources.
The Freebase API with [MQL](http://wiki.freebase.com/wiki/MQL) is already in use and seems to be useful to existing consumers. See http://www.freebase.com/query for an example query editor. With the announced integration of Freebase data into wikidata maintaining the same API sounds attractive, and could potentially let us reuse existing tools like the query editor.
Another option could be to use an existing higher-level query language like [SPARQL](http://en.wikipedia.org/wiki/SPARQL), which also has [a JSON serialization](http://www.w3.org/TR/rdf-sparql-json-res/).