Error while loading ontologies

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

Error while loading ontologies

Haurangi
Hi, I'm encountering issues while trying to load these ontologies:
1. http://purl.obolibrary.org/obo/doid.owl 

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\driver.py", line 148, in parse
    s,p,o = splitter.split(line[:-3], 2)
ValueError: not enough values to unpack (expected 3, got 1)

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

Traceback (most recent call last):
  File "./scripts/ontobee_parser.py", line 191, in <module>
    ontology = owlready2.get_ontology(file_path).load()
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\namespace.py", line 813, in load
    imported_ontologies = [self.world.get_ontology(self._unabbreviate(abbrev_iri)).load() for abbrev_iri in self.world._get_obj_triples_sp_o(self.storid, owl_imports)]
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\namespace.py", line 813, in <listcomp>
    imported_ontologies = [self.world.get_ontology(self._unabbreviate(abbrev_iri)).load() for abbrev_iri in self.world._get_obj_triples_sp_o(self.storid, owl_imports)]
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\namespace.py", line 774, in load
    try:     new_base_iri = self.graph.parse(fileobj, default_base = self.base_iri, **args)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\driver.py", line 182, in parse
    raise OwlReadyOntologyParsingError("NTriples parsing error (or unrecognized file format) in %s, line %s." % (getattr(f, "name", getattr(f, "url", "???")), current_line)) from e
owlready2.base.OwlReadyOntologyParsingError: NTriples parsing error (or unrecognized file format) in https://raw.githubusercontent.com/DiseaseOntology/HumanDiseaseOntology/main/src/ontology/ext.owl, line 1.


2. http://purl.obolibrary.org/obo/clo.owl 

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\rdfxml_2_ntriples.py", line 315, in parse
    parser.ParseFile(f)
  File "c:\a\18\s\modules\pyexpat.c", line 471, in EndElement
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\rdfxml_2_ntriples.py", line 278, in endElement
    if   d in INT_DATATYPES:   o = int  (o)
ValueError: invalid literal for int() with base 10: '永生的乳腺衍生细胞系细胞'

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

Traceback (most recent call last):
  File "./scripts/ontobee_parser.py", line 191, in <module>
    ontology = owlready2.get_ontology(file_path).load()
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\namespace.py", line 784, in load
    try:     new_base_iri = self.graph.parse(fileobj, default_base = self.base_iri, **args)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\driver.py", line 197, in parse
    raise e
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\driver.py", line 193, in parse
    owlready2.rdfxml_2_ntriples.parse(f, on_prepare_obj, on_prepare_data, new_blank, default_base)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\owlready2\rdfxml_2_ntriples.py", line 317, in parse
    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
owlready2.base.OwlReadyOntologyParsingError: RDF/XML parsing error in file owl_files/CLO.owl, line 10985, column 71.


Both occur with Python 3.7 and 3.9.
Owlready2 version is 0.25
Reply | Threaded
Open this post in threaded view
|

Re: Error while loading ontologies

Jiba
Administrator
Hi,

For 1. http://purl.obolibrary.org/obo/doid.owl  , the problem is that the ontology imports http://purl.obolibrary.org/obo/doid/obo/ext.owl , which is not in a format that Owlready can read (RDF/XML, OWL/XML or N-Triples).

You need to download a local copy, translate it in one of these formats (e.g. with Protégé) and put it in directory listed in onto_path.

For 2. http://purl.obolibrary.org/obo/clo.owl , the ontology seems to contain an error in that line (10986):

        <rdfs:label rdf:datatype="&xsd;short">永生的乳腺衍生细胞系细胞</rdfs:label>

"永生的乳腺衍生细胞系细胞" is associated to the "short" datatype but it is not a number. Owlready is thus unable to parse that integer number.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Error while loading ontologies

Haurangi
Thank you for your reply.