Show KIFGoalCase.java syntax highlighted
/**
* @(#) KIFGoalCase.java
* @author <a href:mailto="rick@rickmurphy.org">Rick Murphy</a>
* @version 0.1
* @see <a href="http://www.rickmurphy.org/cps-license.html">Citizen Privacy Service License</a>
*/
package org.rickmurphy.unit;
import jtp.*;
import jtp.context.*;
import jtp.disp.DispatcherUtils;
import jtp.fol.*;
import jtp.gmp.*;
import jtp.modelim.AskingQueryProcessor;
import junit.framework.TestCase;
/**
*/
public class KIFGoalCase extends TestCase {
BasicReasoningContext context = new BasicReasoningContext();
/**
*/
protected void setUp() throws Exception{
//System.setProperty("jtp.context.PrintStreamTracer.trace","true");
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());
((PrintStreamTracer)context.getTracer()).setTraceDepth(5);
((PrintStreamTracer)context.getTracer()).setVerbosityLevel(5);
((PrintStreamTracer)context.getTracer()).setOutput(System.out);
}//setUp
/**
*/
public void testSentenceOne() throws Exception{
context.tellString("(=> (exists (?x ?y) (and (disclosure-request ?x)(party ?y))) (granted-request ?x ?y))");
// step 2: remove material implication connective
context.tellString("(or (not(and (disclosure-request ?x)(party ?y))) (granted-request ?x ?y))");
// step 3: reduce scope of negation, need to review kif syntax
// step 5: eliminate existential quantifiers by introducing skolem constants
// context.tellString("(or (not (or (disclosure-request c)(party k))) (granted-request c k))");
}//testSentenceOne
/**
*/
public void testAskSentenceOne() throws Exception{
assertNotNull(context.ask("(=> (exists (?x ?y) (and (disclosure-request ?x)(party ?y))) (granted-request ?x ?y))"));
}//testAsk
}//SentenceOneCase
See more files for this project here