use of owltools.io.ParserWrapper in project minerva by geneontology.
the class StartUpTool method startUp.
public static Server startUp(final MinervaStartUpConfig conf) throws Exception {
// load ontology
LOGGER.info("Start loading ontology: " + conf.ontology);
ParserWrapper pw = new ParserWrapper();
// if available, set catalog
if (conf.catalog != null) {
LOGGER.info("Adding catalog xml: " + conf.catalog);
pw.addIRIMapper(new CatalogXmlIRIMapper(conf.catalog));
}
MinervaOWLGraphWrapper graph = pw.parseToOWLGraph(conf.ontology);
// grab ontology metadata and store for status service
Map<IRI, Set<OWLAnnotation>> ont_annos = new HashMap<IRI, Set<OWLAnnotation>>();
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLAnnotationProperty versionIRI = factory.getOWLAnnotationProperty(OWLRDFVocabulary.OWL_VERSION_IRI.getIRI());
for (OWLOntology ont : graph.getAllOntologies()) {
Set<OWLAnnotation> maybeVersionAnnotation = ont.getOntologyID().getVersionIRI().transform(iri -> factory.getOWLAnnotation(versionIRI, iri)).asSet();
Set<OWLAnnotation> annotations = ont.getAnnotations();
annotations.addAll(maybeVersionAnnotation);
ont_annos.put(ont.getOWLOntologyManager().getOntologyDocumentIRI(ont), annotations);
}
OWLOntology full_tbox = forceMergeImports(graph.getSourceOntology(), graph.getAllOntologies());
graph.setSourceOntology(full_tbox);
if (conf.importantRelationParent != null) {
// try to find parent property
OWLObjectProperty parentProperty = getRelation(conf.importantRelationParent, graph);
if (parentProperty != null) {
// find all asserted direct sub properties of the parent property
conf.importantRelations = getAssertedSubProperties(parentProperty, graph);
if (conf.importantRelations.isEmpty()) {
LOGGER.warn("Could not find any asserted sub properties for parent: " + conf.importantRelationParent);
}
} else {
LOGGER.warn("Could not find a property for rel: " + conf.importantRelationParent);
}
}
// set folder to models
LOGGER.info("Model path: " + conf.journalFile);
// create model manager
LOGGER.info("Start initializing Minerva");
UndoAwareMolecularModelManager models = new UndoAwareMolecularModelManager(graph.getSourceOntology(), conf.curieHandler, conf.modelIdPrefix, conf.journalFile, conf.exportFolder, conf.pathToOntologyJournal, true);
// set pre and post file handlers
models.addPostLoadOntologyFilter(ModelReaderHelper.INSTANCE);
// conf.shex.tbox_reasoner = models.getTbox_reasoner();
conf.shex.setGo_lego_repo(models.getGolego_repo());
conf.shex.curieHandler = conf.curieHandler;
// start server
Server server = startUp(models, conf, ont_annos);
return server;
}
use of owltools.io.ParserWrapper in project minerva by geneontology.
the class FindGoCodesTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
curieHandler = DefaultCurieHandler.getDefaultHandler();
codes = new FindGoCodes(curieHandler);
ParserWrapper pw = new ParserWrapper();
eco = pw.parseOWL(IRI.create("http://purl.obolibrary.org/obo/eco.owl"));
}
use of owltools.io.ParserWrapper in project minerva by geneontology.
the class FindTaxonToolTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
ParserWrapper pw = new ParserWrapper();
NEO = pw.parse("http://purl.obolibrary.org/obo/go/noctua/neo.owl");
curieHandler = DefaultCurieHandler.getDefaultHandler();
}
use of owltools.io.ParserWrapper in project minerva by geneontology.
the class MolecularModelJsonRendererTest method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
ParserWrapper pw = new ParserWrapper();
File file = new File("src/test/resources/mgi-go.obo").getCanonicalFile();
OWLOntology ont = pw.parseOWL(IRI.create(file));
g = new MinervaOWLGraphWrapper(ont);
f = g.getDataFactory();
m = g.getManager();
partOf = g.getOWLObjectPropertyByIdentifier("BFO:0000050");
}
Aggregations