Rel Version 1.0.11+ Syntax
Introduction
As of Rel version 1.0.10, some significant syntax changes to Tutorial D were implemented. These are based on the book Database Explorations: Essays on The Third Manifesto and related topics by C. J. Date and Hugh Darwen (ISBN 978-1426937231). The relevant chapter from that book, with revisions, is available on-line at http://www.dcs.warwick.ac.uk/~hugh/TTM/Tutorial%20D-2013-05-23.pdf
In Rel version 1.0.11, a few additional changes were made.
These changes may impact your ability to run various published Tutorial D examples, and they will certainly affect those who are migrating from pre- version 1.0.10 Reldatabases to the latest version of Rel.
Migrating from a Version of Rel Prior to 1.0.11
Prior to installing the latest version of Rel, you must make a backup of your database(s). Then, install the latest version, and load and attempt to execute the backup script(s). If your script successfully loads, you’re done. If it complains of syntax errors, you’ll need to edit the script — based on the following — until the script successfully loads.
Changes in Rel version 1.0.10 and 1.0.11
EXTEND
Prior to 1.0.10:
EXTEND r ADD (p AS q, a AS b)
Example:
EXTEND invoice ADD (shipping + amount AS subtotal, subtotal + tax AS total)
1.0.10+:
EXTEND r: {q := p, b := a}
Example:
EXTEND invoice: {subtotal := shipping + amount, total := subtotal + tax}
UPDATE
Prior to 1.0.10:
UPDATE r (p := q, b := a)
Example:
UPDATE employee WHERE id='E3498' (salary := salary + 2450.33, paygrade := 'P')
1.0.10+:
UPDATE r: {p := q, b := a}
Example:
UPDATE employee WHERE id='E3498': {salary := salary + 2450.33, paygrade := 'P'}
RENAME
Prior to 1.0.10:
r RENAME (a AS b, d AS e)
Example:
employee RENAME (salary AS yearly_wage, paygrade as employee_paygrade)
1.0.10+:
r RENAME {a AS b, d AS e}
Example:
employee RENAME {salary AS yearly_wage, paygrade as employee_paygrade}
SUMMARIZE
Prior to 1.0.10:
SUMMARIZE r ADD (SUM(p) AS q, AVG(a) AS b)
Example:
SUMMARIZE invoice ADD (SUM(amount) AS total_amount, AVG(tax) AS average_tax)
1.0.10+:
SUMMARIZE r: {q := SUM(p), b := AVG(a)}
Example:
SUMMARIZE invoice: {total_amount := SUM(amount), average_tax := AVG(tax)}
WITH
Prior to 1.0.10:
WITH a AS b, x AS y : ...
Example:
WITH r {x, y} AS t1, r {x, p} AS t2: JOIN {t1, t2}
1.0.10+:
WITH (b := a, y := x) : ...
Example:
WITH (t1 := r{x, y}, t2 := r {x, p}) : JOIN {t1, t2}
WRAP
Prior to 1.0.10:
r WRAP ({a, b} AS c, {d, e} AS f)
Example:
customers WRAP ({house, street, city, postcode} AS address, {phone, email} AS contact)
1.0.10:
(r WRAP ({a, b} AS c)) WRAP ({d, e} AS f)
1.0.11+:
(r WRAP {a, b} AS c) WRAP {d, e} AS f
Example:
(customers WRAP {house, street, city, postcode} AS address) WRAP {phone, email} AS contact
UNWRAP
Prior to 1.0.10:
r UNWRAP (a, b)
Example:
customers UNWRAP (address, contact)
1.0.10:
(r UNWRAP (a)) UNWRAP (b)
1.0.11+:
(r UNWRAP a) UNWRAP b
Example:
(customers UNWRAP address) UNWRAP contact
GROUP
Prior to 1.0.10:
r GROUP ({a, b} AS c, {d, e} AS f)
Example:
sys.Catalog GROUP ({Name, Definition, CreationSequence} AS vardata, {vardata, isVirtual} AS varinfo)
1.0.10:
(r GROUP ({a, b} AS c)) GROUP ({d, e} AS f)
1.0.11+:
(r GROUP {a, b} AS c) GROUP {d, e} AS f
Example:
(sys.Catalog GROUP {Name, Definition, CreationSequence} AS vardata) GROUP {vardata, isVirtual} AS varinfo
UNGROUP
Prior to 1.0.10:
r UNGROUP (a, b)
Example:
catalog UNGROUP (vardata, varinfo)
1.0.10:
(r UNGROUP (a)) UNGROUP (b)
1.0.11+:
(r UNGROUP a) UNGROUP b
Example:
(catalog UNGROUP vardata) UNGROUP varinfo
ANY and ALL
Prior to 1.0.10: ANY and ALL were available as synonyms for OR and AND, respectively.
1.0.10+: ANY and ALL have been removed.
INSERT
Prior to 1.0.10: INSERT generates an error message if attempting to insert duplicate tuples.
1.0.10+: INSERT silently ignores duplicate tuples.
COMPOSE
1.0.10+: An n-adic COMPOSE operator is now available. For example
COMPOSE {x, y, z}
is equivalent tox COMPOSE y COMPOSE z
.
XUNION, TIMES, I_MINUS, I_DELETE and D_INSERT
1.0.10+: XUNION, TIMES, I_MINUS, I_DELETE and D_INSERT have been implemented. Please refer to the references in the Introduction for further information.