473,396 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 1780

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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.