1

Is there a way to create a graph from an ontology file using Graph-tool library in Python?

I've done some research and what I've found is:

  • Graph Tool doesn't support .owl and .rdf files.
  • There is no obvious way to convert an ontology to a graph using this library, as far as I know (I hope I missed something that someone here knows about).

What I have tried:

I had the idea of converting OWL ontologies and OBO to a NetworkX Graph then to a Graph-tool graph (because all of my previous work was done with Graph-tool).

Method 1: Used onto2nx library.

Problems:

  • Really slow at loading ontologies and it stops half way.
  • Isn't documented at all so I couldn't even get an idea on how it works even after checking the source code (The person who created it was notified but didn't reply).

Method 2: Used RDFLib library.

I've based my solution no this answer but:

Problems:

  • 1
    While it is not graph-tool you might have a look to this example notebook which depicts bfo.owl with the help of networkx and nxv (graphviz-based): https://github.com/cknoll/semantictools/blob/main/doc/demo_notebooks/bfo_visualization.ipynb – cknoll Feb 20 '21 at 23:26

1 Answers1

2

Have you tried this:

https://readthedocs.org/projects/the-data-driven-ontology-toolkit-ddot/downloads/pdf/latest/

It has a function tonetworkx, maybe that’ll help.

Abdelghani Bekka
  • 576
  • 9
  • 18