use of fr.lirmm.graphik.graal.api.core.Query in project graal by graphik-team.
the class DefaultUnionOfConjunctiveQueries method appendTo.
@Override
public void appendTo(StringBuilder sb) {
for (Query q : this.queries) {
sb.append(q);
sb.append("\n| ");
}
}
use of fr.lirmm.graphik.graal.api.core.Query in project graal by graphik-team.
the class DefaultKnowledgeBaseTest method testAddTwoQueryWithSameNames.
/**
* Test method for
* {@link fr.lirmm.graphik.graal.kb.DefaultKnowledgeBase#addQuery(fr.lirmm.graphik.graal.api.core.Query)}.
* @throws ParseException
*/
@Test
public void testAddTwoQueryWithSameNames() throws ParseException {
Query q1 = DlgpParser.parseQuery("[Q] ? :- q1(X).");
Query q2 = DlgpParser.parseQuery("[Q] ? :- q2(X).");
KnowledgeBase kb = new KBBuilder().build();
kb.addQuery(q1);
kb.addQuery(q2);
Assert.assertTrue(kb.getQueryNames().contains("Q"));
Assert.assertEquals(q1, kb.getQuery("Q"));
Assert.assertEquals(2, kb.getQueryNames().size());
kb.close();
}
use of fr.lirmm.graphik.graal.api.core.Query in project graal by graphik-team.
the class DefaultKnowledgeBaseTest method testAddSameQueryTwice.
/**
* Test method for
* {@link fr.lirmm.graphik.graal.kb.DefaultKnowledgeBase#addQuery(fr.lirmm.graphik.graal.api.core.Query)}.
* @throws ParseException
*/
@Test
public void testAddSameQueryTwice() throws ParseException {
Query q1 = DlgpParser.parseQuery("[Q1] ? :- p(X).");
KnowledgeBase kb = new KBBuilder().build();
kb.addQuery(q1);
kb.addQuery(q1);
Assert.assertTrue(kb.getQueryNames().contains("Q1"));
Assert.assertEquals(q1, kb.getQuery("Q1"));
Assert.assertEquals(1, kb.getQueryNames().size());
kb.close();
}
use of fr.lirmm.graphik.graal.api.core.Query in project graal by graphik-team.
the class DefaultKnowledgeBaseTest method testAddQuery.
/**
* Test method for
* {@link fr.lirmm.graphik.graal.kb.DefaultKnowledgeBase#addQuery(fr.lirmm.graphik.graal.api.core.Query)}.
* @throws ParseException
*/
@Test
public void testAddQuery() throws ParseException {
Query q1 = DlgpParser.parseQuery("[Q1] ? :- p(X).");
KnowledgeBase kb = new KBBuilder().build();
kb.addQuery(q1);
Assert.assertTrue(kb.getQueryNames().contains("Q1"));
Assert.assertEquals(q1, kb.getQuery("Q1"));
kb.close();
}
Aggregations