@@ -0,0 +1,90 @@
1+# Project:M36 Relational Algebra Engine
2+
3+##Introduction
4+Project:M36 implements a relational algebra engine as inspired by the writings of Chris Date.
5+
6+## Installation
7+
8+1. Install [Haskell Platform](https://www.haskell.org/platform/)
9+1. ```git clone https://github.com/agentm/project-m36```
10+2. ```cd project-m36```
11+3. ```cabal configure --enable-tests```
12+4. ```cabal build```
13+5. ```./dist/build/tutd/tutd``` to run the Tutorial D interpreter
14+6. ```cabal test``` to run test suite
15+
16+## Usage
17+
18+Currently, the best-supported frontend is the Tutorial D interpreter. Run `cabal run tutd` in newer versions of cabal or `./dist/build/tutd/tutd` in older version of cabal to start the command line interpreter. You will be greeted with:
19+
20+`TutorialD:`
21+
22+The Tutorial D interpreter comes pre-loaded with the Chris Date supplier "S"/product "P"/supplier-product "SP" relations for experimentation. This TutorialD interpreter is case-sensitive.
23+
24+At this point, there are three types of command which can be executed:
25+
26+1. relational algebra expressions such as:
27+
28+ ```
29+TutorialD: :s S join P
30+┌──────┬─────┬──┬─────┬──┬─────┬──────┬──────┐
31+│CITY │COLOR│P#│PNAME│S#│SNAME│STATUS│WEIGHT│
32+├──────┼─────┼──┼─────┼──┼─────┼──────┼──────┤
33+│Paris │Blue │P5│Cam │S3│Blake│30 │12 │
34+│London│Red │P1│Nut │S4│Clark│20 │12 │
35+│London│Red │P1│Nut │S1│Smith│20 │12 │
36+│Paris │Blue │P5│Cam │S2│Jones│10 │12 │
37+│London│Red │P6│Cog │S1│Smith│20 │19 │
38+│London│Red │P6│Cog │S4│Clark│20 │19 │
39+│Paris │Green│P2│Bolt │S3│Blake│30 │17 │
40+│London│Red │P4│Screw│S1│Smith│20 │14 │
41+│London│Red │P4│Screw│S4│Clark│20 │14 │
42+│Paris │Green│P2│Bolt │S2│Jones│10 │17 │
43+└──────┴─────┴──┴─────┴──┴─────┴──────┴──────┘
44+```
45+
46+ where ":s" instructs the interpreter to show the resultant relation, "S" and "P" are relation names, and "join" is the join operator.
47+2. interpreter-level queries such as:
48+
49+ ```
50+TutorialD: :t S
51+{CITY "char", S# "char", SNAME "char", STATUS "char"}
52+```
53+
54+ which shows the Tutorial D type for a relational expression and
55+
56+ ```
57+TutorialD: :c
58+fromList []
59+```
60+which displays database constraints.
61+
62+3. expressions which modify the database context such as:
63+
64+ ```
65+TutorialD: x := S JOIN P
66+```
67+ which sets the relational variable named "x" to the results of "S join P" if the database constraint checking succeeds.
68+
69+ To create a new constraint which are represented as inclusion dependencies:
70+
71+ ```
72+constraint check_x false in true
73+```
74+ checks that the expression "false" is a subrelation of "true", which, in this case, is always true.
75+
76+## Development
77+
78+Project:M36 is developed in Haskell and compiled with GHC. There are three primary, independent modules:
79+
80+1. Relation - represents a relation in the relational algebra and implements the relational operators
81+2. Relational Expressions - represents a composable abstract syntax tree for the relational algebra
82+3. Tutorial D Interpreter - one available frontend to evaluate relational expressions
83+
84+Other modules include:
85+
86+* displaying a relation as HTML
87+* displaying a relation in the terminal
88+* relational expression static optimizer
89+* relational expression cost-based optimizer
90+* relational error enumeration