If hit the snag of No permission to call sandboxed `retract(_1684)’ when trying to translate an SQL delete example in my Swish database tutorial.
Is there some magic incantation to allow facts to be removed from the database in Swish?
If hit the snag of No permission to call sandboxed `retract(_1684)’ when trying to translate an SQL delete example in my Swish database tutorial.
Is there some magic incantation to allow facts to be removed from the database in Swish?
retract/1 works fine, but the argument needs to be a sufficiently instantiated term. If not, it can be a module qualified term and retract things outside the sandbox. So you get something like
forall(member(p(X), Terms), retract(p(X))).
Many thanks for the prompt response as always @jan
For those who need a fuller explanation, this works:
forall(member(student(SID, SName, GPA, SizeHS), Students),
retract(student(SID, SName, GPA, SizeHS))).
I originally wrote forall(member(Student, Students), retract(Student)).
which caused the error.