-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix OBO renderer stuck with untranslatable axioms on concurrent managers
protegeproject/protege#501 OBO renderers serialise untranslatable axioms as a functional syntax string, but the FS renderer needs an ontology to work on. Using the manager that hosts the ontology to save to create the new ontology causes a deadlock - the read lock has already been acquired, the creation of a new ontology tries to engage the write lock -> deadlock. Fix is to use an injector to get a new manager to create the ontology. A manager provider would be a better solution but there are static methods and interface changes involved.
- Loading branch information
1 parent
7a9507b
commit 49eaf8d
Showing
3 changed files
with
84 additions
and
46 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
contract/src/test/java/org/obolibrary/obo2owl/OBOWithUntranslatableAxiomTest.java
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,27 @@ | ||
package org.obolibrary.obo2owl; | ||
|
||
import org.junit.Test; | ||
import org.semanticweb.owlapi.apibinding.OWLManager; | ||
import org.semanticweb.owlapi.formats.OBODocumentFormat; | ||
import org.semanticweb.owlapi.io.OWLOntologyDocumentTarget; | ||
import org.semanticweb.owlapi.io.StringDocumentTarget; | ||
import org.semanticweb.owlapi.model.IRI; | ||
import org.semanticweb.owlapi.model.OWLDataFactory; | ||
import org.semanticweb.owlapi.model.OWLOntology; | ||
import org.semanticweb.owlapi.model.OWLOntologyCreationException; | ||
import org.semanticweb.owlapi.model.OWLOntologyStorageException; | ||
|
||
@SuppressWarnings({"javadoc", "null"}) | ||
public class OBOWithUntranslatableAxiomTest { | ||
|
||
@Test | ||
public void testNoDeadlock() throws OWLOntologyStorageException, OWLOntologyCreationException { | ||
OWLDataFactory df = OWLManager.getOWLDataFactory(); | ||
OWLOntology o = OWLManager.createConcurrentOWLOntologyManager() | ||
.createOntology(IRI.create("urn:test:ontology")); | ||
o.getOWLOntologyManager().addAxiom(o, | ||
df.getOWLSubClassOfAxiom(df.getOWLNothing(), df.getOWLThing())); | ||
OWLOntologyDocumentTarget target = new StringDocumentTarget(); | ||
o.saveOntology(new OBODocumentFormat(), target); | ||
} | ||
} |
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
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