Anonymous individuals are not implemented in OWLAPY. For example, attempting to load the following ontology (e.g., ontology_with_anonymous_individual.ttl):
Traceback (most recent call last):
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 832, in dispatch
impl = dispatch_cache[cls]
~~~~~~~~~~~~~~^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/weakref.py", line 415, in __getitem__
return self.data[ref(key)]
~~~~~~~~~^^^^^^^^^^
KeyError: <weakref at 0x713b5ac1f4c0; to '_jpype._JClass' at 0x6067a4bbad50 (uk.ac.manchester.cs.owl.owlapi.OWLAnonymousIndividualImpl)>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 835, in dispatch
impl = registry[cls]
~~~~~~~~^^^^^
KeyError: <java class 'uk.ac.manchester.cs.owl.owlapi.OWLAnonymousIndividualImpl'>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/XXX/Documents/owlapy-fix/owlapy-fixed/owlapy/owl_ontology.py", line 1346, in get_abox_axioms
return self.mapper.map_(self.owlapi_ontology.getABoxAxioms(self._get_imports_enum(include_imports_closure)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 946, in _method
return method.__get__(obj, cls)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/Documents/owlapy-fix/owlapy-fixed/owlapy/owlapi_mapper.py", line 644, in _
python_list.append(self.map_(obj))
^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 946, in _method
return method.__get__(obj, cls)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/Documents/owlapy-fix/owlapy-fixed/owlapy/owlapi_mapper.py", line 432, in _
return OWLClassAssertionAxiom(self.map_(e.getIndividual()), self.map_(e.getClassExpression()),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 945, in _method
method = self.dispatcher.dispatch(args[0].__class__)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 837, in dispatch
impl = _find_impl(cls, registry)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 784, in _find_impl
mro = _compose_mro(cls, registry.keys())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 772, in _compose_mro
return _c3_mro(cls, abcs=mro)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 725, in _c3_mro
other_c3_mros = [_c3_mro(base, abcs=abcs) for base in other_bases]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 725, in <listcomp>
other_c3_mros = [_c3_mro(base, abcs=abcs) for base in other_bases]
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 725, in _c3_mro
other_c3_mros = [_c3_mro(base, abcs=abcs) for base in other_bases]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 725, in <listcomp>
other_c3_mros = [_c3_mro(base, abcs=abcs) for base in other_bases]
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 726, in _c3_mro
return _c3_merge(
^^^^^^^^^^
File "/home/XXX/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/functools.py", line 680, in _c3_merge
raise RuntimeError("Inconsistent hierarchy")
Such a feature could be helpful for purposes such as class membership inference, in case not all individuals are known in advance, but some anonymous placeholders can be inserted.
The issue
Anonymous individuals are not implemented in OWLAPY. For example, attempting to load the following ontology (e.g.,
ontology_with_anonymous_individual.ttl):Using:
Results in:
Such a feature could be helpful for purposes such as class membership inference, in case not all individuals are known in advance, but some anonymous placeholders can be inserted.