LISBON 10-12
APRIL 2014
LISBON 10-12
APRIL 2014

Edit your talk

Talks > MQL-to-SQL: a JSON-based query language for RDBMS access from AJAX applications


This talk has been approved for this year's edition. Check the calendar for more information.




MQL-to-SQL is an Open Source project allowing you to query a RDBMS over HTTP using MQL (Metaweb Query Language). MQL was designed for, but there are very good reasons to want something like MQL as a RDBMS query language as well. This talk explains what MQL is, how it compares to SQL, why it's great for AJAX apps, and how MQL-to-SQL allows you to query popular RDBMS-es (like MySQL)

Past year, I got interested in Freebase and its query language, MQL. In my opinion, MQL is an interesting database query language in general, and a number of features make it downright excellent for implementing secure but flexible access to relational databases over the web, especially for modern (AJAX) web applications - better than SQL.

I created an implementation dubbed MQL-to-SQL, which is available at "": under the terms of the LGPL. It's basically a PHP script that supports the the protocol of the freebase MQL-read webservice. It abstracts data access using PDO, and I have working examples for the sakila sample database working on SQlite, MySQL, Postgres (pagila) and Oracle. For sample queries, see "the project wiki": To kickstart it without downloading and installing, try them in "the online demo":

In this 45-minute session, I want to explain how MQL works and why it is a great solution to solve the RDBMS access problem for modern (AJAX) web applications. In addition, I will explain how I implemented MQL-to-SQL, and how it translates MQL queries to SQL queries, executes them and returns the result document. Time permitting I will show what the advantage is for the web-client (as compared to being limited to tabular results returned by SQL queries)

*Solving the data access problem in Web vs client-server applications:*

* How web applications typically use a purpose-built REST or RPC style webservice and a data format like XML or JSON to access and manipulate data over HTTP
* How by contrast, client-server applications typically use a query language like SQL instead of a purpose-built service protocol
* How this relates to so-called document-based queries and results in NoSQL solutions like CouchDB and MongoDB

*The problem with SQL from the perspective of a web applications*

* Why you don't very often see a webservice that accepts SQL queries
* How to integrate SQL with your application language, and how ORMs make it even worse (yes!)

*The MQL query language*

* Some background on freebase, for which MQL was designed
* Syntax of MQL queries and results, with examples (hello world and beyond)
* SQL vs MQL: what is similar, what is not; what are the respective strengths and weaknesses and how does that translate to particular use-cases

*Why MQL is a great solution for modern (AJAX) web applications:*

* accessible through a webservice, but because it is a query language, it is inherently flexible, and you don't need a purpose-built webservice.
* Application language integration: both queries and results are JSON-based, which is easily processed and generated by JavaScript, which is the de-facto client side and emerging server-side scripting language for web applications
* Query by example and Query/Result symmetry: in MQL, generating new queries from previously returned results is trivial. This is very unlike the SQL case, where the language is an algebra, but the result is pure data.
* without compromising flexibility, MQL is much easier to secure than SQL

*MQL-to-SQL: an open source MQL implementation for your RDMS*

* concepts: mapping MQL to SQL and relational results to result documents
* implementation: PHP, PDO
* how to get started with MQL-to-SQL using your favorite RDBMS

Proposal date

2011-08-11 07:26:40

Rate & Comment

You can use this section to optionally comment on this talk (comments are public). Your comment is saved when you press the "comment" button at the bottom. Your thumb decision is private, no one will see it. You can change thumb decision at any time later, the last submission will prevail. You can post as many comments as you want.

You need to be registered and logged in to comment or rate this talk proposal.


Nelson Neves
on , said:

This looks pretty interesting, would love to see this!

$geekfactor 0x0

Melanie Valente
on , said:

thumbs up.

$geekfactor 0x0

Humberto Carvalho
on , said:

interesenting =D

$geekfactor 0x0

Bruno Furtado
on , said:

really complete talk description... looking forward

$geekfactor 0x0

André Ernesto Gonçalves
on , said:

hope to see this!

$geekfactor 0x0

Pedro Borges
on , said:

This has a lot of potential. Thumbs Up. :)

$geekfactor 0x0

Márcio Moreira
on , said:

Bring it on man! Hope this one makes it!

$geekfactor 0x0

Jorge Miguel Ferreira Alves
on , said:

I like the topic. Hope it passes the cut!

$geekfactor 0x0

Filipe Guerra
on , said:

This has all the ingredients to be a great talk! Bring it on!

$geekfactor 0x0

Marco Constâncio
on , said:

hope to see this one.

$geekfactor 0x0

Rui Carmo
on , said:

Good, solid outline. Hope this gets approved.

$geekfactor 0x0

Tiago Ferreira
on , said:

Nice subject.

$geekfactor 0x0

You must log-in in order to comment this.