diff --git a/src/main/java/org/stanford/ncbo/owlapi/wrapper/OntologyParser.java b/src/main/java/org/stanford/ncbo/owlapi/wrapper/OntologyParser.java index 15d21ff2..6d5611cb 100644 --- a/src/main/java/org/stanford/ncbo/owlapi/wrapper/OntologyParser.java +++ b/src/main/java/org/stanford/ncbo/owlapi/wrapper/OntologyParser.java @@ -155,45 +155,6 @@ private boolean isOBO(OWLOntology ontology) { return isOBO; } - /** - * Get ontology URI and imports. Add the ontology URI to the submission graph - * ( owl:versionInfo - * "ONTOLOGY_IRI"). And add all ontology imports to - * omv:useImports - * - * @param fact - * @param sourceOnt - */ - private void addOntologyIRIAndImports(OWLDataFactory fact, OWLOntology sourceOnt) { - if (!sourceOnt.getOntologyID().isAnonymous()) { - - // Get ontology URI - Optional sub = sourceOnt.getOntologyID().getOntologyIRI(); - IRI ontologyIRI = sub.get(); - - OWLAnnotationProperty prop = fact.getOWLAnnotationProperty(IRI.create(OWLRDFVocabulary.OWL_VERSION_INFO.toString())); - OWLAnnotationAssertionAxiom annOntoURI = fact.getOWLAnnotationAssertionAxiom(prop, IRI.create("http://bioportal.bioontology.org/ontologies/URI"), fact.getOWLLiteral(ontologyIRI.toString())); - this.targetOwlManager.addAxiom(targetOwlOntology, annOntoURI); - - // Get imports and add them as omv:useImports - OWLAnnotationProperty useImportProp = fact.getOWLAnnotationProperty(IRI.create("http://omv.ontoware.org/2005/05/ontology#useImports")); - for (OWLOntology imported : sourceOnt.getImports()) { - if (!imported.getOntologyID().isAnonymous()) { - log.info("useImports: " + imported.getOntologyID().getOntologyIRI().get().toString()); - OWLAnnotationAssertionAxiom useImportAxiom = fact.getOWLAnnotationAssertionAxiom(useImportProp, ontologyIRI, imported.getOntologyID().getOntologyIRI().get()); - this.targetOwlManager.addAxiom(targetOwlOntology, useImportAxiom); - } - } - - /* Done in addGroundMetadata now (Add ontology metadatas to ) - for (OWLAnnotation ann : sourceOnt.getAnnotations()) { - OWLAnnotationAssertionAxiom groundAnnotation = fact.getOWLAnnotationAssertionAxiom(ann.getProperty(), ontologyIRI, ann.getValue()); - this.targetOwlManager.addAxiom(targetOwlOntology, groundAnnotation); - } - */ - } - } - /** * Get the source ontology IRI and add it to the target ontology * @@ -287,23 +248,21 @@ private boolean buildOWLOntology(OWLOntology masterOntology, boolean isOBO) { return false; } + IRI documentIRI = sourceOwlManager.getOntologyDocumentIRI(masterOntology); - for (OWLOntology sourceOnt : sourceOwlManager.getOntologies()) { - IRI documentIRI = sourceOwlManager.getOntologyDocumentIRI(sourceOnt); + addGroundMetadata(documentIRI, fact, masterOntology); + generateGroundTriplesForAxioms(allAxioms, fact, masterOntology); - addGroundMetadata(documentIRI, fact, masterOntology); - generateGroundTriplesForAxioms(allAxioms, fact, masterOntology); + if (isOBO && !documentIRI.toString().startsWith("owlapi:ontology")) { + generateSKOSInObo(allAxioms, fact, masterOntology); + } - if (isOBO && !documentIRI.toString().startsWith("owlapi:ontology")) { - generateSKOSInObo(allAxioms, fact, sourceOnt); - } + boolean isPrefixedOWL = sourceOwlManager.getOntologyFormat(masterOntology).isPrefixOWLOntologyFormat(); + log.info("isPrefixOWLOntologyFormat: {}", isPrefixedOWL); + if (isPrefixedOWL && !isOBO) { + generateSKOSInOwl(allAxioms, fact, masterOntology); + } - boolean isPrefixedOWL = sourceOwlManager.getOntologyFormat(sourceOnt).isPrefixOWLOntologyFormat(); - log.info("isPrefixOWLOntologyFormat: {}", isPrefixedOWL); - if (isPrefixedOWL && !isOBO) { - generateSKOSInOwl(allAxioms, fact, sourceOnt); - } - } targetOwlManager.addAxioms(targetOwlOntology, allAxioms); for (OWLAnnotation ann : targetOwlOntology.getAnnotations()) {