DefaultKnowledgeBase extends AbstractProfilable implements KnowledgeBase { @Override public boolean addQuery(Query query) { if (query == null) { return false; } if (query.equals(this.queries.get(query.getLabel()))) { return false; } this.queryLabeler.setLabel(query); return this.queries.put(query.getLabel(), query) != null; } DefaultKnowledgeBase(Parser<Object> parser);  DefaultKnowledgeBase(AtomSet store, Parser<Object> parser);  DefaultKnowledgeBase(AtomSet store, RuleSet ontology); @Override RuleSet getOntology(); @Override AtomSet getFacts(); GraphOfRuleDependencies getGraphOfRuleDependencies(); @Override boolean isConsistent(); @Override void saturate(); @Override void semiSaturate(); @Override CloseableIterator<Substitution> homomorphism(Query query); @Override CloseableIterator<Substitution> query(Query query); @Override CloseableIterator<Substitution> query(Query query, long timeout); @Override void close(); @Override Set<String> getRuleNames(); @Override Rule getRule(String name); @Override boolean addQuery(Query query); @Override Set<String> getQueryNames(); @Override Query getQuery(String name); @Override Approach getApproach(); @Override String toString();  }
@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(); }