472,373 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,373 software developers and data experts.

Display results in Prolog

if twol then twolegs.
if twoh then twohands
if tenf then tenfingers.
if twof then twofeets.
if smallh then smallhair.
if fourlegs and nohands and nofingers and fourfeets and doghair then dog.
if twolegs and twohands and tenfingers and twofeets and smallhair then person.
if fourlegs and nohands and nofingers and fourfeets and doghair then dog.
if twolegs and twohands and tenfingers and twofeets and smallhair then person.


% forward chaining
forward :-
new_derived_fact(P),!,
write('solution: '),writeln(P),
assert(derived_fact(P)),
forward ;
writeln('No more facts').
new_derived_fact(P) :-
if Cond then P,
\+ fact(P),
\+ derived_fact(P),
truth(Cond).
truth(P) :-
fact(P) ;
derived_fact(P).
truth(P1 and P2) :-
truth(P1),
truth(P2).
truth(P1 or P2) :-
truth(P1) ;
truth(P2).

%database
solution(person, addressx, idp1, house).
solution(person, addressy, idp2, house).
solution(person, addressz, idp3, house).
solution(dog, dogaddressx, dogid1, doghouse).
solution(dog, dogaddressy, dogid2, doghouse).

I have this code in prolog using forward chaining. How to display the result "person" like "address, id, house" from datababase??
Apr 24 '20 #1
0 1688

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Jules | last post by:
Hi: I have an Access 97 Search form set up - a couple of combo boxes, a couple of text fields and a command button. I want the command button to run an SQL script and then open the results form....
0
by: XML newbie: Urgent pls help! | last post by:
I am working on VB.Net application. I have a GUI where the user logs on and gets SessionId. Once, the connection is successful, the user is redirected to another screen where he choses which table...
1
by: XML newbie: Urgent pls help! | last post by:
I am working on VB.Net application. I have a GUI where the user logs on and gets SessionId. Once, the connection is successful, the user is redirected to another screen where he choses which table...
2
by: swb76 | last post by:
I have a query in MSAccess and it is a select query. As i understand, any query run from Visual Basic would be returned in a recordset. Can i display the results to the user in a datasheet view?...
5
by: 848lu | last post by:
hi, i am trying to do a search with my ASP webpage, and then display the results in a DIV tag of HTML, how would i do that, thanks strconnection = New...
1
by: aziziahmad | last post by:
hello..i'm trying to display my result in text file.. how am i going to display from printf command to display at text file? this is the example of of line need to be display in text file = ...
3
WyvsEyeView
by: WyvsEyeView | last post by:
This seems like it should be so easy to do. I have a table, called tblTopics. Each topic can have one or more instances, contained in a table called tblTopicInst. tblTopics is bound to a form called...
0
by: JP Romano | last post by:
Hi... I'd like to display the results of a formula on a userform to alert users that certain operations are still in progress. Essentially, when the user clicks a button to compile results from...
2
by: trochia | last post by:
Hello all, I am fairly new to php etc, and I have a database 1) I have already did a search for: "Results within results" on this site, in PHP & MySQL forums ( I think) properly...and one search...
9
gcoaster
by: gcoaster | last post by:
Hello Group I need help, I need to use an to show results values from a table and display in a unbound textbox on a form. the results from each column in the table need to be on seperate...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.