Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from phenoscape/nexml-converter
Add converter for NeXML files to OWL.
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/scala/org/phenoscape/owl/build/ConvertNeXML.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.phenoscape.owl.build | ||
|
||
import java.io.File | ||
|
||
import org.phenoscape.owl.PhenexToOWL | ||
import org.phenoscape.owl.PropertyNormalizer | ||
import org.semanticweb.owlapi.apibinding.OWLManager | ||
import org.semanticweb.owlapi.formats.FunctionalSyntaxDocumentFormat | ||
import org.semanticweb.owlapi.model.IRI | ||
import java.io.FileOutputStream | ||
|
||
object ConvertNeXML extends App { | ||
|
||
val ontologyPath = args(0) | ||
val nexmlFiles = args.drop(1) | ||
val manager = OWLManager.createOWLOntologyManager() | ||
val ontology = manager.loadOntology(IRI.create(new File(ontologyPath))) | ||
nexmlFiles.foreach { file => | ||
val nexmlOnt = PropertyNormalizer.normalize(PhenexToOWL.convert(new File(file), ontology)) | ||
manager.saveOntology(nexmlOnt, new FunctionalSyntaxDocumentFormat(), new FileOutputStream(new File(s"$file.ofn"))) | ||
} | ||
|
||
} |