Alf provides you with the relational algebra in Shell and in Ruby. It is a successful meeting between:
#
# What is the total weight of supplied products,
# by city, then by product id?
#
(group +--------+---------------------+
(summarize (join :parts, :supplies), | :city | :supplying |
[:city, :pid], +--------+---------------------+
:total => sum{ weight * qty }), | London | +------+---------+ |
[:pid, :total], :supplying) | | | :pid | :total | |
| | +------+---------+ |
| | | P1 | 7200.00 | |
| | | P4 | 7000.00 | |
| | | P6 | 1900.00 | |
| ... | | ... | ... | |
Alf requires an installation of the Ruby programming language. We strongly recommend using ruby 1.9.2. If you are under windows or if you are familiar with Java, have a look at JRuby, it's simple to install and easy to use.
Then, the gem command is bundled with your Ruby installation and allows
automatically installing alf and its dependencies:
[sudo] gem install alf [fastercsv] [sequel] [sqlite3 pg ...]
Where
fastercsv is only required under ruby 1.8.7, if you plan to use .csv filessequel is required if you plan to connect to SQL databasessqlite3, pg and the like are required for connecting to a specific SQL DBMS