in reply to Re: Query database in Prolog
in thread Query database in Prolog

What I was imagining was using Prolog in place of RDBMS. That is a prolog engine to which you could connect using an analogue to ODBC, store facts there and query them. But this means you need a way to delete the facts as well - I don't know how this can be added to the Prolog computational model. I just started with Prolog and I don't really understand your sentence about backtracking over query results - but I think that backtracking in this environment would have to be limited by a transaction boundary.

Replies are listed 'Best First'.
Re^3: Query database in Prolog
by Ovid (Cardinal) on Dec 29, 2005 at 21:43 UTC

    In reality, deleting facts is generally not something one wants to do as it's considered a "non-logical" operation. However, you can use retract/1 if you really need to:

    AI-NeuralNet-Simple-0.03 $ aiprolog Welcome to AI::Prolog v 0.732 Copyright (c) 2005, Curtis "Ovid" Poe. AI::Prolog comes with ABSOLUTELY NO WARRANTY. This library is free so +ftware; you can redistribute it and/or modify it under the same terms as Perl +itself. Type '?' for help. ?- help('retract/1') retract/1 Remove facts from the database. You cannot remove rules. This may change in the future. See assert(X). retract(loves(ovid,java)). help(retract/1) Yes ?-

    You can also just type "help" at the aiprolog prompt to see a list of all built-in predicates you can get help for:

    ?- help. Help is available for the following builtins: !/0 assert/1 call/1 consult/1 div/2 eq/2 fail/0 ge/2 gt/2 halt/1 if/3 is/2 le/2 listing/0 listing/1 lt/2 minus/2 mod/2 mult/2 ne/2 nl/0 not/1 notrace/0 once/1 or/2 plus/2 pow/2 print/1 println/1 retract/1 trace/0 true/0 var/1 write/1 writeln/1 help Yes ?-

    If you really want to get a decent grounding in Prolog, see Amzi's "Adventure in Prolog". It's a free online book which lets guides through building four different Prolog applications. It's quite cool. Most of the basics work in AI::Prolog, but it could still use a lot of work/patches.

    Cheers,
    Ovid

    New address of my CGI Course.