use of edu.cmu.ml.proppr.prove.wam.WamInterpreter in project ProPPR by TeamCohen.
the class SplitFactsPluginTest method test.
@Test
public void test() throws LogicProgramException {
int input = 0;
int output = 0;
int constants = Configuration.USE_WAM;
int modules = 0;
Configuration c = new Configuration(("--programFiles " + GrounderTest.RULES + ":" + GrounderTest.FACTS + ":" + ADDLFACTS).split(" "), input, output, constants, modules);
assertEquals("# of plugins", c.plugins.length, 1);
assertEquals("# of members", ((SplitFactsPlugin) c.plugins[0]).plugins.size(), 2);
assertTrue("claim", c.plugins[0]._claim("validClass/1"));
Query q = Query.parse("validClass(X)");
WamInterpreter interp = new WamInterpreter(c.program, c.plugins);
int queryStartAddr = c.program.size();
q.variabilize();
c.program.append(q);
interp.executeWithoutBranching(queryStartAddr);
List<Outlink> outs = c.plugins[0].outlinks(interp.saveState(), interp, true);
assertEquals("# outlinks", 6, outs.size());
}
use of edu.cmu.ml.proppr.prove.wam.WamInterpreter in project ProPPR by TeamCohen.
the class WamInterpreterTest method test.
@Test
public void test() throws IOException {
WamProgram program = WamBaseProgram.load(new File(SimpleProgramProverTest.PROGRAM));
WamInterpreter interp = new WamInterpreter(program, new WamPlugin[0]);
// ? :- coworker(steve,X).
Query query = new Query(new Goal("coworker", new ConstantArgument("steve"), new ConstantArgument("X")));
List<State> answers = findAnswers(interp, query);
for (State s : answers) System.out.println(s);
assertEquals(2, answers.size());
}
Aggregations