No permission to call sandboxed `assertz(_1424)'

I’m using: https://swish.swi-prolog.org/

I want the code to: use assertz for general atomic terms without having to specify the term in advance.

But what I’m getting is: “No permission to call sandboxed `assertz(_1424)’”

My code looks like this:

execute_conclusion(Conclusion1 and Conclusion2,Output) :-
	execute_conclusion(Conclusion1,C1),
	execute_conclusion(Conclusion2,C2), !,
    append(C1,C2,Output). 
execute_conclusion(Conclusion,[Conclusion])  :- !, 
    assertz(Conclusion). 

Unfortunately, SWISH doesn’t allow for unconstrained asserting of terms as that can break the required isolation and sandboxing of user queries. You can assert, but only to predicates known at compile time. Thus, assertz(p(X,Y)). is fine.

Probably a little redesign can help to make this possible. Otherwise you can only use a local installation of SWI-Prolog or a locally deployed SWISH where you can disable the sandboxing.

2 Likes

Excellent! Thanks for the clarification jan!