TypeError: metaclass conflict

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

TypeError: metaclass conflict

cudillal
Hey, I'm trying to embed an ontology using OWL2Vec*, which uses Owlready2, but I'm getting an Owlready2 error when extracting triples from complex axioms:

Traceback (most recent call last):
  File "OWL2Vec-Star/OWL2Vec_Standalone.py", line 59, in <module>
    projection.extractProjection()
  File "/workspace/project/OWL2Vec-Star/owl2vec_star/lib/Onto_Projection.py", line 617, in extractProjection
    self.__extractTriplesFromComplexAxioms__()
  File "/workspace/project/OWL2Vec-Star/owl2vec_star/lib/Onto_Projection.py", line 798, in __extractTriplesFromComplexAxioms__
    for cls in self.onto.getClasses():
  File "/workspace/project/venv2/lib/python3.8/site-packages/owlready2/namespace.py", line 273, in classes
    if not s < 0: yield self.world._get_by_storid(s)
  File "/workspace/project/venv2/lib/python3.8/site-packages/owlready2/namespace.py", line 538, in _get_by_storid
    return self._load_by_storid(storid, full_iri, main_type, main_onto, default_to_none)
  File "/workspace/project/venv2/lib/python3.8/site-packages/owlready2/namespace.py", line 579, in _load_by_storid
    if obj2 is None: obj2 = self._load_by_storid(obj, None, main_type, main_onto, default_to_none, trace)
  File "/workspace/project/venv2/lib/python3.8/site-packages/owlready2/namespace.py", line 611, in _load_by_storid
    entity = ThingClass(name, types, { "namespace" : namespace, "storid" : storid } )
  File "/workspace/project/venv2/lib/python3.8/site-packages/owlready2/entity.py", line 145, in __new__
    Class = namespace.world._entities[storid] = _is_a._obj = type.__new__(MetaClass, name, superclasses, obj_dict)
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

The ontology I'm trying to embed is a merged ontology of HPO and HOOM, merged using Protégé.

Is this a bug? What is the problem here?
Reply | Threaded
Open this post in threaded view
|

Re: TypeError: metaclass conflict

Jiba
Administrator
Hi,

The "metaclass conflict" error usually means that Python cannot create classes that correspond to those in the ontology. This typically occurs when the ontology include inheritance schema not allowed by Python, such as a loop (e.g. A is a B, B is a C, C is a A).

jiba
Reply | Threaded
Open this post in threaded view
|

Re: TypeError: metaclass conflict

kliven
Hi,
So how can I solove the problem?
Reply | Threaded
Open this post in threaded view
|

Re: TypeError: metaclass conflict

Jiba
Administrator
Hi,

You need to modify the ontology and remove the inheritance loop.

Jiba