Primarily, I would like to thank all persons who developed this knowledge-based inference engine. I'm from a working team who develops the free software based distribution (www.canaima.softwarelibre.gob.ve) that uses venezuelan goverment in its technological park.
I am also coursing Knowlegde Engineering as university asignature and I've been developing a system using Pyke: a knowledge-based technical support system that helps to end users in technical problems generated by his operating system. Basically, a system that interacts with users and guides them to possible solution.
I've implemented a facts base (.kfb) and a rules base (.krb) containing something like this:
## krb (filename: canaima_bc.krb)
r1
use flash(reinstalling)
when
canaima.flash(bad)
canaima.video_card(good)
canaima.browser(good)
r2
use flash(bad)
when
canaima.video_card(good)
canaima.browser(good)
canaima.flash_player(bad)
## kfb (filename: canaima.fkb)
flash(bad)
video_card(bad)
browser(bad)
flash_player(bad)
At main program, I have the following:
[...]engine.get_kb('canaima')engine.get_rb('canaima_bc')with engine.prove_goal('canaima.flash(bad)') as gen:for vars, plan in gen:print vars [...]
I'm a little confused with your example. Yes, this looks like it should find the canaima.flash(bad) fact; and when I run your example, it prints out an empty dictionary "{}". The dictionary is empty because there are no $variables in your goal (which is fine, you are not required to use any). Normally, in this case, you would not need to use the var variable. Perhaps the following code would make the results more obvious?
with engine.prove_goal('canaima.flash(bad)') as gen:
for vars, plan in gen:
print "Got a match"
print "vars:", vars
Hope this helps!
-Bruce
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Great work; Pyke is a great tool for implementing knowledge-based systems.
Now, I would want to develop a system which asks and answers users requirements about her technical problems with a specific OS. My knowledge base in the example tries to conceptualize this behavior.
For example at r1 (rule 1):
use flash(reinstalling)
when
canaima.flash(bad)
canaima.video_card(good)
canaima.browser(good)
… it tries to say:
"if flash is bad and video card is good and browser is good then you must reinstall flash" (if p, q, r -> s).
The behavior I expected is that from a fact that says "flash is bad" (flash(bad) in kfb file) at least the r1 rule is launched.
The exposed code is only a prototype of a more elaborated system with a web interface. How could I realize this prototype is running as it is expected?
Thanks in advanced, Bruce.
-Joaquin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, your interpretation of the rule is correct. Be sure not to confuse the canaima.flash fact with the canaima_bc.flash goal. They don't refer to the same thing. In your example, you were asking PyKE to prove canaima.flash, rather than canaima_bc.flash, so the canaima_bc rules would not be run (not needed) regardless of what facts you had declared in your .kfb file.
You have a couple of options to try to follow what's going on. One is to use the trace facility. The other is to add Python print statements in the rules:
use flash(reinstalling)
when
canaima.flash(bad)
python print "recognized the bad flash"
canaima.video_card(good)
canaima.browser(good)
HTH,
-Bruce
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
Primarily, I would like to thank all persons who developed this knowledge-based inference engine. I'm from a working team who develops the free software based distribution (www.canaima.softwarelibre.gob.ve) that uses venezuelan goverment in its technological park.
I am also coursing Knowlegde Engineering as university asignature and I've been developing a system using Pyke: a knowledge-based technical support system that helps to end users in technical problems generated by his operating system. Basically, a system that interacts with users and guides them to possible solution.
I've implemented a facts base (.kfb) and a rules base (.krb) containing something like this:
At main program, I have the following:
Executing this program results in:
canaima: 4 fact names, 4 universal facts, 0 case_specific facts
canaima_bc: 0 fc_rules, 0 triggered, 0 rerun
canaima_bc: 3 bc_rules, 0 goals, 0 rules matched
0 successes, 0 failures
… noting else.
I would expect some others results, maybe something that indicates a match of a rule.
Is the logic of rules and facts bases correct?
The documentation at pyke.sourceforge.net is fantastic, but I don't know what else to do. I'll appreciate all suggestions you could to give me.
Best regards.
-Joaquin
Hi Joaquin,
I'm a little confused with your example. Yes, this looks like it should find the canaima.flash(bad) fact; and when I run your example, it prints out an empty dictionary "{}". The dictionary is empty because there are no $variables in your goal (which is fine, you are not required to use any). Normally, in this case, you would not need to use the var variable. Perhaps the following code would make the results more obvious?
Hope this helps!
-Bruce
Bruce,
Great work; Pyke is a great tool for implementing knowledge-based systems.
Now, I would want to develop a system which asks and answers users requirements about her technical problems with a specific OS. My knowledge base in the example tries to conceptualize this behavior.
For example at r1 (rule 1):
… it tries to say:
"if flash is bad and video card is good and browser is good then you must reinstall flash" (if p, q, r -> s).
The behavior I expected is that from a fact that says "flash is bad" (flash(bad) in kfb file) at least the r1 rule is launched.
The exposed code is only a prototype of a more elaborated system with a web interface. How could I realize this prototype is running as it is expected?
Thanks in advanced, Bruce.
-Joaquin
Joaquin,
Yes, your interpretation of the rule is correct. Be sure not to confuse the canaima.flash fact with the canaima_bc.flash goal. They don't refer to the same thing. In your example, you were asking PyKE to prove canaima.flash, rather than canaima_bc.flash, so the canaima_bc rules would not be run (not needed) regardless of what facts you had declared in your .kfb file.
You have a couple of options to try to follow what's going on. One is to use the trace facility. The other is to add Python print statements in the rules:
HTH,
-Bruce