OwlReadyOntologyParsingErro

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

OwlReadyOntologyParsingErro

phdsumit
I have used the following code
from owlready2 import *
onto_path.append("C://Users//sumit//Documents//ISWC2020//new//")
onto = get_ontology("C://Users//sumit//Documents//ISWC2020//new//doid.owl")
onto.load()

Got error:
ExpatError                                Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\owlready2\rdfxml_2_ntriples.py in parse(f, on_prepare_obj, on_prepare_data, new_blank, default_base)
    314     else:
--> 315       parser.ParseFile(f)
    316   except Exception as e:

ExpatError: not well-formed (invalid token): line 78853, column 48

The above exception was the direct cause of the following exception:

OwlReadyOntologyParsingError              Traceback (most recent call last)
<ipython-input-1-e51ba21e8b3b> in <module>
      4     onto_path.append("C://Users//sumit//Documents//ISWC2020//new//")
      5     onto = get_ontology("C://Users//sumit//Documents//ISWC2020//new//doid.owl")
----> 6     onto.load()
      7 except OSError as err:
      8     print("OS error: {0}".format(err))

C:\ProgramData\Anaconda3\lib\site-packages\owlready2\namespace.py in load(self, only_local, fileobj, reload, reload_if_newer, **args)
    780         if _LOG_LEVEL: print("* Owlready2 *     ...loading ontology %s from %s..." % (self.name, f), file = sys.stderr)
    781         fileobj = open(f, "rb")
--> 782         try:     new_base_iri = self.graph.parse(fileobj, default_base = self.base_iri, **args)
    783         finally: fileobj.close()
    784       else:

C:\ProgramData\Anaconda3\lib\site-packages\owlready2\driver.py in parse(self, f, format, delete_existing_triples, default_base)
    194       except OwlReadyOntologyParsingError as e:
    195         if len(self) == 0: self._add_obj_triple_raw_spo(self.onto.storid, rdf_type, owl_ontology)
--> 196         raise e
    197
    198     elif format == "owlxml":

C:\ProgramData\Anaconda3\lib\site-packages\owlready2\driver.py in parse(self, f, format, delete_existing_triples, default_base)
    190         else:
    191           import owlready2.rdfxml_2_ntriples
--> 192           owlready2.rdfxml_2_ntriples.parse(f, on_prepare_obj, on_prepare_data, new_blank, default_base)
    193         onto_base_iri = on_finish()
    194       except OwlReadyOntologyParsingError as e:

C:\ProgramData\Anaconda3\lib\site-packages\owlready2\rdfxml_2_ntriples.py in parse(f, on_prepare_obj, on_prepare_data, new_blank, default_base)
    315       parser.ParseFile(f)
    316   except Exception as e:
--> 317     raise OwlReadyOntologyParsingError("RDF/XML parsing error in file %s, line %s, column %s." % (getattr(f, "name", getattr(f, "url", "???")), parser.CurrentLineNumber, parser.CurrentColumnNumber)) from e
    318
    319

OwlReadyOntologyParsingError: RDF/XML parsing error in file C://Users//sumit//Documents//ISWC2020//new//doid.owl, line 78853, column 48.
Reply | Threaded
Open this post in threaded view
|

Re: OwlReadyOntologyParsingErro

Jiba
Administrator
Hi,

doid.owl imports ext.owl, which itself imports many other ontologies. But ext.owl and the other ontologies are not in a format supported by Owlready2 (Ntriples, RDF/XML or OWL/XML).

You need to download these ontologies, and to convert them to RDF/XML (or another supported format).

Jiba