Relation is a command line program to do Relational Algebra with text files.
Relation can also be used online https://www.belle-nuit.com/relation/index.html
This presentation gives you a good start to understand relational algebra and its use with these functions
Video demo of Relationa Algebra Online
The binary uses Node.JS with the modules process, readline and fs and was compiled with pkg.
https://www.belle-nuit.com/download/relation-linux.zip (Linux, not tested)
https://www.belle-nuit.com/download/relation-win.exe.zip (Windows, not tested)
To be used as ./relation in interactive mode and as .relation -b file.rel in batch mode.
Relation is on GitHub https://github.com/bellenuit/Relation
Read a Relation CLI sample session
The text files can be .csv (comma separated values) and .txt (tab separated values),. both in Unicode UTF 8.
Relation has an interactive shell that allows you to open and save relations
- read path
- write path
And to create relations directly
- relation column (column)*
- insert field (, field)*
The columns are not typed. They values are either strings or numbers depending on the context.
Any value other than 0 is considered true.
Once you have created the relations, you can make the relational operators
- select expression
- project column agregator? (, column agregator?)*
- join (natural|left|right|outer|leftsemi|rightsemi|leftanti|expression)
Expressions can use
- quoted strings
- mathematical operators + - / *
- comparison operators = != < <= >=
- logical operators and or nor not
- grouping paranthesis ()
Agregators can be
You can use also non-relational non relational operators:
- extend column expression
- limit start count
- order column mode
The order mode can be A, Z (alphabetically normal and reverse), 1, 9 (numerically ascending or descending).
Finally, you can manipulate the operation stack:
And print out the results:
- print (or p)
- // comment
And view and edit the history to rerun it
- edit line newtext
The history of the command line can be saved as .rel file to be reused.
- write h.rel
- read h.rel