public class OntologicalAction implements SemanticAction { public OntologicalAction( SemanticCapabilities myCapabilities, Term actionPattern, Formula postconditionPattern, Formula preconditionPattern) {...} ... public void perform(OntoActionBehaviour behaviour) { behaviour.setState(SemanticBehaviour.SUCCESS); } } ============================================ class BookSellerCapabilities extends SemanticCapabilities { class SellBookAction extends OntologicalAction() { public SellBookAction() { super(BookSellerCapabilities.this, "(SELL_BOOK :buyer ??buyer :isbn ??isbn :price ??price)", "(not (for_sale ??isbn ??actor))", // postcondition "(for_sale ??isbn ??actor)"); // precondition } public void perform(OntoActionBehaviour behaviour) {...} } ... protected SemanticActionTable setupSemanticActions() { SemanticActionTable t = super. setupSemanticActions(); t.addSemanticAction(new SellBookAction()); return t; } } ============================================= Term isbn; Term buyer; Term price; public void perform(OntoActionBehaviour behaviour) { try { switch (behaviour.getState()) { case OntoActionBehaviour.START: isbn = getActionParameter("isbn"); buyer = getActionParameter("buyer"); price = getActionParameter("price"); behaviour.setState(OntoActionBehaviour.RUNNING); break; case OntoActionBehaviour.RUNNING: System.out.println("Bingo! " + getAgentName() + " sells the book " + isbn + " to " + buyer + " at " + price + " euros "); behaviour.setState(OntoActionBehaviour.SUCCESS); break; } } catch (Exception e) { behaviour.setState(OntoActionBehaviour.EXECUTION_FAILURE); } }