Tql Roadmap

Top's QueryLanguage (TQL) Proposal

The TqlName has not been decided yet, partly because "TQL" is already taken. SMEQL (pronounced Smeagol) is one contender. SMEQL stands for Structured Meta-Enabled Query Language.

(Let me dream.)


TopMind is working on a relational language to overcome SqlFlaws. It has a BusinessSystemTwelve-like functional style (FunctionalProgramming) that makes it easier to break queries into digestible chunks, avoiding the "run-on" nature of SQL. It differs from BS-12 in that the arguments can only be one of 3 things:

  1. Tables - virtual or real
  2. Expressions that return scalars or tables
  3. Scalars (values like numbers or strings)

Being only one of 3 three things simplifies the implementation, understanding, flexibility, and extensibility of the language. If new constructs are added in the future, it usually does not require changing the language, only creating new operations with parameters that fit the standard. It thus is a library addition instead of a language addition. The syntax also makes it easier to implement the operations as regular functions or methods of "typical" programming languages. TopMind has not seen this ability in other query languages. The general syntax is:

  resultTable = operation(parameters.....)
One can optionally nest these:

  t1 = foo(blah)
  t2 = bar(t1, zog)

Into:

t2 = bar(foo(blah), zog)
Note that the final result set name is not needed. Thus, one could type:

  bar(foo(blah), zog)
However, most examples here will not use the nested form. The intermediate tables should be considered virtual tables. They are not assumed to be "saved" unless explicitly requested. They are merely a way to linguistically reference query "chunks". (SQL provides views and/or nested SELECT's for a similar purpose, but these are often awkward or require DBA intervention.)

Key Language Features: Sample Code: Discussion: Contributors to the TQL pages:

Why differentiate scalars and tables? If a scalar is a 1 row, 1 column table then you don't need to worry about what you're dropping where, because EverythingIsA table. This could rapidly turn into a Lisp dialect if you aren't careful ;)

Perhaps this relates to the syntax issue raised in TqlOverloading. A TQL operation has to know what kind of parameters it is getting. If a parameter can be more than one of the 3 kinds of things listed above, then the syntax may grow complicated.

Perhaps conversion functions can be provided to convert from one kind to the other so that a reliance on type overloading isn't necessary. I would like to explore some UseCases first. --top


Is there an implementation in the works? -AnonymousDonor

You know, I started working on a proof-of-concept implementation using ExBase, but found that dealing with column types and lengths for schema-creating operations such as joins was a bit of a pain. I am now considering using it to help demo a DynamicRelational database such that column types and lengths are not an issue. As a short-cut from parsing I was going to implement it using "query tables" with a structure resembling:

Thus, something like this:

  a = filter(j, b < c)
  b = join(a, x, q = b.z)
  orderBy(b, r)

Would be:

  |Alias...|Operator|.p1.|..p2..|.p3
  |--------|--------|----|------|-------
  |a.......|filter..|.j..|.b<c..|
  |b.......|join....|.a..|.x....|q=b.z
  |(blank).|orderBy.|.b..|.r....| 

[Reworked with periods to avoid TabMunging]

I realize that such is not fully normalized, but it is visually easy to use. Also, those who prefer the nested approach may not want it represented this way. But, it was intended for experimentation, not production work.

--top


Can SMEQL code be compiled entirely to SQL, or will a full implementation require some kind of intermediary layer? --AnonymousDonor

An interesting question. The ability to create temp tables may be needed to get around syntax translation/convention differences. And, the sequence number of the Sort operation may be difficult in many SQL dialects.

Actually, I've been thinking of a quicker way to use SQL to implement it, or at least create a proof of concept, by ignoring efficiency. Each statement would essentially use an INTO clause to create a temporary table with the name of the "receiving table", or at least as a suffix. More to come...

4/2009 - Kicking around ModernizingExBase reminded me of SMEQL's finer decomposability (smaller granularity) than SQL. These two "projects" might be related (SolutionsSought).

--top


Type Issues


See also: RelationalLanguage, FunctionalProgrammingLanguage
CategoryTql

EditText of this page (last edited September 27, 2009)
FindPage by searching (or browse LikePages or take a VisualTour)