import jtp.*; import jtp.context.*; import jtp.disp.DispatcherUtils; import jtp.fol.*; import jtp.gmp.*; import jtp.modelim.AskingQueryProcessor; public class Test { public static void main (String [] argv) throws Exception { BasicReasoningContext context = new BasicReasoningContext(); context.defaultSetup(); context.setMaxDepth(10); //A KB for FOL clauses ClauseOrientationKB ckb = new ClauseOrientationKB(); context.add(ckb); //Add to context //Add basic reasoners to asking dispatcher DispatcherUtils.addToDispatcher(ckb.getAskingReasoner(), context.getAskingDispatcher()); //Add basic reasoners to telling dispatcher DispatcherUtils.addToDispatcher(ckb.getTellingReasoner(), context.getTellingDispatcher()); context.tellString("(age fred 42)"); ReasoningStepIterator rsi = context.ask("(age fred ?x)"); ReasoningStep rs = null; while ((rs = rsi.next()) != null) { Literal lit = SubstUtils.deReferenceLiteral((Literal)rs.getGoal()); System.out.println("X = " + lit.getArgs().get(1)); } } }