robot
robot copied to clipboard
Optional.get() cannot be called on an absent value
I tried to convert WikiPathways OWL/RDF format to OBO with:
java -jar ~/robot.jar convert --input wikipathways/wp/Human/WP12.ttl --output WP12.obo -vvv
And got this error:
Optional.get() cannot be called on an absent value
java.lang.IllegalStateException: Optional.get() cannot be called on an absent value
at com.google.common.base.Absent.get(Absent.java:47)
at org.obolibrary.obo2owl.OWLAPIOwl2Obo.getOntologyId(OWLAPIOwl2Obo.java:1178)
at org.obolibrary.obo2owl.OWLAPIOwl2Obo.convert(OWLAPIOwl2Obo.java:281)
at org.semanticweb.owlapi.oboformat.OBOFormatRenderer.render(OBOFormatRenderer.java:57)
at org.semanticweb.owlapi.oboformat.OBOFormatStorer.storeOntology(OBOFormatStorer.java:42)
at org.semanticweb.owlapi.util.AbstractOWLStorer.store(AbstractOWLStorer.java:99)
at org.semanticweb.owlapi.util.AbstractOWLStorer.storeOntology(AbstractOWLStorer.java:64)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.saveOntology(OWLOntologyManagerImpl.java:1478)
at org.obolibrary.robot.IOHelper.saveOntologyFile(IOHelper.java:1730)
at org.obolibrary.robot.IOHelper.saveOntology(IOHelper.java:846)
at org.obolibrary.robot.CommandLineHelper.maybeSaveOutput(CommandLineHelper.java:667)
at org.obolibrary.robot.ConvertCommand.execute(ConvertCommand.java:141)
at org.obolibrary.robot.CommandManager.executeCommand(CommandManager.java:244)
at org.obolibrary.robot.CommandManager.execute(CommandManager.java:188)
at org.obolibrary.robot.CommandManager.main(CommandManager.java:135)
at org.obolibrary.robot.CommandLineInterface.main(CommandLineInterface.java:60)
Try to use --check false. Note that you will create illegal OBO this way, OBO is not a good format for data pipelines (its a great format for ontology curation, but that's it - software should avoid depending on OBO!)
wget https://www.w3.org/2012/pyRdfa/extract?uri=http://vocabularies.wikipathways.org/wp# -O wp12.ttl
robot convert -i wp12.ttl -f obo -o wp12.obo
This is what you tried, and it fails:
OBO STRUCTURE ERROR Ontology does not conform to OBO structure rules:
multiple range tags not allowed. in frame:Frame(bdbPubChem id( bdbPubChem)comment( A variable URL to the PubChem data source (Compound identifiers).)property_value( inScheme http://vocabularies.wikipathways.org/wp#)name( BridgeDb PubChem link)range( Resource)range( Metabolite))
But you can bypass this and create an illegal OBO file (a file that looks like OBO but violates the OBO format conventions:
robot convert -i wp12.ttl --check false -f obo -o wp12.obo
head wp12.obo
Output:
format-version: 1.2
data-version: http://www.w3.org/2012/pyRdfa/extract?uri=http://vocabularies.wikipathways.org/wp#
ontology: http://vocabularies.wikipathways.org/wpTypes#
property_value: http://purl.org/dc/terms/contributor "Alexander Pico" xsd:string
property_value: http://purl.org/dc/terms/contributor "Andra Waagmeester" xsd:string
property_value: http://purl.org/dc/terms/contributor "Anwesha Bohler" xsd:string
property_value: http://purl.org/dc/terms/contributor "Egon Willighagen" xsd:string
property_value: http://purl.org/dc/terms/contributor "Martina Kutmon" xsd:string
property_value: http://purl.org/dc/terms/contributor "Ryan Miller" xsd:string
property_value: http://purl.org/dc/terms/contributor "Susan Coort" xsd:string
....
If this addresses your question, feel free to close the issue - or raise another :)
It would be nice to have an actionable error message. I think it's the case for NullPointerException.
@arteymix the problem is that this error is created by a downstream library. Would you be content with an error message like:
"ERROR: You tried to convert your ontology into OBO format, but it didn't follow OBO format rules. Please use --check false to bypass error checking, or chose to export to a different format."
This is not very helpful - but at ROBOT level, we do not really know what exactly is wrong with your ontology that you cannot convert it..
I would suggest that you wrap the calls to that downstream library with broad exception handling and convert those to a ROBOT-specific exception which can then be handled to produce the error message you mentioned. I would also add the cause to the error message. It might actually point to something wrong in the file that can be addressed.
I haven't tried the --check flag yet as we decided to use Reactome instead. I'll test it and let you know.
Great thank you!