robot-core/src/test/java/org/obolibrary/robot/TemplateTest.java
@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 = "/legacy-template-labels.csv";
    tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path)));
    path = "/legacy-template.csv";
    tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path)));
    OWLOntology simpleParts = loadOntology("/simple_parts.owl");

    List<OWLOntology> ontologies = new ArrayList<>();
    for (String table : tables.keySet()) {
      Template t = new Template(table, tables.get(table), simpleParts);
      ontologies.add(t.generateOutputOntology());
    }

    OWLOntology template = MergeOperation.merge(ontologies);
    for (OWLAxiom cls : template.getAxioms()) {
      System.out.println(cls);
    }
    assertEquals("Count classes", 4, template.getClassesInSignature().size());
    assertEquals("Count logical axioms", 3, template.getLogicalAxiomCount());
    assertEquals("Count all axioms", 11, template.getAxiomCount());
  }
/**
   * Test multiple templates in legacy format.
   *
   * @throws Exception if entities cannot be found
   */
Test multiple templates in legacy format.
@throws Exception if entities cannot be found
Test multiple templates in legacy format . @throws Exception if entities cannot be found
@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 = "/legacy-template-labels.csv";
    tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path)));
    path = "/legacy-template.csv";
    tables.put(path, TemplateHelper.readCSV(this.getClass().getResourceAsStream(path)));
    OWLOntology simpleParts = loadOntology("/simple_parts.owl");
    List<OWLOntology> ontologies = new ArrayList<>();
    for (String table : tables.keySet()) {
      Template t = new Template(table, tables.get(table), simpleParts);
      ontologies.add(t.generateOutputOntology());
    }
    OWLOntology template = MergeOperation.merge(ontologies);
    for (OWLAxiom cls : template.getAxioms()) {
      System.out.println(cls);
    }
    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 = "/legacy-template-labels.csv" ; tables . put ( path , TemplateHelper . readCSV ( this . getClass ( ) . getResourceAsStream ( path ) ) ) ; path = "/legacy-template.csv" ; tables . put ( path , TemplateHelper . readCSV ( this . getClass ( ) . getResourceAsStream ( path ) ) ) ; OWLOntology simpleParts = loadOntology ( "/simple_parts.owl" ) ; List < OWLOntology > ontologies = new ArrayList < > ( ) ; for ( String table : tables . keySet ( ) ) { Template t = new Template ( table , tables . get ( table ) , simpleParts ) ; ontologies . add ( t . generateOutputOntology ( ) ) ; } OWLOntology template = MergeOperation . merge ( ontologies ) ; for ( OWLAxiom cls : template . getAxioms ( ) ) { System . out . println ( cls ) ; } assertEquals ( "Count classes" , 4 , template . getClassesInSignature ( ) . size ( ) ) ; assertEquals ( "Count logical axioms" , 3 , template . getLogicalAxiomCount ( ) ) ; assertEquals ( "Count all axioms" , 11 , template . getAxiomCount ( ) ) ; }
Test multiple templates in legacy format.
Test multiple templates in legacy format .