Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 // Copyright (C) 2003  Rafael H. Bordini, Jomi F. Hubner, et al.
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
 // version 2.1 of the License, or (at your option) any later version.
 // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
// To contact the authors:
package jason.stdlib;

Internal action: .abolish.

Description: removes all beliefs that match the argument. As for the "-" operator, an event will be generated for each deletion.


  • + pattern (literal or variable): the "pattern" for what should be removed.


  • .abolish(b(_)): remove all b/1 beliefs, regardless of the argument value.
  • .abolish(c(_,t)): remove all c/2 beliefs where the second argument is 2.
  • .abolish(c(_,_)[source(ag1)]): remove all c/2 beliefs that have ag1 as source.
  • .abolish(_[source(ag1)]): remove any beliefs that have ag1 as source.
public class abolish extends DefaultInternalAction {
    @Override public int getMinArgs() { return 1; }
    @Override public int getMaxArgs() { return 1; }
    @Override protected void checkArguments(Term[] argsthrows JasonException {
        super.checkArguments(args); // check number of arguments
        if (!args[0].isLiteral() & !args[0].isVar())
            throw JasonException.createWrongArgument(this,"first argument must be a literal or variable.");
    @Override public Object execute(TransitionSystem tsUnifier unTerm[] argsthrows Exception {
        ts.getAg().abolish((Literal)args[0], un);
        return true;
New to GrepCode? Check out our FAQ X