Prolog to SQL Converter

Without thinking a lot, it seems to me that a large set of Prolog functions can be implemented as relational calculus (aka SQL).

Has anyone heard of any tools for automatically converting Prolog to SQL?

+14
sql prolog
Apr 07 '09 at 6:42
source share
5 answers

Recommending:

https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/prolog/code/io/pl2sql/0.html

my advice is to use the Eclipse prolog (http://www.eclipseclp.org/) (not (here) to confuse it with the prolog in the Eclipse IDE).

I spent hours trying to compile the code in 4 other prologs (!) And 4 minutes to compile in eclipse.

When it works, it is a thing of beauty.

Loan to mister draxler of course

+2
Jul 18 2018-12-18T00:
source share

Yes of course.

A premise for skeptics: any semisimilar book on database theory mentions Datalog (which is prologue) and theorems that demonstrate what can be translated to / from relational algebra (RA) (subject to certain restrictions).

SQL does not match RA or relational calculus, but enough to support Prolog:

+28
Nov 05 '09 at 18:12
source share

The display is not very good. SQL, for example, does not roll back, concatenate, lists, or adhoc nested structures.

The prolog does not cope with compound objects, indexes, etc.

I would say that this is not-go.

+2
Apr 07 '09 at 6:56
source share

It is more difficult to make a sql query from a prolog, which can then be translated into a prolog. e.g. ODBC Library Prolog

This removes all restrictions and keeps the two languages ​​in place.

+2
Jun 06
source share

I wrote a translator that converts a subset of Prolog into custom SQL functions.

This predicate in Prolog can be translated into SQL:

is_between(A,B,C) :- A<B,B<C. 

This is the translator output as a MySQL function:

 CREATE FUNCTION is_between(A double,B double,C double) RETURNS BIT BEGIN RETURN A>B and B>C; END 

Similarly, there is a Prolog-in-SQL compiler for SWI-Prolog and another translator that converts a non-recursive subset of Datalog to SQL.

+1
Sep 02 '18 at 0:32
source share



All Articles