Search in sources :

Example 1 with RestrictedProductivityChecker

use of fr.lirmm.graphik.graal.core.unifier.checker.RestrictedProductivityChecker in project graal by graphik-team.

the class GRDTest method test2.

@Test
public void test2() throws ParseException {
    Rule r1 = DlgpParser.parseRule("wf(X0,Y0), o(Y0) :- e(X0).");
    Rule r2 = DlgpParser.parseRule("wf(Y1,X1) :- o(Y1).");
    Substitution s = new HashMapSubstitution();
    s.put(DefaultTermFactory.instance().createVariable("Y1"), DefaultTermFactory.instance().createVariable("Y0"));
    RestrictedProductivityChecker filter = RestrictedProductivityChecker.instance();
    Assert.assertTrue(filter.isValidDependency(r1, r2, s));
}
Also used : HashMapSubstitution(fr.lirmm.graphik.graal.core.HashMapSubstitution) Substitution(fr.lirmm.graphik.graal.api.core.Substitution) RestrictedProductivityChecker(fr.lirmm.graphik.graal.core.unifier.checker.RestrictedProductivityChecker) Rule(fr.lirmm.graphik.graal.api.core.Rule) HashMapSubstitution(fr.lirmm.graphik.graal.core.HashMapSubstitution) Test(org.junit.Test)

Example 2 with RestrictedProductivityChecker

use of fr.lirmm.graphik.graal.core.unifier.checker.RestrictedProductivityChecker in project graal by graphik-team.

the class GRDTest method test.

@Test
public void test() throws ParseException {
    Rule r1 = DlgpParser.parseRule("wf(X0,Y0), o(Y0) :- e(X0).");
    Rule r2 = DlgpParser.parseRule("e(X1), wf(X1,Y1) :- o(Y1).");
    Substitution s = new HashMapSubstitution();
    s.put(DefaultTermFactory.instance().createVariable("Y1"), DefaultTermFactory.instance().createVariable("Y0"));
    RestrictedProductivityChecker filter = RestrictedProductivityChecker.instance();
    Assert.assertFalse(filter.isValidDependency(r1, r2, s));
}
Also used : HashMapSubstitution(fr.lirmm.graphik.graal.core.HashMapSubstitution) Substitution(fr.lirmm.graphik.graal.api.core.Substitution) RestrictedProductivityChecker(fr.lirmm.graphik.graal.core.unifier.checker.RestrictedProductivityChecker) Rule(fr.lirmm.graphik.graal.api.core.Rule) HashMapSubstitution(fr.lirmm.graphik.graal.core.HashMapSubstitution) Test(org.junit.Test)

Aggregations

Rule (fr.lirmm.graphik.graal.api.core.Rule)2 Substitution (fr.lirmm.graphik.graal.api.core.Substitution)2 HashMapSubstitution (fr.lirmm.graphik.graal.core.HashMapSubstitution)2 RestrictedProductivityChecker (fr.lirmm.graphik.graal.core.unifier.checker.RestrictedProductivityChecker)2 Test (org.junit.Test)2