data.add(new Triple(c, q, d));
List<Rule> rules = Rule.parseRules(
"[r1: (c r ?x) <- (?x p f(?x b))]" +
"[r2: (?y p f(a ?y)) <- (c q ?y)]"
);
Reasoner reasoner = createReasoner(rules);
InfGraph infgraph = reasoner.bind(data);
TestUtil.assertIteratorValues(this,
infgraph.find(c, r, null), new Object[] { } );
data.add(new Triple(c, q, a));
rules = Rule.parseRules(
"[r1: (c r ?x) <- (?x p f(?x a))]" +
"[r2: (?y p f(a ?y)) <- (c q ?y)]"
);
reasoner = createReasoner(rules);
infgraph = reasoner.bind(data);
TestUtil.assertIteratorValues(this,
infgraph.find(c, r, null),
new Object[] {
new Triple(c, r, a)
} );
data = Factory.createGraphMem();
data.add(new Triple(a, q, a));
data.add(new Triple(a, q, b));
data.add(new Triple(a, q, c));
data.add(new Triple(b, q, d));
data.add(new Triple(b, q, b));
rules = Rule.parseRules(
"[r1: (c r ?x) <- (?x p ?x)]" +
"[r2: (?x p ?y) <- (a q ?x), (b q ?y)]"
);
reasoner = createReasoner(rules);
infgraph = reasoner.bind(data);
TestUtil.assertIteratorValues(this,
infgraph.find(c, r, null),
new Object[] {
new Triple(c, r, b)
} );
rules = Rule.parseRules(
"[r1: (c r ?x) <- (?x p ?x)]" +
"[r2: (a p ?x) <- (a q ?x)]"
);
reasoner = createReasoner(rules);
infgraph = reasoner.bind(data);
TestUtil.assertIteratorValues(this,
infgraph.find(c, r, null),
new Object[] {
new Triple(c, r, a)
} );