use of at.ac.tuwien.kr.alpha.core.common.fixedinterpretations.IntPredicateInterpretation in project Alpha by alpha-asp.
the class LiteralBindingNonBindingVariablesTest method testPositiveExternalLiteral.
@Test
public void testPositiveExternalLiteral() {
externals.put("ext", new IntPredicateInterpretation(i -> i > 0));
Rule<Head> rule = parser.parse("p(X) :- q(Y), &ext[Y](X).", externals).getRules().get(0);
Literal literal = rule.getBody().stream().filter((lit) -> lit.getPredicate().getName().equals("ext")).findFirst().get();
assertEquals(false, literal.isNegated());
expectVariables(literal.getBindingVariables(), "X");
expectVariables(literal.getNonBindingVariables(), "Y");
}
use of at.ac.tuwien.kr.alpha.core.common.fixedinterpretations.IntPredicateInterpretation in project Alpha by alpha-asp.
the class LiteralBindingNonBindingVariablesTest method testNegativeExternalLiteral.
@Test
public void testNegativeExternalLiteral() {
externals.put("ext", new IntPredicateInterpretation(i -> i > 0));
Literal literal = parser.parse("p(X) :- q(Y), not &ext[Y](X).", externals).getRules().get(0).getNegativeBody().stream().findFirst().get();
assertEquals(true, literal.isNegated());
expectVariables(literal.getBindingVariables());
expectVariables(literal.getNonBindingVariables(), "X", "Y");
}
Aggregations