use of fr.lirmm.graphik.graal.homomorphism.forward_checking.SimpleFC in project graal by graphik-team.
the class TestUtil method getHomomorphisms.
@SuppressWarnings({ "rawtypes" })
public static Homomorphism[] getHomomorphisms() {
BCC bcc0 = new BCC(true);
BCC bcc1 = new BCC(new GraphBaseBackJumping(), true);
BCC bcc2 = new BCC(new GraphBaseBackJumping(), true);
BCC bcc3 = new BCC(new GraphBaseBackJumping(), true);
BCC bcc4 = new BCC(new GraphBaseBackJumping(), true);
BCC bcc5 = new BCC(new GraphBaseBackJumping(), true);
return new Homomorphism[] { SmartHomomorphism.instance(), RecursiveBacktrackHomomorphism.instance(), // Without Optimization
new BacktrackHomomorphism(DefaultScheduler.instance(), StarBootstrapper.instance(), NoForwardChecking.instance(), NoBackJumping.instance()), // BackJumping
new BacktrackHomomorphism(DefaultScheduler.instance(), StarBootstrapper.instance(), NoForwardChecking.instance(), new GraphBaseBackJumping()), // BCC
new BacktrackHomomorphism(bcc0.getBCCScheduler(), StarBootstrapper.instance(), NoForwardChecking.instance(), bcc0.getBCCBackJumping()), new BacktrackHomomorphism(bcc1.getBCCScheduler(), StarBootstrapper.instance(), NoForwardChecking.instance(), bcc1.getBCCBackJumping()), // Forward Checking
new BacktrackHomomorphism(DefaultScheduler.instance(), StarBootstrapper.instance(), new NFC0(), new GraphBaseBackJumping()), new BacktrackHomomorphism(DefaultScheduler.instance(), StarBootstrapper.instance(), new NFC2(), new GraphBaseBackJumping()), new BacktrackHomomorphism(DefaultScheduler.instance(), StarBootstrapper.instance(), new NFC2(true), new GraphBaseBackJumping()), new BacktrackHomomorphism(DefaultScheduler.instance(), StarBootstrapper.instance(), new SimpleFC(), new GraphBaseBackJumping()), new BacktrackHomomorphism(DefaultScheduler.instance(), StarBootstrapper.instance(), new NFC2WithLimit(8), new GraphBaseBackJumping()), // Bootstrapper
new BacktrackHomomorphism(bcc2.getBCCScheduler(), StarBootstrapper.instance(), new NFC2(), bcc2.getBCCBackJumping()), new BacktrackHomomorphism(bcc3.getBCCScheduler(), StatBootstrapper.instance(), new NFC2(), bcc3.getBCCBackJumping()), new BacktrackHomomorphism(bcc4.getBCCScheduler(), DefaultBootstrapper.instance(), new NFC2(), bcc4.getBCCBackJumping()), new BacktrackHomomorphism(bcc5.getBCCScheduler(), AllDomainBootstrapper.instance(), new NFC2(), bcc5.getBCCBackJumping()) };
}
use of fr.lirmm.graphik.graal.homomorphism.forward_checking.SimpleFC in project graal by graphik-team.
the class ForwardCheckingTest method simpleFCTest1.
@Test
public void simpleFCTest1() throws HomomorphismException, IteratorException, ParseException, AtomSetException {
Profiler profiler = new CPUTimeProfiler();
InMemoryAtomSet data = new DefaultInMemoryGraphStore();
data.addAll(DlgpParser.parseAtomSet("p(a,b), q(b,c)."));
ConjunctiveQuery query = DlgpParser.parseQuery("?(X,Y,Z) :- p(X,Y), q(Y,Z).");
Homomorphism<ConjunctiveQuery, AtomSet> h = new BacktrackHomomorphism(new SimpleFC());
h.setProfiler(profiler);
CloseableIterator<Substitution> results = h.execute(query, data);
while (results.hasNext()) {
results.next();
}
results.close();
Assert.assertEquals(7, profiler.get("#calls"));
}
Aggregations