I'm trying to define a knowledge base where a disease has a list of symptoms. Here's a snippet:
import pytholog as pl
diseases_kb = pl.KnowledgeBase()
diseases_kb([
"disease(diabetes, [frequent_urination, extreme_thirst])",
"disease(pneumonia, [cough, fever, shortness_of_breath])",
])
However, when I query this:
print(diseases_kb.query(pl.Expr("disease(diabetes, Symptoms)")))
it just returns ['No'].
It looks like, lists are not being recognized by pytholog. I tried using (), list(), whatever syntax that I hope would work but nothing works. The library removes '(' and ')', and splits the queries by ',' which I think is the reason why it's not recognizing lists. Is there a workaround for this?
disease(diabetes, [frequent_urination, extreme_thirst])I assume it's because the kb doesn't know by default that a list of things following a disease are called symptoms. So when you ask for Symptoms, the kb has never seen that word before and doesn't know what it is. Anyway, I'm no expert, and this is just a guess.disease_symptom(pneumonia, cough)etc. would be easier to understand and work with. No need to create lists yourself.setof,findall, etc. don't seem to work on pytholog either. (I'm new to logic programming so maybe there's a much easier way?)