Relational Algebra in Tcl

Andrew Mangona presnted his work on TclRAL, a relational algebra extension for Tcl. It provides:

Tuple type, 3 part list. Tuples have a heading: attribute name, attribute type.

Relvars are mirrored as standard Tcl variables. Relvars can have referential integrity constraints applied to their values. The extention provides 38 relational operators. No time to cover them all in his talk.

Examples of important operators

Set operations
union, intersection, difference, comparison
Selection operators
restrict, project, eliminate
Join operations
join [natural join], times [cartesian product], divide, semijoin, semiminus
Computational operations
summarize, extend, rank
Linkage to other Tcl data types
ordinary variables, arrays, dict, matrix

TclRAL enforces declarative referential integrity constraint: Association Constraints, Partition Constraints and Correlation Constraints.

Any time a relvar is modified the constraints are evaluated. Either you pass the constraints and can go forward; otherwise throw an error.

Association constraints define traditional (database-like?) referential constraints. Attributes in one relation refers to attributes in another relation. References are identifiers. Multiplicity and conditionality can be specified.

Partition constraints define a set of relations that are completed and disjoint sub-sets of some super-set relation.

Correlation constraints: Correlation constraints define an integrity constraint between two relvars that is mediated by a 3rd. The correlating relvar references the two other relvars in the constraint. Often arises in a many-to-many situation.

Lots of screenshot examples, but with a notation that while I'm sure is common to those who work with relational algebra, I did not understand well enough to transcribe from the back of the room.

TclRAL is NOT:

What's next:


—Michael A. Cleverly

Permanent URL for this post: http://blog.cleverly.com/permalinks/250.html