IMP BLAST (Bidirectional Logic And SQL Translator) is a translation tool which is able to translate FOL expressions to SQL expressions and vice versa.
Precisely, the tool works with the code libraries IMP-LOGICS and IMP-SQL which provide a metamodel for first order logic and standard SQL respectively.
The tool is prepared to provide different translation strategies. The ones provided are
one2many and one2one, but custom one can be also designed and used.
Common classes can be found in the root package \blast and strategy coupled classes and
implementations are contained in the appropriate subpackages of each strategy.
IMP BLAST started as a SQL Assertions to LogicConstraints translator but is now a translator that works with the
following main ones:
- SQL Assertions <-> Datalog Logic Constraints
- SQL Views <-> Datalog Derivation Rules
- SQL Queries <-> Datalog Queries
The following snippets represents equivalent expressions from SQL and FOL which can be the result of a translation with
the one2many strategy:
CREATE ASSERTION atLeastOneLineItem CHECK ( NOT ( EXISTS (
SELECT *
FROM ORDERS AS o
WHERE NOT ( EXISTS (
SELECT *
FROM LINEITEM AS l
WHERE l.L_ORDERKEY = o.O_ORDERKEY
))
)));
@atLeastOneLineItem :- ORDERS_O_ORDERKEY(u0, v0), not(exists5(v0))
exists5(r0) :- LINEITEM_L_ORDERKEY(u0, v0), v0=r0