Skip to content

Commit

Permalink
Revert "Merge branch 'pr/fix/add-only-master-ontology-annotations'"
Browse files Browse the repository at this point in the history
This reverts commit 177277d, reversing
changes made to 10c4525.
  • Loading branch information
syphax-bouazzouni committed May 28, 2024
1 parent 68379d3 commit 2c71bdd
Showing 1 changed file with 11 additions and 52 deletions.
63 changes: 11 additions & 52 deletions src/main/java/org/stanford/ncbo/owlapi/wrapper/OntologyParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,45 +155,6 @@ private boolean isOBO(OWLOntology ontology) {
return isOBO;
}

/**
* Get ontology URI and imports. Add the ontology URI to the submission graph
* (<http://bioportal.bioontology.org/ontologies/URI> owl:versionInfo
* "ONTOLOGY_IRI"). And add all ontology imports to <ONTOLOGY_URI>
* omv:useImports <import_URI>
*
* @param fact
* @param sourceOnt
*/
private void addOntologyIRIAndImports(OWLDataFactory fact, OWLOntology sourceOnt) {
if (!sourceOnt.getOntologyID().isAnonymous()) {

// Get ontology URI
Optional<IRI> 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 <ONTOLOGY_URI> <metadata_property> <metadata_value>)
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
*
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit 2c71bdd

Please sign in to comment.