NCBI2OWL extends NCBIConverter { public static OWLOntology convertToOWL(String inputPath, Map<String, String> uniqueNames) throws IOException, OWLOntologyCreationException, OWLOntologyStorageException { OWLOntology ontology = NCBIOWL.createOWLOntology(); File file = new File(inputPath); FileInputStream fis = new FileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); try { SimpleDateFormat day = new SimpleDateFormat("yyyy-MM-dd"); String date = day.format(file.lastModified()); annotate(ontology, "owl:versionIRI", IRI.create(OBO + "ncbitaxon/" + date + "/ncbitaxon.owl")); Map<String, List<OWLClass>> labels = new HashMap<String, List<OWLClass>>(); OWLClass taxon = null; String line; int lineNumber = 0; while ((line = br.readLine()) != null) { taxon = handleLine(ontology, labels, taxon, line, lineNumber); lineNumber++; if (lineNumber % 10000 == 0) { logger.debug("At line " + lineNumber); } } logger.debug("Resolving duplicate label issues"); for(Entry<String, List<OWLClass>> entry : labels.entrySet()) { List<OWLClass> classes = entry.getValue(); if (classes.size() > 1) { final String originalLabel = entry.getKey(); Map<OWLClass, String> newLabels = createUniqueLabels(classes, originalLabel, uniqueNames); for (OWLClass owlClass : newLabels.keySet()) { final String newLabel = newLabels.get(owlClass); updateAnnotation(ontology, owlClass, "rdfs:label", newLabel); synonym(ontology, owlClass, "ncbitaxon:scientific_name", "oio:hasExactSynonym", originalLabel); } } } logger.debug("Finished reading lines: " + lineNumber); logger.debug("Filled ontology. Axioms: " + ontology.getAxiomCount()); return ontology; }finally { br.close(); } }  static void main(String[] args); static void error(String msg); static OWLOntology convertToOWL(String inputPath, Map<String, String> uniqueNames); static OWLOntology convertToOWL(String inputPath,
			String outputPath,
			Map<String, String> uniqueNames); static OWLOntology convertToOWL(String inputPath,
			String outputPath, InputStream mergeInfo,
			InputStream citationInfo,
			Map<String, String> uniqueNames); static String[] parseLine(String line, int lineNumber); static void checkAxioms(String inputPath, String outputPath); static void printAxioms(OWLOntology ontology, String outputPath);  }
@Test public void testConvert() { String inputPath = "src/test/resources/sample.dat"; String outputPath = "sample.owl"; try { OWLOntology ontology = NCBI2OWL.convertToOWL(inputPath, null); try { testOntology(ontology, sampleTaxa, sampleAnnotations); testBacteria(ontology); testActinobacteria(ontology); testSpecies(ontology); testExactSynonym(ontology); } finally { ontology.getOWLOntologyManager().removeOntology(ontology); } } catch (Exception e) { System.out.println("Exception in testConvert: " + e.toString()); } }