I have not been able to figure out how to disable the sandbox, but I suspect you were right that there is a module problem. After fighting with it for another couple of hours, here’s the problem I’m having in detail:
This is the code that is being loaded when swipl runs, with the goal of server(8080).
% scasp_server.pl
:- use_module(library(http/http_server)).
:- use_module(library(pengines)).
:- use_module(library(sandbox)).
:- use_module(library(scasp)).
:- use_module(aggregates).
:- use_module(dates).
:- use_module(events).
:- use_module(ldap).
:- use_module(passthrough).
:- use_module(library(scasp/output)).
blawxrun(Query, Tree, Model, Attributes) :-
scasp(Query, [tree(Tree), model(Model), source(false)]),
ovar_analyze_term(t(Query, Tree, Model), [name_constraints(true), name_prefix('Var_')]),
( term_attvars(t(Query, Tree, Model), [])
-> Attributes = []
; copy_term(t(Query, Tree, Model), _, Attributes)
).
server(Port) :-
http_server([port(Port)]).
I then run swipl, run use_module(library(pengines)).
and run the following three queries:
?- pengine_rpc('http://localhost:8080', winner(X,Y),[src_text("winner(test,jason).")]).
X = test,
Y = jason.
?- pengine_rpc('http://localhost:8080', blawxrun(true,A,B,C),[src_text("winner(test,jason).")]).
A = query-[],
B = C, C = [].
?- pengine_rpc('http://localhost:8080', blawxrun(winner(X,Y),A,B,C),[src_text("winner(test,jason).")]).
ERROR: scasp_predicate `'user:winner'/2' does not exist
ERROR: In:
ERROR: [18] throw(error(existence_error(scasp_predicate,...),_121072))
ERROR: [13] setup_call_catcher_cleanup(pengines:pengine_create(...),pengines:wait_event(...,...,...),_121106,pengines:pengine_destroy_and_wait(...,'fb2e42ea-55d2-4390-9b33-d32645b9b22d',_121146)) at /usr/lib/swipl/boot/init.pl:678
ERROR: [11] toplevel_call(user:user: ...) at /usr/lib/swipl/boot/toplevel.pl:1318
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
I have no idea why, if both blawxrun and winner are available in the default module, blawxrun can’t find winner. I wonder if this line from the error message gives a clue: ERROR: [11] toplevel_call(user:user: ...) at /usr/lib/swipl/boot/toplevel.pl:1318
. I don’t think user:user
is what we want, there, is it?