SQLite format 3@ o8o.?Ù Ö ü0Þ ú§ ü ½>))‚7tableoutput_historyoutput_historyCREATE TABLE output_history (session integer, line integer, output text, PRIMARY KEY (session, line));O)indexsqlite_autoindex_output_history_1output_history*‚+tablehistoryhistoryCREATE TABLE history (session integer, line integer, source text, source_raw text, PRIMARY KEY (session, line))-Aindexsqlite_autoindex_history_1historyP++Ytablesqlite_sequencesqlite_sequenceCREATE TABLE sqlite_sequence(name,seq)M‚mtablesessionssessionsCREATE TABLE sessions (session integer primary key autoincrement, start timestamp, end timestamp, num_cmds integer, remark text)  ³Ä¢D€åá]; ÷ Õ ³ A 2022-01-16 19:00:04.948260 A 2022-01-11 19:24:25.323366 A 2022-01-11 14:31:31.829926 A 2022-01-11 14:28:47.997855 A 2022-01-11 13:30:36.355871 A 2022-01-11 13:30:16.543540 A 2022-01-11 13:29:41.167152 A 2022-01-11 13:29:09.966527 A 2022-01-11 13:24:43.340661 A 2022-01-11 10:00:54.795729;AA 2022-01-11 01:46:05.9500592022-01-11 02:01:07.880804 :AA 2022-01-11 01:56:33.6627052022-01-11 01:56:42.808063 A 2022-01-11 02:01:08.465706 A 2022-01-08 12:07:19.281435:AA 2022-01-08 12:07:13.9935672022-01-08 12:07:18.848547 òò sessions'=8ûöñìçâÝØÓÎÉÄ¿ºµ°«¦¡œ—’ˆƒ~ytoje`[VQLGB=7X6V5T4R3O2M1J0G/E.C-@,>+<*:)8(5'2&/%,$)#&"#!    Z 6úòëãÛÓËû³«£›“‹„|tld\TLD<4,$ üõíåÝÕÍŽµ­¥•†~vnf^VNF>6.& þ ö î æ Þ Ö Î Æ ¾ ¶ ® ¦ ž – Ž † ~ v n f ^ V N F > 6+Z*Y)X(W'V&U%T$S#R"Q!P ONMLKJIHGFEDCBA@?>= < ; : 9 87654321 0/ . - , + *)('&%$# "!                   À N5ˆˆ!ˆ!from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = "between(1,1000,X)" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory, debug=True) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = "between(1,1000,X)" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory, debug=True) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ ˆˆfrom pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = "between(1,1000,X)" factory = PengineBuilder(urlserver="http://localhost:3020", destroy=False, ask=q) pengine = Pengine(builder=factory, debug=True) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = "between(1,1000,X)" factory = PengineBuilder(urlserver="http://localhost:3020", destroy=False, ask=q) pengine = Pengine(builder=factory, debug=True) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)†o†s†s#export import time import gym import minerl # noqa # OpenCog from opencog.logger import log from opencog.pln import * from opencog.type_constructors import * from opencog.utilities import set_default_atomspace # ROCCA from rocca.envs.wrappers import MineRLWrapper from rocca.envs.wrappers.minerl_wrapper import minerl_single_action from rocca.agents import OpencogAgent from rocca.agents.utils import * from rocca.utils import *#export import time import gym import minerl # noqa # OpenCog from opencog.logger import log from opencog.pln import * from opencog.type_constructors import * from opencog.utilities import set_default_atomspace # ROCCA from rocca.envs.wrappers import MineRLWrapper from rocca.envs.wrappers.minerl_wrapper import minerl_single_action from rocca.agents import OpencogAgent from rocca.agents.utils import * from rocca.utils import *> EE#default_exp agents.navigate#default_exp agents.navigate ï :ïˆHˆcˆ5get_ipython().system('pip install pengines') from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = "between(1,1000,X)" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = "between(1,1000,X)" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ`ˆ{ˆMget_ipython().system('pip install pengines') from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = "between(1,1000,X)" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory, debug=True) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = "between(1,1000,X)" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory, debug=True) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ`ˆ{ˆMget_ipython().system('pip install pengines') from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = "between(1,1000,X)" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory, debug=True) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = "between(1,1000,X)" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory, debug=True) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) 5 ±b5ˆ* ˆEˆget_ipython().system('pip install pengines') from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆL ˆgˆ9get_ipython().system('pip install pengines') from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'c80("How are you?")' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'c80("How are you?")' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆLˆgˆ9get_ipython().system('pip install pengines') from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'e2c("How are you?")' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'e2c("How are you?")' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) N Ï„Nˆ3 ˆ7ˆ7 #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'member(X,[1,2,3])' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'member(X,[1,2,3])' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆH ˆcˆ5 get_ipython().system('pip install pengines') from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'member(X,[1,2,3])' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'member(X,[1,2,3])' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ. ˆIˆ get_ipython().system('pip install pengines') from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'true' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'true' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)  ²ZˆT ˆYˆY#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'nop(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'nop(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆUˆYˆY #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'nop(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'nop(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆKˆOˆO #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'print_tree(member(X,[1,2,3]))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'print_tree(member(X,[1,2,3]))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header))from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header)) $$»Q»U»Ufrom urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = ll() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header))!pip install urllib from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header)) åå¼¼+»}get_ipython().system('pip install urllib') from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.reada next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header))!pip install urllib json from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header)) ÛÛ¼¼5¼get_ipython().system('pip install urllib json') from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() dall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header))!pip install json from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header)) éé¼ ¼'»yget_ipython().system('pip install json') from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.rea next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header))from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header)) $$»Q»U»Ufrom urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header))from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header)) $$»Q»U»Ufrom urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header))from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header)) $$»Q»U»Ufrom urllib.request import Request, urlopen import json # Make the URL urlbase = "http://localhost:4242" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 =xt_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header))from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://logicmoo.org:3020" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header)) »W»[»[ from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://logicmoo.org:3020" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header))from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://logicmoo.org:3020" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = next_response.readall() next_response_string = next_response_utf8.decode("utf-8") next_response_dict = json.JSONDecoder().decode(next_response_string) return next_response_dict print(get_more(urlbase, pengine_id, header)) print(get_more(urlbase, pengine_id, header)) »W»[»[ from urllib.request import Request, urlopen import json # Make the URL urlbase = "http://logicmoo.org:3020" url_action = "/pengine/create" url = urlbase + url_action # Header is dict not JSON for urllib header = dict() header["User-Agent"] = "PythonPengine" header["Accept"] = "application/json" header["Accept-Language"] = "en-us,en;q=0.5" header["Content-type"] = "application/json" print("Header information.") print(header, type(header)) # Encode the body as json in utf8 data_ = {} data = json.JSONEncoder().encode(data_) data_utf8 = data.encode("utf-8") print("Printing data information...") print(data, type(data)) # Request using urllib due to request libs broken implementation. request_object = Request(url, data=data_utf8, headers=header) response = urlopen(request_object) response_string_utf8 = response.readall() response_string = response_string_utf8.decode("utf-8") def parse_create(response_string): pengine_id_char_list = [] pengine_slave_limit_char_list = [] state = 0 print(response_string) for char in response_string: if state == 0 and char.isnumeric(): print("Found first number") state = 1 if state == 1 and char.isnumeric(): pengine_id_char_list.append(char) elif state == 1: state = 2 if state == 2 and char.isnumeric(): pengine_slave_limit_char_list.append(char) pengine_id = "".join(pengine_id_char_list) pengine_slave_limit = "".join(pengine_slave_limit_char_list) print("Parse Results: Id: {}, Limit: {}".format(pengine_id, pengine_slave_limit)) return pengine_id, pengine_slave_limit # ToDo: Super fragile parsing!! Only handles one digit pengine slave counts. # print(len(response_string)) # assert len(response_string) == 68 # print(response_string[8:47], response_string[62]) # pengine_id = response_string[8:47] # pengine_slave_count = response_string[62] pengine_id, pengine_slave_count = parse_create(response_string) # Start the query cycle. print("Starting query") # Initial creation is done -- pengine id aquired and slave counts named. url_ask = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) # Error: Raises error print("URL: ", url_ask) # Header has a different Content-type header["Content-type"] = "application/x-prolog; charset=UTF-8" print("Header: ", header) # Create the body. body_ask = "ask({}, []).".format("member(X, [1,2,3])") # po.getrequestbodyask print("Body: ", body_ask) body_utf8 = body_ask.encode("utf-8") query_request = Request(url_ask, data=body_utf8, headers=header) query_response = urlopen(query_request) query_response_utf8 = query_response.readall() query_response_string = query_response_utf8.decode("utf-8") print("Response received: ", query_response_string) query_response_dict = json.JSONDecoder().decode(query_response_string) print("Decoded JSON: ", query_response_dict) print("Data from JSON: ", query_response_dict['data']) # More calls. def get_more(urlbase, pengine_id, header): ''' This function gets more responses, if they exist.''' # Make URL print("Getting more...") url_next = urlbase + "/pengine/send?format=json&id={}".format(pengine_id) print("Next URL: ", url_next) # Pass headers as normal. # Make body. body = "next." print("Next body: ", body) body_utf8 = body.encode("utf-8") print("Headers: ", header) next_request = Request(url_next, data=body_utf8, headers=header) next_response = urlopen(next_request) next_response_utf8 = ne  ¨VˆMˆQˆQ #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆOˆSˆS #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆUˆYˆY #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'nop(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'nop(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) j ®jŒAŒEŒEfrom pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://localhost:4242", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory, debug=True) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://localhost:4242", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory, debug=True) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))ˆOˆSˆS#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '(print_tree(member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) „ ¶„Œ/ Œ3Œ3from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))ŒGŒKŒKfrom pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory, debug=True) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory, debug=True) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name])) m Â…mˆ#ˆˆ#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ:" ˆ?ˆ?#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '((member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '((member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ;!ˆ?ˆ?#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '((member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '((member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) ž 趞ˆ&ˆˆ#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Œ/%Œ3Œ3from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))ˆ$ˆˆ#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) ´ Р´‡i)‡m‡m#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020") pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020") pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ-(ˆ1ˆ1#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q, debug=True) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q, debug=True) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ-'ˆ1ˆ1#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory, debug=True) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory, debug=True) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) ¾ ø-,ˆ1ˆ1 #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q, Debug=True) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q, Debug=True) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ+ˆ ˆ  #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ*ˆ ˆ  #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=True) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=True) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) ¢ к¢ˆ/ˆˆ#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'X=1' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=True, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'X=1' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=True, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ.ˆˆ #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=True, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=True, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ--ˆ1ˆ1 #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q, debug=True) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'ls' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q, debug=True) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) c Ï™cˆ32ˆ7ˆ7#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,wote(ls)).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,wote(ls)).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ31ˆ7ˆ7#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,wote(ls)).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,wote(ls)).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ.0 ˆ3ˆ3#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,wote(ls))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=True, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,wote(ls))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=True, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) ` Π`ˆ=5ˆAˆA#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,(write("hi"))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,(write("hi"))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ+4ˆ/ˆ/#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wets(S,(ls)).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wets(S,(ls)).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Œ/3Œ3Œ3from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name])) T ¸‚Tˆ+8ˆ/ˆ/ #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,(ls)).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,(ls)).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ37ˆ7ˆ7#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,weto(ls)).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,weto(ls)).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆE6ˆIˆI#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,weto(write("hi"))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,weto(write("hi"))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) 0 0‰a:‰e‰e #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)‰i9‰m‰m #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_property(CO,alias(user_error)),set_property(CO,alias(current_output)),ls))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_property(CO,alias(user_error)),set_property(CO,alias(current_output)),ls))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) ê Îê‰a<‰e‰e #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Œ/;Œ3Œ3 from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name])) 0 0‰i>‰m‰m#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)‰a=‰e‰e#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) â Îâ‰i@‰m‰m#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Œ/?Œ3Œ3from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))  Š CŠŠ#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'a(X)' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'a(X)' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)‰uB‰y‰y#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)‰mA‰q‰q#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'X=wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = 'X=wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)  ÔÂŒEŒŒ#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'with_no_dmsg(wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),c80("A man farts")))))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'with_no_dmsg(wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),c80("A man farts")))))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Œ)DŒ-Œ-#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'with_no_dmsg(wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),c80("A man farts"))))),assert(a(S))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'with_no_dmsg(wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),c80("A man farts"))))),assert(a(S))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)  ÂŒ/GŒ3Œ3from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))Š;FŠ?Š?#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'parse_into("A man farts",X)' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'parse_into("A man farts",X)' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) N ˆNŠ7JŠ;Š;#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'parse_into("A man farts")' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'parse_into("A man farts")' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Š7IŠ;Š;#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'parse_into("A man farts")' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'parse_into("A man farts")' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Š;HŠ?Š?#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'parse_into("A man farts",X)' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'parse_into("A man farts",X)' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) N ˆNŠ7MŠ;Š;#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = "parse_into('A man farts')" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = "parse_into('A man farts')" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Š7LŠ;Š;#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = "parse_into('A man farts')" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = "parse_into('A man farts')" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ˆ;Kˆ?ˆ?#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '((member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '((member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) ” ΔŠ7OŠ;Š; #!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = "parse_into('A man farts')" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = "parse_into('A man farts')" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Œ/NŒ3Œ3from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name])) x ð¸xŠ=RŠAŠA##!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),a(X)))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),a(X)))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Š5QŠ9Š9"#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'e2ec("A man waits"),a(X)' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = 'e2ec("A man waits"),a(X)' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Š PŠŠ!#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = "a(X)" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = "a(X)" factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) J ¦JŠYTŠ]Š]%#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X)))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X)))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ŠWSŠ[Š[$#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X))))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X))))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) r ÎrŠYVŠ]Š]'#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X)))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X)))).' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)Œ/UŒ3Œ3&from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name]))from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine from prologterms import TermGenerator, PrologRenderer, Program, Var P = TermGenerator() X = Var('X') Y = Var('Y') Z = Var('Z') R = PrologRenderer() p = Program( P.ancestor(X,Y) <= (P.parent(X,Z), P.ancestor(Z,Y)), P.ancestor(X,Y) <= P.parent(X,Y), P.parent('a','b'), P.parent('b','c'), P.parent('c','d') ) q = P.ancestor(X,Y) factory = PengineBuilder(urlserver="http://logicmoo.org:3020", srctext=R.render(p), ask=R.render(q)) pengine = Pengine(builder=factory) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) for p in pengine.currentQuery.availProofs: print('{} <- {}'.format(p[X.name], p[Y.name])) ° ˆ°‹UX‹Y‹Y)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X)))),write(X),fail' q = '((e2ec("A man waits"),retract(e2eco(X))))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X)))),write(X),fail' q = '((e2ec("A man waits"),retract(e2eco(X))))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)ŠuWŠyŠy(#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X)))),write(X),fail' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X)))),write(X),fail' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs) < (<‰iZ‰m‰m+#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '((member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) from IPython.core.display import display, HTML display(HTML('

Hello, world!

')) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine q = '((member(X,[1,2,3])))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) from IPython.core.display import display, HTML display(HTML('

Hello, world!

')) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)‹UY‹Y‹Y*#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X)))),write(X),fail' q = '((e2ec("A man waits"),retract(e2eco(X))))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)#!pip install pengines from pengines.Builder import PengineBuilder from pengines.Pengine import Pengine #q = 'X=((wots(S,((current_output(CO),set_stream(CO,alias(user_error)),set_stream(CO,alias(current_output)),ls))),fail))' q = '((e2ec("A man waits"),retract(e2eco(X)))),write(X),fail' q = '((e2ec("A man waits"),retract(e2eco(X))))' factory = PengineBuilder(urlserver="http://logicmoo.org:3020", destroy=False, ask=q) pengine = Pengine(builder=factory) # Start query. print() print(pengine.currentQuery.availProofs, "Has More? ", pengine.currentQuery.hasMore) print() # Get next query. print(pengine.state.current_state) while pengine.currentQuery.hasMore: pengine.doNext(pengine.currentQuery) print(pengine.currentQuery.availProofs)