The objective of this worksheet is to
Write algebraic expressions to solve basic Datalog queries that do not involve rules.
Work examples of Datalog queries by hand
Design the classes and interfaces needed to support the use of relational algebra to interpret Datalog programs.
Problems
Create a Datalog file with at least a 3-ary relation and write queries for the relation that represent the range of queries and outputs that might occur. You need at least 4 queries minimum. Justify your answer (i.e., explain why your set of queries is representative of what may be encountered in an arbitrary Datalog input with just facts).
For each query in the prior problem, write the algebraic expression to solve the query.
Solve each query in the first problem by hand showing the relation created after each unary operation in the algebraic expression.
Design a class to represent a relation and to represent a tuple. Include the member variables and method interface.
Write pseudo-code for the select, rename, and project operations on the relation.
Back to top