Lisp HUG Maillist Archive

About KnowledgeWorks

Hi,

I'm trying KnowledgeWorks now.

I'd like to run a example of family tree.

The fact file(familytree.pl) is:
******************************************************************************************
male(dicky).
male(randy).
male(mike).
male(don).
male(elmer).
female(anne).
female(rosie).
female(esther).
female(mildred).
female(greatgramma).
male(blair).
male(god).
female(god).

parent(don,randy).
parent(don,mike).
parent(don,anne).
parent(rosie,randy).
parent(rosie,mike).
parent(rosie,anne).
parent(elmer,don).
parent(mildred,don).
parent(esther,rosie).
parent(esther,dicky).
parent(greatgramma,esther).
parent(randy,blair).

father(X,Y) :- male(X),parent(X,Y).
mother(X,Y) :- female(X),parent(X,Y).
son(X,Y) :- male(X),parent(Y,X).
daughter(X,Y) :- female(X),parent(Y,X).
******************************************************************************************

To consult the file, I type "male(X). " on SWI-prolog's console, 
and the Prolog find the fact and fill in names on by one by typing " ; " .

On KnowledgeWorks, I launch KnowledgeWorks Listener, and load the "familytree.pl" through "consult" button of the menu.

But I don't know how to ask some questions to "*.pl" file on KnowledgeWorks.

Could you tell me how to consult " male (X) .." or " father (X , Y)." on Common Prolog?

I'd appreciate your help.


- Hiroki

Re: About KnowledgeWorks

Hi, 

If I enter (erqp) mode, I can ask questions in the prolog syntax.

What I meant is ... I'd like to ask some questions in Common Prolog syntax.

I guess there is a macro such as

 (ask-question '(male X))
 (ask-question '(father X Y))

Thank you in advance.


- Hiroki


2017-06-22 15:15 GMT+09:00 Noguchi Hiroki <padds1st@gmail.com>:
Hi,

I'm trying KnowledgeWorks now.

I'd like to run a example of family tree.

The fact file(familytree.pl) is:
******************************************************************************************
male(dicky).
male(randy)..
male(mike).
male(don).
male(elmer).
female(anne).
female(rosie).
female(esther).
female(mildred).
female(greatgramma).
male(blair).
male(god).
female(god).

parent(don,randy).
parent(don,mike).
parent(don,anne).
parent(rosie,randy).
parent(rosie,mike).
parent(rosie,anne).
parent(elmer,don).
parent(mildred,don).
parent(esther,rosie).
parent(esther,dicky).
parent(greatgramma,esther).
parent(randy,blair).

father(X,Y) :- male(X),parent(X,Y).
mother(X,Y) :- female(X),parent(X,Y).
son(X,Y) :- male(X),parent(Y,X).
daughter(X,Y) :- female(X),parent(Y,X).
******************************************************************************************

To consult the file, I type "male(X). " on SWI-prolog's console, 
and the Prolog find the fact and fill in names on by one by typing " ; " .

On KnowledgeWorks, I launch KnowledgeWorks Listener, and load the "familytree.pl" through "consult" button of the menu.

But I don't know how to ask some questions to "*.pl" file on KnowledgeWorks.

Could you tell me how to consult " male (X) ." or " father (X , Y)." on Common Prolog?

I'd appreciate your help.


- Hiroki

Updated at: 2020-12-10 08:31 UTC