"argument 1 must be str, not int" error when copying to a new ontology

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

"argument 1 must be str, not int" error when copying to a new ontology

Louis
I am trying to modularize an ontology by copying specific classes and properties to a smaller subset.  I have found all the classes mentioned in the subset and equivalence axioms and followed the example here:

http://owlready.8326.n8.nabble.com/How-to-move-concepts-from-one-ontology-to-another-td1386.html#a1389


but get the  error when removing a blank node for a concept from an imported ontology:


Traceback (most recent call last):
  File "/app/pycharm/PycharmProjects/concept_tree_export.py", line 53, in <module>
    class_orig.is_a.remove(parent) # Blank node
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/util.py", line 80, in remove
    def remove(self, x):          old = list(self); super().remove(x)         ; self._callback(self._obj, old)
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/entity.py", line 233, in _class_is_a_changed
    for Subclass in Class.descendants(True, True):
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/entity.py", line 289, in descendants
    Class._fill_descendants(s, include_self, only_loaded, Class.namespace.world, Class.namespace.ontology)
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/entity.py", line 317, in _fill_descendants
    for equivalent in Class.equivalent_to.indirect():
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/entity.py", line 41, in indirect
    if self._indirect is None: self._build_indirect()
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/entity.py", line 37, in _build_indirect
    for o in n.world._get_obj_triples_transitive_sym(self._obj.storid, self._obj._owl_equivalent)
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/entity.py", line 38, in <genexpr>
    if o != self._obj.storid ))
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/namespace.py", line 259, in _to_python
    if   o < 0: return self._parse_bnode(o)
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/namespace.py", line 1032, in _parse_bnode
    r = self.world._get_by_storid(bnode, main_onto = self)
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/namespace.py", line 537, in _get_by_storid
    return self._load_by_storid(storid, full_iri, main_type, main_onto, default_to_none)
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/namespace.py", line 610, in _load_by_storid
    entity = ThingClass(name, types, { "namespace" : namespace, "storid" : storid } )
  File "/home/bailey/.local/lib/python3.7/site-packages/owlready2/entity.py", line 144, in __new__
    Class = namespace.world._entities[storid] = _is_a._obj = type.__new__(MetaClass, name, superclasses, obj_dict)
TypeError: type.__new__() argument 1 must be str, not int

Process finished with exit code 1


The int is the storid of the restriction.  

What can I do?  

Thanks,

Louis
Reply | Threaded
Open this post in threaded view
|

Re: "argument 1 must be str, not int" error when copying to a new ontology

Jiba
Administrator
Hi,

I've just tested the example you mentioned, and it is still working.

WHich version of Owlready are you using ? COuld you send me some code example to reproduce the problem ?

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: "argument 1 must be str, not int" error when copying to a new ontology

Louis
Thanks, it turns out I was using version 0.22, but upgrading solved it.