patternRuleMap = new HashMap<Pattern, Rule>();
try {
KiWiReasoningConnection connection = persistence.getConnection();
try {
programs = Iterations.asList(connection.listPrograms());
for(Program p : programs) {
for(Rule rule : p.getRules()) {
for(Pattern pattern : rule.getBody()) {
patternRuleMap.put(pattern,rule);