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.


In reply to Re^3: Query database in Prolog by Ovid
in thread Query database in Prolog by zby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.