Your browser may have trouble rendering this page. See supported browsers for more information.

This page shows the source for this entry, with WebCore formatting language tags and attributes highlighted.

Title

QQL: A Query Language for Quino

Description

In late 2011 and early 2012, Encodo designed a querying language for Quino. Quino has an ORM that, combined with .NET Linq provides a powerful querying interface for developers. QQL is a DSL that brings this power to non-developers. QQL never made it to implementation---only specification. In the meantime, the world moved on and we have common, generic querying APIs like OData. The time for QQL is past, but the specification is still an interesting artifact, in its own right. Who knows? Maybe we'll get around to implementing some of it, at some point. At any rate, you can download the specification from <a href="https://encodo.com/media/2726/encodo-qql-handbook.pdf">Encodo</a> or <a href="{att_link}encodo-qql-handbook.pdf">here at earthli</a>. The following excerpts should give you an idea of what you're in for, should you download and read the 80-page document. <h>Details</h> The TOC lists the following top-level chapters: <ol> Introduction Examples Context & Scopes Standard Queries Grouping Queries Evaluation Syntax Data Types and Operators Libraries Best Practices Implementation Details Future Enhancements </ol> From the abstract in the document: <bq>The Quino Query Language (QQL) defines a syntax and semantics for formulating data requests against hierarchical data structures. It is easy to read and learn both for those familiar with SQL and non-programmers with a certain capacity for abstract thinking (i.e. power users). Learning only a few basic rules is enough to allow a user to quickly determine which data will be returned by all but the more complex queries. As with any other language, more complex concepts result in more complex texts, but the syntax of QQL limits these cases.</bq> From the overview: <bq>QQL defines a syntax and semantics for writing queries against hierarchical data structures. A query describes a set of data by choosing an initial context in the data and specifying which data are to be returned and how the results are to be organized. An execution engine generates this result by applying the query to the data.</bq> <h>Examples</h> <h level="3">Standard Projections</h> The follow is from chapter 2.1, "Simple Standard Query": <bq quote-style="none">The following query returns the first and last name of all active people as well as their 10 most recent time entries, reverse-sorted first by last name, then by first name. <code>Person { select { FirstName; LastName; Sample:= TimeEntries { orderby Date desc; limit 10 } } where Active orderby { LastName desc; FirstName desc; } } </code></bq> In chapter 2, there are also "2.2 Intermediate Standard Query" and "2.3 Complex Standard Query" examples. <h level="3">Grouping Projections</h> The following is from chapter 2.4, "Simple Grouping Query": <bq quote-style="none">The following query groups active people by last name and returns the age of the youngest person and the maximum contracts for each last name. Results are ordered by the maximum contracts for each group and then by last name. <code>group Person { groupby LastName; select { default; Age:= (Now - BirthDate.Min).Year; MaxContracts:= Contracts.Count.Max } where Active; orderby { MaxContracts desc; LastName desc; } }</code></bq> In chapter 2, there are also "2.5 Complex Grouping Query", "2.6 Standard Query with Grouping Query" and "2.7 Nested Grouping Queries" examples.