def ask(self, query, context, askOne): """ generated source for method ask """ goals = LinkedList() goals.add(query) answers = HashSet() alreadyAsking = HashSet() self.ask(goals, KnowledgeBase(context), Substitution(), ProverCache(), VariableRenamer(), askOne, answers, alreadyAsking) results = HashSet() for theta in answers: results.add(Substituter.substitute(query, theta)) return results
def instantiate(self, template, index, theta, results): """ generated source for method instantiate """ if template.getBody().size() == index: results.add(Substituter.substitute(template, theta)) else: if isinstance(literal, (GdlSentence, )): for instantiation in getInstantiations(sentence.__name__): if thetaPrime != None: thetaCopy = thetaCopy.compose(thetaPrime) self.instantiate(template, index + 1, thetaCopy, results) else: self.instantiate(template, index + 1, theta, results)
def put(self, sentence, renamedSentence, answers): """ generated source for method put """ results = HashSet() for answer in answers: results.add(Substituter.substitute(sentence, answer)) self.contents.put(renamedSentence, results)