Monday, 25 April 2011

M359 Relational Algebra Checker RAEval

Fellow student Nick E has developed a relational algebra checker in Java which can be used to prove your relational algebra and ensure that it is generating the results you can expect. This is an awesome piece of software that I think should be noted for future students who will be studying M359 as it will help massively come TMA time and during study/revision.

Here is Nick's original post to the course forums.

Relational Algebra Interpreter
Attachment Screenshot.png
I've written an interpreter that can work with relational algebra.

The idea is that it is easier to get the hang of relational algebra if you can play around and experiment with the different operators. I looked at some of my solutions and though 'if only I could just run this to see if it works'.

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

The main limitation is that you cannot create a relation within the interpreter - you have to load it in from a CSV file. But then you can create new relations from it.

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 to get a newline (for long expressions) and use 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.

You can download the executable jar file and/or source code at:

http://code.google.com/p/relational-algebra/

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 there too.

Note: this is beta software. I've tested all of the functionality but there probably are some bugs left. Contact me from the project home if you spot them. But please be gentle, because this has been an obsession...

No comments: