How i fix this Error loading an ontology in owlready2

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

How i fix this Error loading an ontology in owlready2

Erickaan

Hi friends, thanks for taking the time to resolve the issueI. Attach the code and error that it throws me


Code : from owlready2 import *
import os
 
onto = get_ontology("file://C:/Users/achev/Documents/Carro.owl")
onto.load()
n_classes = len(list(onto.classes()))
print(n_classes)

Error:
File "c:/Users/achev/Desktop/Proyecto de grado/Python/prueba.py", line 4, in onto = get_ontology("file://C:/Users/achev/Documents/Carro.owl").load() File "C:\ProgramData\Anaconda3\lib\site-packages\owlready2\namespace.py", line 810, in load if self.world.graph.indexed: self._load_properties() File "C:\ProgramData\Anaconda3\lib\site-packages\owlready2\namespace.py", line 849, in _load_properties raise TypeError("'%s' belongs to more than one entity types (cannot be both a property and a class/an individual)!" % Prop.iri)
Reply | Threaded
Open this post in threaded view
|

Re: How i fix this Error loading an ontology in owlready2

Jiba
Administrator
Hi,

It seems that, in your ontology, an entity is both an individual and a class. This is not supported by Owlready ; other tools (like Protégé) accept it but the semantics is not clear.

In the full error message, you should have the name of that entity.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: How i fix this Error loading an ontology in owlready2

Erickaan
Hello, thanks for answering, exactly that has been the solution.