Re: SWI - passing variable value across rules



I would like to say something--------

Muthukumar. U. wrote,

choice2(sechoice(X)) never seems to get translated to choice2(yes) or choice2(no).

1. Facts and rules themselves cannot be get converted into other
structure.
2. Prolog is based on first order logic.

I can suggest following program

%%% Knowledge Base %%%%%%%
%
%
%
%
%%% End of KB %%%%%%%%

go:-
writeq('Please provide a file name'),
read(File),
assertz(file(File)),
isrelatedto(File,Name),
writeq(Name),writeq('Want more? Type yes or no'),read(Choice),
writeq('Want to add new facts? Type yes or no'),read(Choice2),
choice(Choice),
choice2(Choice2).

%%%%%%%%%%%%%%%%%%%
choice(yes):-
isrelatedto(file(File),Name),
choice2(sechoice(X)).

choice(no).

%%%%%%%%%%%%%%%%%%%
choice2(yes):-
writeq('Please enter file name'),
read(Newfile),writeq('Please enter connected to entity'),
read(Connectedto),assertz(isrelatedto2(Newfile,Connectedto)).

choice2(no):-
writeq('Thank you for using the system').



Muthukumar. U. , Don't forget to add
***isrelatedto(file(filename),data)**** in your database.
The knowledge base you have given in the program is not enough
explanatory.
It would be better to explain if you could describe interface of your
program.



--------------------
yours,
Advait

.



Relevant Pages

  • Newbie - question to backward-chaining...
    ... Now I want to implement my backward-chaining and here is ... By backward chaining I mean verifying a propositions from the facts and the ... If a fact is not in the knowledge base, ... "verify" try to verify facts recursively... ...
    (comp.lang.prolog)
  • Re: where iam lacking behind
    ... usually get a stack of them and then quickly browse through the key ... facts. ... I dont feel that you are lacking in terms of your credentials, ... you want to expand your knowledge base then read Java community ...
    (comp.lang.java.programmer)
  • knowledge base in FOL
    ... so i wanna have to make a code for ... knowledge base in first order logic where all facts are horn clauses ...
    (comp.lang.lisp)
  • Re: knowledge base in FOL
    ... knowledge base in first order logic where all facts are horn clauses ... and input to the program are sequence of keywords..!! ...
    (comp.lang.lisp)