[Added: Prolog SQL has some good info. You should definately avoid re-inventing a wheel. The real Prolog people have already been hacking on this problem.]
I was thinking about this yesterday. It seemed most natural that you'd patch AI::Prolog to be able to query this stuff. You might want to introduce a new built-in function to represent joins. You've got a problem in that SQL relations have no order to columns so you'll either need to ignore that or instruct AI::Prolog in what order to read columns when querying the database.
% A "normal" lookup city('New York', Cityid), usr(Cityid, Name, Id). % An id-less query. Maybe the engine notices the join and transforms t +his into the prior behind the scenes. % Maybe an invented built-in like references/4 cause the transformatio +n. :- references( 'USR', 'CITY_ID', 'USR', 'CITY_ID' ). usr( city( 'New York' ), Name ).
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Re: Query database in Prolog
by diotalevi
in thread Query database in Prolog
by zby
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |