How to convert a big ontology from Turtle (.ttl) format to OWL/XML (.owl) format?

601 Views Asked by At

I am using an ontology from a GitHub here: https://raw.githubusercontent.com/oeg-upm/gtfs-bench/master/ontology/gtfs.ttl

The ontology is provided in Turtle format, but I need to convert it to OWL/XML format.

I tried to use online converters that available here: https://www.ldf.fi/service/owl-converter/ http://owl.cs.manchester.ac.uk/tools/webapps/owl-syntax-converter/

However, both converters not working. How could I convert a big ontology from Turtle (.ttl) format to OWL/XML (.owl) format?

1

There are 1 best solutions below

0
Roman Bekkiev On

GUI-based way

  1. Get the Protege Ontology Editor,
  2. Download the file,
  3. Open it in Protege (File -> Open)
  4. Save as RDF/XML (File -> Save As... brings "Select ontology format" window, it contains dropdown list, choose "RDF/XML Syntax there"; name the file and click "Save")

Python way

If you know python, which may be the case, if you're reading this site, you can convert Turtle into RDF/XML using RDFLib python library.

  1. Install rdflib (pip install rdflib (or pipenv or conda, whatever environment manager you use))
  2. Open turtle file
    from rdflib import Graph
    g = Graph()
    g.parse("gtfs.ttl", format="turtle")
    
  3. Save it as RDF/XML
    g.serialize(destination='gtfs.rdf', format='xml')