Keio University

No Programming Required?

Publish: October 11, 2019

Let's start by looking at the final product. This is a work created by O.M., a third-year undergraduate student, for a free-form project in the “Data Modeling” course. They created a database on World Heritage sites and then converted it into a web page using a language called SuperSQL, which is being developed in the Toyama Lab.

Almost all the social media and shopping sites you see daily on your smartphone or PC generate web pages based on information obtained from a database, just like this one. This conversion is performed in two stages: retrieving information from the database (querying) and the publishing process of converting the obtained information into a medium such as HTML.

The information required for the “Pages by Region” on the World Heritage site can be obtained from five tables in the database using the standard query language SQL, as shown below.

SELECT r.name, c.name, t.name, h.name, h.year

FROM region r, country c, type t, heritage h, belong b

WHERE c.region=r.id and b.country=c.id and b.heritage=h.id and h.type=t.id;

Then, the part that groups the obtained information by country and type and converts it into a web page is typically done with a program written in a programming language like Ruby, PHP, or Java. This is where a programmer's skills shine.

画像

On the other hand, using SuperSQL, the same page can be generated without programming in the following four lines.

FOREACH r.id

GENERATE HTML [r.name ! [c.name ! [t.name, [h.name, h.year]!]!]!]!

FROM region r, country c, type t, heritage h, belong b

WHERE c.region=r.id and b.country=c.id and b.heritage=h.id and h.type=t.id;

In the demo page, clicking on a country or heritage name links to the detail page for that respective country or heritage site. To generate these links, you just need to add two `link` functions to the `GENERATE` clause in the second line, as shown below.

GENERATE HTML [r.name ! [link(c.name, ‘country.ssql’, c.id) !

[t.name, [link(h.name, ‘heritage.ssql’, h.id), h.year]!]!]!]!

The programmer only needs to write this, and then they can leave it to the web designer to decide on the design, such as colors and fonts, and it's done! Is programming no longer necessary?

In the World Heritage example, a total of 12 SuperSQL queries (one for each of the 12 screen types) and one CSS stylesheet are used to create a 1,284-page website.

Let's take a closer look. SuperSQL is a database publishing and presentation language that simultaneously performs queries from a database and generates output media. During publishing, the layout is defined by grouping, represented by pairs of square brackets, and by specifying the concatenation direction (horizontal, vertical, depth). In two dimensions, horizontal concatenation is represented by a comma (,) and vertical concatenation by an exclamation mark (!). Focusing just on grouping, for example, with only the country name, there is only one possibility: [country name]. But with two items, country name and heritage name,

[country name, heritage name] [country name, [heritage name]] [[country name], heritage name] [country name], [heritage name]

there are four possible variations. In the rightmost example, a list of country names and a list of heritage names are displayed side by side, but it becomes unclear which heritage site belongs to which country. With three items, like country name, type, and heritage name, there are 22 variations; with 4 items, 146; with 5 items, 1,082; and with 6 items, a calculated 8,609 variations. When the specification of the concatenation direction is also added, it becomes clear that an extremely large number of layouts can be specified. In SuperSQL, the expression of these differences is controlled only by the placement of brackets and connectors, allowing for a lot of trial and error. However, differentiating or changing these expressions in a programming language like Java requires significant effort.

The Toyama Laboratory is also taking on challenges such as generating videos by adding a time axis and creating 3D VR using Unity as a medium, in addition to using the web (HTML) as an output medium for SuperSQL.

Declarative Programming

SuperSQL does not make programming entirely unnecessary; rather, it can be described as a type of programming called declarative or non-procedural. SQL is one of the prime examples of a declarative programming language, specializing in the purpose of database querying. SuperSQL aims to further extend its functionality to media generation and publishing.

Let's say you want to make oyakodon. SQL is like a supermarket; if you declare "chicken, egg, green onion," you get the ingredients, but the subsequent cooking requires procedures. Think of SuperSQL as a restaurant that will make anything you ask for, where

place_on_top(simmer_with_egg(chicken, green_onion), rice)

by declaring (ordering) it like this, you can get a finished oyakodon.

Gakumon no susume (An Encouragement of Learning) (Research Introduction)

Showing item 1 of 3.

Gakumon no susume (An Encouragement of Learning) (Research Introduction)

Showing item 1 of 3.