Template { public OWLOntology generateOutputOntology() throws Exception { return generateOutputOntology(null, false, null); } Template(@Nonnull String name, @Nonnull List<List<String>> rows);  Template(@Nonnull String name, @Nonnull List<List<String>> rows, IOHelper ioHelper);  Template(@Nonnull String name, @Nonnull List<List<String>> rows, OWLOntology inputOntology);  Template(
      @Nonnull String name,
      @Nonnull List<List<String>> rows,
      OWLOntology inputOntology,
      IOHelper ioHelper);  Template(
      @Nonnull String name,
      @Nonnull List<List<String>> rows,
      OWLOntology inputOntology,
      IOHelper ioHelper,
      QuotedEntityChecker checker); QuotedEntityChecker getChecker(); OWLOntology generateOutputOntology(); OWLOntology generateOutputOntology(String outputIRI, boolean force); OWLOntology generateOutputOntology(String outputIRI, boolean force, String errorsPath);  }
@Test public void testTemplateCSV() throws Exception { String path = "/template.csv"; List<List<String>> rows = TemplateHelper.readCSV(this.getClass().getResourceAsStream(path)); OWLOntology simpleParts = loadOntology("/simple_parts.owl"); Template t = new Template(path, rows, simpleParts); OWLOntology template = t.generateOutputOntology("http: assertIdentical("/template.owl", template); }
@Test public void testLegacyTemplateCSV() throws Exception { String path = "/legacy-template.csv"; List<List<String>> rows = TemplateHelper.readCSV(this.getClass().getResourceAsStream(path)); OWLOntology simpleParts = loadOntology("/simple_parts.owl"); Template t = new Template(path, rows, simpleParts); OWLOntology template = t.generateOutputOntology("http: assertIdentical("/template.owl", template); }
@Test public void testTemplates() throws Exception { Map<String, List<List<String>>> tables = new LinkedHashMap<>(); String path = "/template-ids.csv"; tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path))); path = "/template-labels.csv"; tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path))); path = "/template-logical.csv"; tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path))); OWLOntology in = loadOntology("/simple_parts.owl"); List<OWLOntology> ontologies = new ArrayList<>(); OWLOntology out; for (String table : tables.keySet()) { Template t = new Template(table, tables.get(table), in); out = t.generateOutputOntology(); ontologies.add(out); in = MergeOperation.merge(Lists.newArrayList(in, out)); } OWLOntology template = MergeOperation.merge(ontologies); assertEquals("Count classes", 4, template.getClassesInSignature().size()); assertEquals("Count logical axioms", 3, template.getLogicalAxiomCount()); assertEquals("Count all axioms", 11, template.getAxiomCount()); }
@Test public void testLegacyTemplates() throws Exception { Map<String, List<List<String>>> tables = new LinkedHashMap<>(); String path = "/template-ids.csv"; tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path))); path = "/template-labels.csv"; tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path))); path = "/legacy-template-logical.csv"; tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path))); OWLOntology in = loadOntology("/simple_parts.owl"); List<OWLOntology> ontologies = new ArrayList<>(); OWLOntology out; for (String table : tables.keySet()) { Template t = new Template(table, tables.get(table), in); out = t.generateOutputOntology(); ontologies.add(out); in = MergeOperation.merge(Lists.newArrayList(in, out)); } OWLOntology template = MergeOperation.merge(ontologies); assertEquals("Count classes", 4, template.getClassesInSignature().size()); assertEquals("Count logical axioms", 3, template.getLogicalAxiomCount()); assertEquals("Count all axioms", 11, template.getAxiomCount()); }