ValidateOperation { public static List<String> validate( Map<String, List<List<String>>> tables, OWLOntology ontology, IOHelper ioHelper, OWLReasonerFactory reasonerFactory, Map<String, String> options) throws Exception { if (options == null) { options = getDefaultOptions(); } QuotedEntityChecker checker = new QuotedEntityChecker(); checker.setIOHelper(new IOHelper()); checker.addProvider(new SimpleShortFormProvider()); OWLDataFactory dataFactory = OWLManager.getOWLDataFactory(); checker.addProperty(dataFactory.getRDFSLabel()); checker.addAll(ontology); ManchesterOWLSyntaxClassExpressionParser parser = new ManchesterOWLSyntaxClassExpressionParser(dataFactory, checker); OWLReasoner reasoner = reasonerFactory.createReasoner(ontology); String outFormat = options.getOrDefault("format", null); String outDir = options.getOrDefault("output-dir", "."); TableValidator validator = new TableValidator(ontology, ioHelper, parser, reasoner, outFormat, outDir); boolean silent = OptionsHelper.optionIsTrue(options, "silent"); if (silent && outFormat != null) { validator.toggleLogging(); } List<String> result = validator.validate(tables, options); String errorsPath = OptionsHelper.getOption(options, "errors", null); if (errorsPath != null) { List<String[]> errors = validator.getErrors(); if (errors.size() > 1) { IOHelper.writeTable(errors, errorsPath); } } return result; }  static Map<String, String> getDefaultOptions(); static List<String> validate(
      Map<String, List<List<String>>> tables,
      OWLOntology ontology,
      IOHelper ioHelper,
      OWLReasonerFactory reasonerFactory,
      Map<String, String> options);  }
@Test public void testImmuneExposuresValidation() throws Exception { IOHelper ioHelper = new IOHelper(); InputStream tableStream = this.getClass().getResourceAsStream("/immune_exposures.csv"); assert (tableStream != null); List<List<String>> tableData = IOHelper.readCSV(tableStream); assert (tableData != null); URL res = this.getClass().getResource("/immune_exposures.csv"); File file = Paths.get(res.toURI()).toFile(); String tablePath = file.getAbsolutePath(); Map<String, List<List<String>>> tables = new HashMap<>(); tables.put(tablePath, tableData); InputStream owlStream = this.getClass().getResourceAsStream("/immune_exposures.owl"); assert (owlStream != null); OWLOntology ontology = ioHelper.loadOntology(owlStream); assert (ontology != null); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); PrintStream prStream = new PrintStream(outStream); System.setOut(prStream); OWLReasonerFactory reasonerFactory = new ReasonerFactory(); ValidateOperation.validate(tables, ontology, ioHelper, reasonerFactory, null); String fileWithExpectedContents = this.getClass().getResource("/immune_exposures-result.txt").getPath(); assertNotEquals(fileWithExpectedContents, ""); String expectedResult = FileUtils.readFileToString(new File(fileWithExpectedContents)); assertEquals(outStream.toString(), expectedResult); }