Search in sources :

Example 16 with DlgpParser

use of fr.lirmm.graphik.graal.io.dlp.DlgpParser in project graal by graphik-team.

the class DefaultKnowledgeBaseQueryTest method testInfinityQueryWithTimeout.

/**
 * Test method for
 * {@link fr.lirmm.graphik.graal.kb.DefaultKnowledgeBase#query(fr.lirmm.graphik.graal.api.core.Query, long)}.
 * @throws AtomSetException
 * @throws KnowledgeBaseException
 * @throws ParseException
 * @throws IteratorException
 * @throws TimeoutException
 * @throws KBBuilderException
 */
@Test(expected = TimeoutException.class)
public void testInfinityQueryWithTimeout() throws AtomSetException, ParseException, KnowledgeBaseException, IteratorException, TimeoutException, KBBuilderException {
    KBBuilder kbBuilder = new KBBuilder();
    kbBuilder.setApproach(Approach.SATURATION_ONLY);
    kbBuilder.addAll(new DlgpParser("p(X,Y), h(Y) :- h(X). p(X,Z) :- p(X,Y), p(Y,Z). h(a)."));
    KnowledgeBase kb = kbBuilder.build();
    kb.query(DlgpParser.parseQuery("? :- p(a)."), 10000);
}
Also used : DlgpParser(fr.lirmm.graphik.graal.io.dlp.DlgpParser) KnowledgeBase(fr.lirmm.graphik.graal.api.kb.KnowledgeBase) Test(org.junit.Test)

Aggregations

KnowledgeBase (fr.lirmm.graphik.graal.api.kb.KnowledgeBase)16 DlgpParser (fr.lirmm.graphik.graal.io.dlp.DlgpParser)16 Test (org.junit.Test)16 Atom (fr.lirmm.graphik.graal.api.core.Atom)2 NegativeConstraint (fr.lirmm.graphik.graal.api.core.NegativeConstraint)2 Rule (fr.lirmm.graphik.graal.api.core.Rule)2 Substitution (fr.lirmm.graphik.graal.api.core.Substitution)2 Mapper (fr.lirmm.graphik.graal.api.core.mapper.Mapper)2 PrefixMapper (fr.lirmm.graphik.graal.core.mapper.PrefixMapper)2 AtomSet (fr.lirmm.graphik.graal.api.core.AtomSet)1 DefaultInMemoryGraphStore (fr.lirmm.graphik.graal.core.atomset.graph.DefaultInMemoryGraphStore)1