private static void runReasoner(URL url) throws ReasonerException { PerformanceStatistic ps = new PerformanceStatistic(url); performanceStatistics.add(ps); Reasoner reasoner = new Reasoner(); reasoner.addReasonerMessageListener(messageListener); try { memoryMonitor.reset(); memoryMonitor.startMonitor(); ps.setStartLoadTheory(); reasoner.loadTheory(url); Theory theory = reasoner.getTheory(); ps.setEndLoadTheory(); ps.setNoOfRules(reasoner.getTheory().getFactsAndAllRules().size()); ps.setNoOfLiterals(reasoner.getTheory().getAllLiteralsInRules().size()); ps.setStartNormalFormTransformation(); reasoner.transformTheoryToRegularForm(); ps.setEndNormalFormTransformation(); if (theory.getDefeatersCount() > 0) { ps.setStartDefeaterRemoval(); reasoner.removeDefeater(); ps.setEndTimeDefeaterRemoval(); } switch (Conf.getReasonerVersion()) { case 1: if (theory.getSuperiorityCount() > 0) { ps.setStartSuperiorityRemoval(); reasoner.removeSuperiority(); ps.setEndTimeSuperiorityRemoval(); } break; default: } ps.setStartReasoning(); reasoner.getConclusions(); ps.setEndReasoning(); ps.setMaxMemoryUsed(memoryMonitor.getMemoryUsed()); if (Conf.isShowStatistics()) System.out.println(ps.toString()); if (Conf.isSaveResult()) { File fd = null; File urlFile = new File(url.getFile()); if ("".equals(url.getHost())) { // create the conclusions folder if it does not exists fd = new File(urlFile.getParentFile(), Conf.getResultFolder()); fd.mkdirs(); } else { fd = new File(Conf.getResultFolder(), url.getFile()); fd = fd.getParentFile(); if (null != fd.getParentFile()) fd.getParentFile().mkdirs(); } // create the conclusions file name File outFilename = FileManager.changeFileExtension( FileManager.addFilenamePostfix(urlFile, "_conclusions"), Conf.getConclusionExt()); File outFile = new File(fd, outFilename.getName()); // save conclusions reasoner.saveConclusions(outFile); } if (Conf.isLogInferenceProcess()) { InferenceLogger inferenceLogger = reasoner.getInferenceLogger(); if (null != inferenceLogger) { System.out.println( "=== Inference Logger - start ===\n" + inferenceLogger + "\n=== Inference Logger - end ==="); } } } catch (Exception e) { throw new ReasonerException("exception throw while reasoning", e); } finally { reasoner.clear(); reasoner.removeReasonerMessageListener(messageListener); reasoner = null; } }