public void setRules(String rulesFile) { try { log.info("Trying to load rule file: " + rulesFile); InputStream rulesStream = FileManager.get().open(rulesFile); Parser rules = Rule.rulesParserFromReader( new BufferedReader(new InputStreamReader(rulesStream, "UTF-8"))); reasoner = new GenericRuleReasoner(Rule.parseRules(rules)); log.info("Loaded!"); } catch (Throwable ex) { log.error("Problem loading rules <" + rulesFile + ">", ex); } }
public TDBStoreManager(String path) { this.path = path; accessor = DatasetAccessorFactory.createHTTP(dataURI); reasoner = new GenericRuleReasoner(Rule.rulesFromURL(path + rulesPath)); // File f = new File(dataDir); // if (!f.exists()) { // f.mkdirs(); // } // try { // System.out.println("DB files are present at: " + // f.getCanonicalPath()); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // Location location = Location.create(dataDir); // dataset = TDBFactory.createDataset(location); // if (dataset.listNames().hasNext()) { // alreadyExist = true; // } // base = dataset.getDefaultModel(); base = accessor.getModel(); OntModelSpec ontModelSpec = OntModelSpec.OWL_DL_MEM; ontModelSpec.setReasoner(reasoner); ontModel = ModelFactory.createOntologyModel(ontModelSpec, base); if (base.isEmpty()) { // om = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, base); // base = ModelFactory.createDefaultModel(); loadData(); // runReasoner(); saveData(); // accessor.putModel(ontModel); } }