Lecture: MQL-to-SQL

a JSON-based query language for RDBMS access from AJAX applications

Event_large

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 www.freebase.com, 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 "http://code.google.com/p/mql-to-sql/":http://code.google.com/p/mql-to-sql/ 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":http://code.google.com/p/mql-to-sql/wiki/SampleMQLQueries To kickstart it without downloading and installing, try them in "the online demo":http://mql.qbmetrix.com/mqlread/mql-to-sql-query-editor.php

In this 1 hour 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

Info

Day: 2011-08-21
Start time: 16:30
Duration: 01:00
Track: JavaScript

Feeback

Click here to let us know how you liked this event.