My favorites | Sign in
Project Home Downloads Issues Source
Project Information
Members

The Relational Algebra project:

  • includes an interactive interpreter that can perform relational algebra operations.
  • implements a re-usable Java class that models relations and relational operators.
  • provides static methods that can parse relational algebra expressions and evaluate them against relations.

The idea behind the Relational Algebra project is that it is easier to understand relational algebra if you can experiment with the different operators. I looked at some of my solutions and thought 'if only I could just run this with some test data to see if it works'.

The interpreter handles select, project, join, divide , rename, union, difference, intersection, alias and times.

Update 20th April 2011: Version 0.2 (the current release version available from the Downloads tab) includes a built-in editor. This allows relations to be created and edited from within the interpreter itself. To start the editor evaluate edit relation. For example, 'edit myrelation'. This will begin an editing session and will also create the relation if it does not already exist. The editor will also load and save to CSV files using file dialogs. There are more details on using the editor in the instructions documentation.

Update: Infinite command history is here. Use Ctrl-up arrow and Ctrl-down arrow to browse command history.

The ability to load relations in from a CSV file has been retained (first row attribute names, second row domain names, subsequent rows values - see example in instructions). But then you can create new relations from it using relational algebra.

For example,

rela := load "/home/nick/my-rela.csv"

Then:

select rela where a > 2

project rela over a, b, c

project (select rela where a > 2 or b <= 5) over a, b

It also handles assignment, so:

relb := project rela over a, b, c

Which creates a new relation called relb.

Loads more examples in the documentation along with some example CSV files and how to make your own.

Hint: in the interpreter use enter to get a newline (for long expressions) and use ctrl-enter to evaluate.

The project is written in Java and has a re-usable class called Relation that does all the work. It's free for anyone that wants to use it.

The interpreter itself is a JAR file called "raeval.jar" and is available under the downloads tab. To run it you need the Java Runtime Environment that is also available free. I have had it up and running on Windows, Mac and Ubuntu Linux.

There are some (really) basic instructions in the Downloads too together with a screenshot.

Note: this is beta software. The functionality has been tested but there probably are some bugs left. Contact me if you spot them. But please be gentle, because this has been an obsession...

Relational operators supported:

select relation where condition

project relation over attribute {, attribute, ... }

relation join relation

relation rename (attribute as newname ...)

divide relation by relation

relation union relation

relation difference relation

relation times relation

relation alias relation

Non-relational operators supported:

+ - * / and or not < > = <= >= <>

relation := relation (assignment)

show relation

load filename

Additionally in the interpreter:

help

help keyword

edit relation

quit

Powered by Google Project Hosting