geneontology / obographs

Basic and Advanced OBO Graphs: specification and reference implementation
63 stars 12 forks source link

How do I convert an obographs json file into OWL? #85

Closed matentzn closed 1 year ago

matentzn commented 1 year ago

We have converters the other way around. Would this be at all possible with the current API? @julesjacobsen

julesjacobsen commented 1 year ago

Maybe? This is really a question for @cmungall - is the conversion one-way or would it be feasible to write a converter back to OWL?

I'm willing to spend some time to do this but I don't know OWL well enough to say one way or another.

matentzn commented 1 year ago

Probably this is the answer:

https://github.com/geneontology/obographs/blob/master/obographs-owlapi/src/main/java/org/geneontology/obographs/owlapi/OboGraphJsonDocumentFormat.java

I am not 100% sure what the plan is here.. While I appreciate that a lot of work is going into our move to python-land, this seems a bit like a gaping hole!

Thanks @julesjacobsen :)

julesjacobsen commented 1 year ago

@matentzn if you point me to a Python implementation of Obographs -> OWL I'd be happy to implement that here.

matentzn commented 1 year ago

Implementing a full fledged parser is maybe not trivial.

In property OWLAPI land, this can become an endeavour. Here are all classes related to the Functional syntax parser:

https://github.com/owlcs/owlapi/tree/version4/parsers/src/main/java/org/semanticweb/owlapi/functional

I don't know how all of this fits together - maybe a OWLOntology o = OBOGraphs.parse(FileInputStream f) Would be sufficient for hacks.

cmungall commented 1 year ago

A preliminary implementation was introduced in:

https://github.com/INCATools/ontology-access-kit/releases/tag/v0.1.45

Command line:

runoak -i tests/input/go-nucleus.owl dump -o /tmp/test.ttl -O ttl

This is the code. It's pretty simple even when working at a low RDF level:

https://github.com/INCATools/ontology-access-kit/blob/main/src/oaklib/converters/obo_graph_to_rdf_owl_converter.py

I'm going to close this issue and open a more scoped one about implementing this functionality in this library in java