def test_find_conj3(self): a = self.a t1 = tree.atom_from_tree(tree.new_var(), a) t2 = tree.atom_from_tree(tree.new_var(), a) action = tree.atom_from_tree(tree.new_var(), a) goal = tree.atom_from_tree(tree.new_var(), a) conj = ( a.add(t.AtTimeLink, out=[t1, a.add(t.EvaluationLink, out=[a.add(t.PredicateNode, 'actionDone'), action])]), a.add(t.AtTimeLink, out=[t2, a.add(t.EvaluationLink, out=[a.add(t.PredicateNode, 'increased'), a.add(t.ListLink, out=[a.add(t.EvaluationLink, out=[goal, a.add(t.ListLink, out=[])])])])]), a.add(t.SequentialAndLink, out=[a.add(t.TimeNode, '11210347000'), a.add(t.TimeNode, '11210347010')]) ) conj = tuple(map(tree.tree_from_atom, conj)) res = tree.find_conj(conj,a.get_atoms_by_type(t.Atom))
def rpyc_bc(atomspace, target): conn = rpyc.classic.connect("localhost", 18813) c = conn.modules["logic_backend"].Chainer(atomspace) print c.rules result_tree_list = c.bc(target) result_realtree_list = [tree_with_real_atoms(tr, atomspace) for tr in result_tree_list] tree.Atom = Atom result_Atom_list = [atom_from_tree(tr, atomspace) for tr in result_realtree_list] for (tr, atom) in zip(result_tree_list, result_Atom_list): for tv in c.get_tvs(tr): atom.tv = TruthValue(tv.mean, tv.count) result_Handle_list = [tr.h for tr in result_Atom_list] return result_Handle_list
def rpyc_bc(atomspace, target): conn = rpyc.classic.connect('localhost', 18813) c = conn.modules['logic_backend'].Chainer(atomspace) print c.rules result_tree_list = c.bc(target) result_realtree_list = [ tree_with_real_atoms(tr, atomspace) for tr in result_tree_list ] tree.Atom = Atom result_Atom_list = [ atom_from_tree(tr, atomspace) for tr in result_realtree_list ] for (tr, atom) in zip(result_tree_list, result_Atom_list): for tv in c.get_tvs(tr): atom.tv = TruthValue(tv.mean, tv.count) result_Handle_list = [tr.h for tr in result_Atom_list] return result_Handle_list